swiftiply 0.6.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTORS +2 -0
  3. data/README.md +62 -0
  4. data/bin/{mongrel_rails → evented_mongrel_rails} +6 -14
  5. data/bin/swiftiplied_mongrel_rails +246 -0
  6. data/bin/swiftiply +136 -116
  7. data/bin/swiftiply_mongrel_rails +2 -2
  8. data/bin/swiftiplyctl +283 -0
  9. data/cleanup.sh +5 -0
  10. data/ext/deque/extconf.rb +162 -0
  11. data/ext/deque/swiftcore/rubymain.cpp +435 -0
  12. data/ext/fastfilereader/extconf.rb +2 -2
  13. data/ext/fastfilereader/mapper.cpp +2 -0
  14. data/ext/map/extconf.rb +161 -0
  15. data/ext/map/rubymain.cpp +500 -0
  16. data/ext/splaytree/extconf.rb +161 -0
  17. data/ext/splaytree/swiftcore/rubymain.cpp +580 -0
  18. data/ext/splaytree/swiftcore/splay_map.h +635 -0
  19. data/ext/splaytree/swiftcore/splay_set.h +575 -0
  20. data/ext/splaytree/swiftcore/splay_tree.h +1127 -0
  21. data/external/httpclient.rb +231 -0
  22. data/external/package.rb +13 -13
  23. data/setup.rb +18 -2
  24. data/src/swiftcore/Swiftiply.rb +417 -773
  25. data/src/swiftcore/Swiftiply/backend_protocol.rb +213 -0
  26. data/src/swiftcore/Swiftiply/cache_base.rb +49 -0
  27. data/src/swiftcore/Swiftiply/cache_base_mixin.rb +52 -0
  28. data/src/swiftcore/Swiftiply/cluster_managers/rest_based_cluster_manager.rb +9 -0
  29. data/src/swiftcore/Swiftiply/cluster_protocol.rb +70 -0
  30. data/src/swiftcore/Swiftiply/config.rb +370 -0
  31. data/src/swiftcore/Swiftiply/config/rest_updater.rb +26 -0
  32. data/src/swiftcore/Swiftiply/constants.rb +101 -0
  33. data/src/swiftcore/Swiftiply/content_cache_entry.rb +44 -0
  34. data/src/swiftcore/Swiftiply/content_response.rb +45 -0
  35. data/src/swiftcore/Swiftiply/control_protocol.rb +49 -0
  36. data/src/swiftcore/Swiftiply/dynamic_request_cache.rb +41 -0
  37. data/src/swiftcore/Swiftiply/etag_cache.rb +64 -0
  38. data/src/swiftcore/Swiftiply/file_cache.rb +46 -0
  39. data/src/swiftcore/Swiftiply/hash_cache_base.rb +22 -0
  40. data/src/swiftcore/Swiftiply/http_recognizer.rb +267 -0
  41. data/src/swiftcore/Swiftiply/loggers/Analogger.rb +21 -0
  42. data/src/swiftcore/Swiftiply/loggers/stderror.rb +13 -0
  43. data/src/swiftcore/Swiftiply/mocklog.rb +10 -0
  44. data/src/swiftcore/Swiftiply/proxy.rb +15 -0
  45. data/src/swiftcore/Swiftiply/proxy_backends/keepalive.rb +286 -0
  46. data/src/swiftcore/Swiftiply/proxy_backends/traditional.rb +286 -0
  47. data/src/swiftcore/Swiftiply/proxy_backends/traditional/redis_directory.rb +87 -0
  48. data/src/swiftcore/Swiftiply/proxy_backends/traditional/static_directory.rb +69 -0
  49. data/src/swiftcore/Swiftiply/proxy_bag.rb +716 -0
  50. data/src/swiftcore/Swiftiply/rest_based_cluster_manager.rb +15 -0
  51. data/src/swiftcore/Swiftiply/splay_cache_base.rb +21 -0
  52. data/src/swiftcore/Swiftiply/support_pagecache.rb +6 -3
  53. data/src/swiftcore/Swiftiply/swiftiply_2_http_proxy.rb +7 -0
  54. data/src/swiftcore/Swiftiply/swiftiply_client.rb +20 -5
  55. data/src/swiftcore/Swiftiply/version.rb +5 -0
  56. data/src/swiftcore/evented_mongrel.rb +26 -8
  57. data/src/swiftcore/hash.rb +43 -0
  58. data/src/swiftcore/method_builder.rb +28 -0
  59. data/src/swiftcore/streamer.rb +46 -0
  60. data/src/swiftcore/swiftiplied_mongrel.rb +91 -23
  61. data/src/swiftcore/types.rb +20 -3
  62. data/swiftiply.gemspec +14 -8
  63. data/test/TC_Deque.rb +152 -0
  64. data/test/TC_ProxyBag.rb +147 -166
  65. data/test/TC_Swiftiply.rb +576 -169
  66. data/test/TC_Swiftiply/mongrel/evented_hello.rb +1 -1
  67. data/test/TC_Swiftiply/mongrel/swiftiplied_hello.rb +1 -1
  68. data/test/TC_Swiftiply/test_serve_static_file_xsendfile/sendfile_client.rb +27 -0
  69. data/test/TC_Swiftiply/test_ssl/bin/validate_ssl_capability.rb +21 -0
  70. data/test/TC_Swiftiply/test_ssl/test.cert +16 -0
  71. data/test/TC_Swiftiply/test_ssl/test.key +15 -0
  72. data/{bin → test/bin}/echo_client +0 -0
  73. metadata +136 -94
  74. data/README +0 -126
  75. data/ext/swiftiply_parse/parse.rl +0 -90
@@ -22,4 +22,4 @@ end
22
22
  httpserver = Mongrel::HttpServer.new("127.0.0.1", 29998)
23
23
  httpserver.register("/hello", SimpleHandler.new)
24
24
  httpserver.register("/dir", Mongrel::DirHandler.new("."))
25
- httpserver.run.join
25
+ httpserver.run.join
@@ -22,4 +22,4 @@ end
22
22
  httpserver = Mongrel::HttpServer.new("127.0.0.1", 29999)
23
23
  httpserver.register("/hello", SimpleHandler.new)
24
24
  httpserver.register("/dir", Mongrel::DirHandler.new("."))
25
- httpserver.run.join
25
+ httpserver.run.join
@@ -0,0 +1,27 @@
1
+ # This client returns
2
+
3
+ require 'swiftcore/Swiftiply/swiftiply_client'
4
+
5
+ class SendFileClient < SwiftiplyClientProtocol
6
+ def post_init
7
+ @httpdata = ''
8
+ super
9
+ end
10
+
11
+ def receive_data data
12
+ @httpdata << data
13
+ if @httpdata =~ /\r\n\r\n/
14
+ @httpdata =~ /^(\w+)\s+([^\s\?]+).*(1.\d)/
15
+ send_http_data("Doing X-Sendfile to #{$2}",{'Connection' => 'close', 'X-Sendfile' => $2},200,'OK')
16
+ @httpdata = ''
17
+ end
18
+ end
19
+ end
20
+
21
+ if ARGV[0] and ARGV[0].index(/:/) > 0
22
+ h,p = ARGV[0].split(/:/,2)
23
+ EventMachine.run { SendFileClient.connect(h,p.to_i,ARGV[1] || '') }
24
+ else
25
+ puts "sendfile_client HOST:PORT [KEY]"
26
+ end# -*- coding: ISO-8859-1 -*-
27
+
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+ require 'eventmachine'
3
+ require 'net/http'
4
+ require 'net/https'
5
+
6
+ class P < EventMachine::Connection
7
+ def post_init; start_tls; end
8
+
9
+ def receive_data x
10
+ send_data("HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Type: text/plain\r\n\r\nBoo!")
11
+ close_connection_after_writing
12
+ end
13
+
14
+ end
15
+
16
+ EM.run do
17
+ EM.start_server('127.0.0.1',3333,P)
18
+ EM.add_timer(6) {EM.stop_event_loop}
19
+ end
20
+
21
+
@@ -0,0 +1,16 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIICfjCCAeegAwIBAgIBADANBgkqhkiG9w0BAQQFADCBhDELMAkGA1UEBhMCdXMx
3
+ EDAOBgNVBAgTB1d5b21pbmcxFjAUBgNVBAoTDVN3aWZ0Y29yZS5vcmcxEDAOBgNV
4
+ BAcTB1ZldGVyYW4xFjAUBgNVBAMTDXN3aWZ0Y29yZS5vcmcxITAfBgkqhkiG9w0B
5
+ CQEWEnd5aGFpbmVzQGdtYWlsLmNvbTAeFw0wODAxMTIwMzM5MDVaFw0wOTAxMTEw
6
+ MzM5MDVaMIGEMQswCQYDVQQGEwJ1czEQMA4GA1UECBMHV3lvbWluZzEWMBQGA1UE
7
+ ChMNU3dpZnRjb3JlLm9yZzEQMA4GA1UEBxMHVmV0ZXJhbjEWMBQGA1UEAxMNc3dp
8
+ ZnRjb3JlLm9yZzEhMB8GCSqGSIb3DQEJARYSd3loYWluZXNAZ21haWwuY29tMIGf
9
+ MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCsR9GmSjSkPQ4CvB8MsYQGsbGzVoZ6
10
+ hNINGZuwvV/gb2t0/7TZZ7NLQvfCmf3k30ahq2D/zvlDoz3uDEjUlKvEV6z5uOne
11
+ 75CSdtha0sOpWDJ6m5PZCm8SpsU2zWUVN6K64+l7RZfJCAYAnvRl4ottaYsLIW1M
12
+ Gf9HC9xTq17SYwIDAQABMA0GCSqGSIb3DQEBBAUAA4GBABfV8gLt6BFfPWVvs2HW
13
+ pg6fLsyeq3/l+Yhe/TSVVfoKyVbrZOCD3JG3C2VnkmgJxqyCpy1HHDjl57qLOCUu
14
+ BxloVkK3ZpGpaOkfHpluYr+kvKML1PBt9UkyTbmDoTQTD2eMdLpj/z/fXjG5dZCw
15
+ lSGr25W6yePTjYYK3clyJj9g
16
+ -----END CERTIFICATE-----
@@ -0,0 +1,15 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIICXQIBAAKBgQCsR9GmSjSkPQ4CvB8MsYQGsbGzVoZ6hNINGZuwvV/gb2t0/7TZ
3
+ Z7NLQvfCmf3k30ahq2D/zvlDoz3uDEjUlKvEV6z5uOne75CSdtha0sOpWDJ6m5PZ
4
+ Cm8SpsU2zWUVN6K64+l7RZfJCAYAnvRl4ottaYsLIW1MGf9HC9xTq17SYwIDAQAB
5
+ AoGATcjneaNLfVQrvURe6IZFzBfy2bwZX7wUcuG7D+ORJG5qIBtL9lUB+Ns1rmGE
6
+ 5w+AfoI4e4dhuA4+afqV75Vor7Go6aNRZqMiqHM3E1NhghzRl7xU1VhaWdqOxYsu
7
+ kFOvmnGkeoA/Ydkg2ZragqZyMyqIeLN5CFLeWm4CSPpZ3TECQQDg2n3qYwLzHOif
8
+ eMYK5zPm+lzbRTkYJ58r/XebFypMqStfW7/yfH0AiKFWOCHwXbnRTJ8SBviq9Jtu
9
+ OVuhWL+dAkEAxCULAWx0gjp/WIuhWyxD5ol89Cjjsfu2pH4jbxtPaZCz04jVbcWT
10
+ jlgqAqOuk7abfC5n8Ub5cOMjhf6LwCY5/wJAXZbTvhFEEwi/UlEkrTkag1NF/wZL
11
+ A2DKgbbYZ7c2pf3rzZ8Uv8tNBEHaVVa72Z5JT3KC6y/3pMB3SWOaXgfgiQJBAMBy
12
+ C9tIuwNvO7T3wsf+pVxS91tjpwvhCXFZJZEEvaS4ygc5URbT7JOT4xwV1tqtJt7v
13
+ dSJg3aqp4Re+CQXtO6cCQQCZ2vlEMtPmmpwpgAEhewVjXr45RTnxgK6OO93ezOj7
14
+ OiZz9tBof/hnah5U6KrUo+arFl2EgkROyzteQN2HrpeX
15
+ -----END RSA PRIVATE KEY-----
File without changes
metadata CHANGED
@@ -1,105 +1,147 @@
1
- --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
1
+ --- !ruby/object:Gem::Specification
4
2
  name: swiftiply
5
- version: !ruby/object:Gem::Version
6
- version: 0.6.1.1
7
- date: 2007-11-06 00:00:00 -06:00
8
- summary: A fast clustering proxy for web applications.
9
- require_paths:
10
- - src
11
- email: wyhaines@gmail.com
12
- homepage: http://swiftiply.swiftcore.org/
13
- rubyforge_project: swiftiply
14
- description: ""
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
- authors:
6
+ authors:
30
7
  - Kirk Haines
31
- files:
32
- - external
33
- - bin
34
- - test
35
- - src
36
- - ext
37
- - swiftiply.gemspec
38
- - README
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: eventmachine
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.1
27
+ description: ''
28
+ email: wyhaines@gmail.com
29
+ executables:
30
+ - swiftiply
31
+ - swiftiplied_mongrel_rails
32
+ - evented_mongrel_rails
33
+ - swiftiply_mongrel_rails
34
+ extensions:
35
+ - ext/fastfilereader/extconf.rb
36
+ - ext/deque/extconf.rb
37
+ - ext/splaytree/extconf.rb
38
+ extra_rdoc_files:
39
+ - README.md
40
+ files:
39
41
  - CONTRIBUTORS
40
- - setup.rb
41
- - external/package.rb
42
- - external/test_support.rb
43
- - bin/mongrel_rails
42
+ - README.md
43
+ - bin/evented_mongrel_rails
44
+ - bin/swiftiplied_mongrel_rails
44
45
  - bin/swiftiply
45
46
  - bin/swiftiply_mongrel_rails
46
- - bin/echo_client
47
- - test/TC_ProxyBag
48
- - test/TC_Swiftiply
49
- - test/TC_Swiftiply.rb
50
- - test/TC_ProxyBag.rb
51
- - test/TC_ProxyBag/test_serve_static_file
52
- - test/TC_Swiftiply/test_serve_normal_proxy_with_authentication
53
- - test/TC_Swiftiply/slow_echo_client
54
- - test/TC_Swiftiply/mongrel
55
- - test/TC_Swiftiply/test_serve_static_file_from_cachedir
56
- - test/TC_Swiftiply/test_serve_static_file
57
- - test/TC_Swiftiply/test_serve_normal_proxy
58
- - test/TC_Swiftiply/mongrel/threaded_hello.rb
59
- - test/TC_Swiftiply/mongrel/swiftiplied_hello.rb
60
- - test/TC_Swiftiply/mongrel/evented_hello.rb
61
- - test/TC_Swiftiply/test_serve_static_file_from_cachedir/public
47
+ - bin/swiftiplyctl
48
+ - cleanup.sh
49
+ - ext/deque/extconf.rb
50
+ - ext/deque/swiftcore/rubymain.cpp
51
+ - ext/fastfilereader/extconf.rb
52
+ - ext/fastfilereader/mapper.cpp
53
+ - ext/fastfilereader/mapper.h
54
+ - ext/fastfilereader/rubymain.cpp
55
+ - ext/map/extconf.rb
56
+ - ext/map/rubymain.cpp
57
+ - ext/splaytree/extconf.rb
58
+ - ext/splaytree/swiftcore/rubymain.cpp
59
+ - ext/splaytree/swiftcore/splay_map.h
60
+ - ext/splaytree/swiftcore/splay_set.h
61
+ - ext/splaytree/swiftcore/splay_tree.h
62
+ - external/httpclient.rb
63
+ - external/package.rb
64
+ - external/test_support.rb
65
+ - setup.rb
62
66
  - src/fastfilereader.rb
63
- - src/swiftcore
64
- - src/swiftcore/types.rb
65
- - src/swiftcore/Swiftiply
66
- - src/swiftcore/evented_mongrel.rb
67
67
  - src/swiftcore/Swiftiply.rb
68
- - src/swiftcore/swiftiplied_mongrel.rb
69
- - src/swiftcore/Swiftiply/swiftiply_client.rb
68
+ - src/swiftcore/Swiftiply/backend_protocol.rb
69
+ - src/swiftcore/Swiftiply/cache_base.rb
70
+ - src/swiftcore/Swiftiply/cache_base_mixin.rb
71
+ - src/swiftcore/Swiftiply/cluster_managers/rest_based_cluster_manager.rb
72
+ - src/swiftcore/Swiftiply/cluster_protocol.rb
73
+ - src/swiftcore/Swiftiply/config.rb
74
+ - src/swiftcore/Swiftiply/config/rest_updater.rb
75
+ - src/swiftcore/Swiftiply/constants.rb
76
+ - src/swiftcore/Swiftiply/content_cache_entry.rb
77
+ - src/swiftcore/Swiftiply/content_response.rb
78
+ - src/swiftcore/Swiftiply/control_protocol.rb
79
+ - src/swiftcore/Swiftiply/dynamic_request_cache.rb
80
+ - src/swiftcore/Swiftiply/etag_cache.rb
81
+ - src/swiftcore/Swiftiply/file_cache.rb
82
+ - src/swiftcore/Swiftiply/hash_cache_base.rb
83
+ - src/swiftcore/Swiftiply/http_recognizer.rb
84
+ - src/swiftcore/Swiftiply/loggers/Analogger.rb
85
+ - src/swiftcore/Swiftiply/loggers/stderror.rb
86
+ - src/swiftcore/Swiftiply/mocklog.rb
87
+ - src/swiftcore/Swiftiply/proxy.rb
88
+ - src/swiftcore/Swiftiply/proxy_backends/keepalive.rb
89
+ - src/swiftcore/Swiftiply/proxy_backends/traditional.rb
90
+ - src/swiftcore/Swiftiply/proxy_backends/traditional/redis_directory.rb
91
+ - src/swiftcore/Swiftiply/proxy_backends/traditional/static_directory.rb
92
+ - src/swiftcore/Swiftiply/proxy_bag.rb
93
+ - src/swiftcore/Swiftiply/rest_based_cluster_manager.rb
94
+ - src/swiftcore/Swiftiply/splay_cache_base.rb
70
95
  - src/swiftcore/Swiftiply/support_pagecache.rb
71
- - ext/swiftiply_parse
72
- - ext/fastfilereader
73
- - ext/swiftiply_parse/parse.rl
74
- - ext/fastfilereader/rubymain.cpp
75
- - ext/fastfilereader/extconf.rb
76
- - ext/fastfilereader/mapper.h
77
- - ext/fastfilereader/mapper.cpp
78
- test_files: []
79
-
80
- rdoc_options:
81
- - --title
96
+ - src/swiftcore/Swiftiply/swiftiply_2_http_proxy.rb
97
+ - src/swiftcore/Swiftiply/swiftiply_client.rb
98
+ - src/swiftcore/Swiftiply/version.rb
99
+ - src/swiftcore/evented_mongrel.rb
100
+ - src/swiftcore/hash.rb
101
+ - src/swiftcore/method_builder.rb
102
+ - src/swiftcore/streamer.rb
103
+ - src/swiftcore/swiftiplied_mongrel.rb
104
+ - src/swiftcore/types.rb
105
+ - swiftiply.gemspec
106
+ - test/TC_Deque.rb
107
+ - test/TC_ProxyBag.rb
108
+ - test/TC_Swiftiply.rb
109
+ - test/TC_Swiftiply/mongrel/evented_hello.rb
110
+ - test/TC_Swiftiply/mongrel/swiftiplied_hello.rb
111
+ - test/TC_Swiftiply/mongrel/threaded_hello.rb
112
+ - test/TC_Swiftiply/slow_echo_client
113
+ - test/TC_Swiftiply/test_serve_static_file_xsendfile/sendfile_client.rb
114
+ - test/TC_Swiftiply/test_ssl/bin/validate_ssl_capability.rb
115
+ - test/TC_Swiftiply/test_ssl/test.cert
116
+ - test/TC_Swiftiply/test_ssl/test.key
117
+ - test/bin/echo_client
118
+ homepage: http://swiftiply.swiftcore.org/
119
+ licenses: []
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options:
123
+ - "--title"
82
124
  - Swiftcore::Swiftiply
83
- - --main
84
- - README
85
- - --line-numbers
86
- extra_rdoc_files:
87
- - README
88
- executables:
89
- - swiftiply
90
- - mongrel_rails
91
- - swiftiply_mongrel_rails
92
- extensions:
93
- - ext/fastfilereader/extconf.rb
94
- requirements:
125
+ - "--main"
126
+ - README.md
127
+ - "--line-numbers"
128
+ require_paths:
129
+ - src
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements:
95
141
  - Eventmachine 0.8.1 or higher.
96
- dependencies:
97
- - !ruby/object:Gem::Dependency
98
- name: eventmachine
99
- version_requirement:
100
- version_requirements: !ruby/object:Gem::Version::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: 0.8.1
105
- version:
142
+ rubyforge_project: swiftiply
143
+ rubygems_version: 2.6.4
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: A fast clustering proxy for web applications.
147
+ test_files: []
data/README DELETED
@@ -1,126 +0,0 @@
1
- Swiftiply v. 0.6.0 (http://swiftiply.swiftcore.org)
2
-
3
- Swiftiply is a backend agnostic clustering proxy for web applications that is
4
- specifically designed to support HTTP traffic from web frameworks. Unlike Pen
5
- (http://siag.nu/pen/), Swiftiply is not intended as a general purpose load
6
- balancer for tcp protocols and unlike HAProxy (http://haproxy.1wt.eu/), it is
7
- not a highly configurable general purpose proxy overflowing with features.
8
-
9
- What it is, though, is a very fast, narrowly targetted clustering proxy.
10
- In back to back comparisons of Swiftiply to HAProxy, Swiftiply reliably
11
- outperforms HAProxy (tested using IOWA, Rails, Merb, and Ramaze backend
12
- processes running Mongrel).
13
-
14
- Swiftiply works differently from a traditional proxy. In Swiftiply, the
15
- backend processes are clients of the Swiftiply server -- they make persistent
16
- socket connections to Swiftiply. One of the major advantages to this
17
- architecture is that it allows one to start or stop backend processes at will,
18
- with no configuration of the proxy. The obvious disadvantage is that this is
19
- not behavior that backends typically expect.
20
-
21
- Because Mongrel is the preferred deployment method for most Ruby frameworks,
22
- Swiftiply includes a version of Mongrel (found in swiftcore/swiftiplied_mongrel.rb)
23
- that has been modified to work as a swiftiply client. This should be
24
- transparent to any existing Mongrel handlers, allowing them all to with
25
- Swiftiply.
26
-
27
- In addition, as an offshoot of the swiftiplied_mongrel, there is a second
28
- version that is available. This other version is found in
29
- swiftcore/evented_mongrel.rb; it is a version of Mongrel that has its network
30
- traffic handled by EventMachine, creating a Mongrel that runs in an event
31
- based mode instead of a threaded mode. For many applications, running in an
32
- event based mode will give better throughput than running in a threaded mode,
33
- especially when there are concurrent requests coming in.
34
-
35
- This is because the event based operation handles requests efficiently, on
36
- a first come, first served basis, without the overhead of threads. For the
37
- typical Rails application, this means that request handling may be slightly
38
- faster than the threaded Mongrel for single, non-concurrent requests. When
39
- there are concurrent requests, though, the differential increases quickly.
40
-
41
-
42
- FRAMEWORK SUPPORT
43
-
44
-
45
- Swiftcore IOWA
46
-
47
- IOWA has built in support for running in evented and clustered modes.
48
-
49
-
50
- Rails
51
-
52
- Swiftiply provides a _REPLACEMENT_ to mongrel_rails that, throught the use
53
- of an environment variable, can be told to run in either the evented mode or
54
- the swiftiplied mode.
55
-
56
- To run a Rails app in evented mode, set the EVENT environment variable. On
57
- a unixlike system:
58
-
59
- env EVENT=1 mongrel_rails
60
-
61
- will do it.
62
-
63
- To run in swiftiplied mode:
64
-
65
- env SWIFTIPLY=1 mongrel_rails
66
-
67
- Because Swiftiply backends connect to the Swiftiply server, they all connect
68
- on the same port. This is important. Each of the backends runs against the
69
- same port. To make it easier to start multiple Rails backends, a helper
70
- script, swiftiply_mongrel_rails, is provided. It is just a light wrapper
71
- around mongrel_rails that will let one start N backends, with proper pid
72
- files, and stop them.
73
-
74
-
75
- Merb
76
-
77
- The merb source (trunk only, at this point), has Swiftiply support that works
78
- just like the Rails support, built in.
79
-
80
-
81
- Ramaze
82
-
83
- A couple adapters for Ramaze are included, to allow Ramaze to run with either
84
- the evented or the swiftiplied mongrels. They are installed into
85
-
86
- ramaze/adapter/evented_mongrel.rb
87
- ramaze/adapter/swiftiplied_mongrel.rb
88
-
89
-
90
- Other Frameworks
91
-
92
- Swiftiply has been tested with Camping and Nitro, as well. Direct support for
93
- them is not yet bundled, but will be in an upcoming release.
94
-
95
-
96
- CONFIGURATION
97
-
98
- Swiftiply takes a single configuration file which defines for it where it
99
- should listen for incoming connections, whether it should daemonize itself,
100
- and then provides a map of incoming domain names and the address/port to
101
- proxy that traffic to. That outgoing address/port is where the backends for
102
- that site will connect to.
103
-
104
- Here's an example:
105
-
106
- cluster_address: swiftcore.org
107
- cluster_port: 80
108
- daemonize: true
109
- map:
110
- - incoming:
111
- - swiftcore.org
112
- - www.swiftcore.org
113
- outgoing: 127.0.0.1:30000
114
- default: true
115
- - incoming: iowa.swiftcore.org
116
- outgoing: 127.0.0.1:30010
117
- - incoming: analogger.swiftcore.org
118
- outgoing: 127.0.0.1:30020
119
- - incoming:
120
- - swiftiply.com
121
- - www.swiftiply.com
122
- - swiftiply.swiftcore.org
123
- outgoing: 127.0.0.1:30030
124
-
125
-
126
-