nitro 0.8.0 → 0.9.3

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 (198) hide show
  1. data/AUTHORS +3 -4
  2. data/ChangeLog +418 -0
  3. data/LICENSE +1 -1
  4. data/README +157 -89
  5. data/RELEASES +50 -0
  6. data/Rakefile +5 -7
  7. data/benchmark/nitro/bench.rb +5 -0
  8. data/benchmark/nitro/simple-webrick-n-200.txt +44 -0
  9. data/benchmark/nitro/static-webrick-n-200.txt +43 -0
  10. data/benchmark/nitro/tiny-lhttpd-n-200-c-5.txt +43 -0
  11. data/benchmark/nitro/tiny-webrick-n-200-c-5.txt +44 -0
  12. data/benchmark/nitro/tiny-webrick-n-200.txt +44 -0
  13. data/benchmark/nitro/tiny2-webrick-n-200.txt +44 -0
  14. data/{lib/nitro/server/cluster.rb → bin/cluster} +26 -30
  15. data/bin/proto/README +2 -2
  16. data/bin/proto/{apache.conf → conf/apache.conf} +0 -0
  17. data/bin/proto/conf/app.conf.rb +22 -0
  18. data/bin/proto/conf/lhttpd.conf +236 -0
  19. data/bin/proto/ctl +4 -0
  20. data/bin/proto/lib/README +5 -0
  21. data/bin/proto/log/README +3 -0
  22. data/bin/proto/root/fcgi.rb +6 -0
  23. data/bin/proto/root/index.xhtml +65 -7
  24. data/bin/proto/root/m/nitro.png +0 -0
  25. data/examples/blog/README +7 -5
  26. data/examples/blog/{apache.conf → conf/apache.conf} +0 -0
  27. data/examples/blog/conf/app.conf.rb +56 -0
  28. data/examples/blog/conf/lhttpd.conf +236 -0
  29. data/examples/blog/ctl +4 -0
  30. data/examples/blog/lib/blog.rb +11 -136
  31. data/examples/blog/lib/blog/controller.rb +99 -0
  32. data/examples/blog/lib/blog/model.rb +39 -0
  33. data/examples/blog/log/README +3 -0
  34. data/examples/blog/root/comments.xhtml +2 -2
  35. data/examples/blog/root/fcgi.rb +6 -0
  36. data/examples/blog/root/index.xhtml +4 -5
  37. data/examples/blog/root/login.xhtml +2 -2
  38. data/examples/blog/root/style.xsl +9 -9
  39. data/examples/blog/root/view_entry.xhtml +2 -2
  40. data/examples/flash/conf/app.conf.rb +23 -0
  41. data/examples/flash/ctl +4 -0
  42. data/examples/flash/log/README +3 -0
  43. data/examples/flash/root/index.xhtml +0 -9
  44. data/examples/flash/root/show_inline_text.xhtml +10 -5
  45. data/examples/no_xsl_blog/README +12 -0
  46. data/examples/no_xsl_blog/conf/apache.conf +0 -0
  47. data/examples/no_xsl_blog/conf/app.conf.rb +57 -0
  48. data/examples/no_xsl_blog/conf/lhttpd.conf +236 -0
  49. data/examples/no_xsl_blog/ctl +4 -0
  50. data/examples/no_xsl_blog/lib/blog.rb +20 -0
  51. data/examples/no_xsl_blog/lib/blog/controller.rb +102 -0
  52. data/examples/no_xsl_blog/lib/blog/model.rb +39 -0
  53. data/examples/no_xsl_blog/lib/blog/template.rb +134 -0
  54. data/examples/no_xsl_blog/log/README +3 -0
  55. data/examples/no_xsl_blog/root/comments.xhtml +41 -0
  56. data/examples/no_xsl_blog/root/entry_form.xhtml +22 -0
  57. data/examples/no_xsl_blog/root/fcgi.rb +6 -0
  58. data/examples/no_xsl_blog/root/index.xhtml +39 -0
  59. data/examples/no_xsl_blog/root/login.xhtml +21 -0
  60. data/examples/no_xsl_blog/root/m/bubbles.gif +0 -0
  61. data/examples/no_xsl_blog/root/m/comments_curve.gif +0 -0
  62. data/examples/no_xsl_blog/root/m/down.gif +0 -0
  63. data/examples/no_xsl_blog/root/m/footer_bg.gif +0 -0
  64. data/examples/no_xsl_blog/root/m/garrow.gif +0 -0
  65. data/examples/no_xsl_blog/root/m/gbull.gif +0 -0
  66. data/examples/no_xsl_blog/root/m/grbull.gif +0 -0
  67. data/examples/no_xsl_blog/root/m/h1_bg.gif +0 -0
  68. data/examples/no_xsl_blog/root/m/header_bg.gif +0 -0
  69. data/examples/no_xsl_blog/root/m/nitro.gif +0 -0
  70. data/examples/no_xsl_blog/root/m/obull.gif +0 -0
  71. data/examples/no_xsl_blog/root/m/page_bg.gif +0 -0
  72. data/examples/no_xsl_blog/root/m/rss.gif +0 -0
  73. data/examples/no_xsl_blog/root/m/side_title_bg.gif +0 -0
  74. data/examples/no_xsl_blog/root/m/sidebar_bg.gif +0 -0
  75. data/examples/no_xsl_blog/root/recent_posts.xhtml +14 -0
  76. data/examples/no_xsl_blog/root/style.css +301 -0
  77. data/examples/no_xsl_blog/root/view_entry.xhtml +25 -0
  78. data/examples/no_xsl_blog/root/view_entry.xml +12 -0
  79. data/examples/og/run.rb +2 -2
  80. data/examples/tiny/README +2 -2
  81. data/examples/tiny/conf/apache.conf +5 -0
  82. data/examples/tiny/conf/app.conf.rb +21 -0
  83. data/examples/tiny/conf/lhttpd.conf +236 -0
  84. data/examples/tiny/ctl +4 -0
  85. data/examples/tiny/log/README +3 -0
  86. data/examples/tiny/root/fcgi.rb +6 -0
  87. data/examples/tiny/root/index.xhtml +7 -4
  88. data/examples/tiny/root/nitro.png +0 -0
  89. data/lib/glue.rb +13 -9
  90. data/lib/glue/array.rb +1 -1
  91. data/lib/glue/cache.rb +1 -1
  92. data/lib/glue/flexob.rb +12 -0
  93. data/lib/glue/hash.rb +1 -1
  94. data/lib/glue/inflector.rb +2 -2
  95. data/lib/glue/logger.rb +4 -8
  96. data/lib/glue/misc.rb +14 -0
  97. data/lib/glue/number.rb +1 -1
  98. data/lib/glue/object.rb +26 -0
  99. data/lib/glue/pool.rb +1 -1
  100. data/lib/glue/property.rb +84 -91
  101. data/lib/glue/string.rb +1 -1
  102. data/lib/glue/time.rb +1 -1
  103. data/lib/glue/validation.rb +1 -1
  104. data/lib/nitro.rb +18 -6
  105. data/lib/nitro/adaptors/cgi.rb +291 -0
  106. data/lib/nitro/adaptors/fastcgi.rb +42 -0
  107. data/lib/nitro/adaptors/runner.rb +123 -0
  108. data/lib/nitro/adaptors/webrick.rb +110 -0
  109. data/lib/nitro/buffering.rb +43 -0
  110. data/lib/nitro/builders/form.rb +1 -1
  111. data/lib/nitro/builders/rss.rb +1 -1
  112. data/{bin → lib/nitro}/cluster.rb +26 -30
  113. data/lib/nitro/context.rb +82 -0
  114. data/lib/nitro/controller.rb +50 -0
  115. data/lib/nitro/cookie.rb +46 -0
  116. data/lib/nitro/dispatcher.rb +105 -0
  117. data/lib/nitro/filters.rb +9 -10
  118. data/lib/nitro/localization.rb +42 -0
  119. data/lib/nitro/mail.rb +11 -14
  120. data/lib/nitro/render.rb +275 -0
  121. data/lib/nitro/request.rb +128 -0
  122. data/lib/nitro/response.rb +38 -0
  123. data/lib/nitro/scaffold.rb +11 -11
  124. data/lib/nitro/session.rb +84 -0
  125. data/lib/nitro/{server/shaders.rb → shaders.rb} +56 -36
  126. data/lib/nitro/ui/pager.rb +23 -26
  127. data/lib/nitro/{sitemap.rb → ui/sitemap.rb} +4 -12
  128. data/lib/nitro/uri.rb +1 -1
  129. data/lib/nitro/version.rb +10 -8
  130. data/lib/og.rb +66 -65
  131. data/lib/og/backend.rb +1 -1
  132. data/lib/og/backends/mysql.rb +48 -52
  133. data/lib/og/backends/psql.rb +34 -37
  134. data/lib/og/connection.rb +15 -15
  135. data/lib/og/enchant.rb +16 -9
  136. data/lib/og/meta.rb +127 -54
  137. data/lib/og/mock.rb +18 -18
  138. data/lib/og/version.rb +6 -4
  139. data/lib/parts/content.rb +4 -8
  140. data/test/glue/tc_logger.rb +3 -0
  141. data/test/glue/tc_property.rb +19 -3
  142. data/test/nitro/adaptors/tc_cgi.rb +63 -0
  143. data/test/nitro/adaptors/tc_webrick.rb +15 -0
  144. data/test/nitro/builders/tc_xml.rb +2 -2
  145. data/test/nitro/tc_context.rb +13 -0
  146. data/test/nitro/tc_controller.rb +47 -0
  147. data/test/nitro/tc_dispatcher.rb +64 -0
  148. data/test/nitro/tc_session.rb +20 -0
  149. data/test/nitro/{tc_sitemap.rb → ui/tc_sitemap.rb} +1 -1
  150. data/test/root/blog/list.xhtml +6 -0
  151. data/test/tc_og.rb +41 -4
  152. metadata +115 -59
  153. data/bin/proto/app.rb +0 -20
  154. data/bin/proto/config.rb +0 -77
  155. data/examples/blog/app.rb +0 -21
  156. data/examples/blog/config.rb +0 -95
  157. data/examples/blog/env.rb +0 -22
  158. data/examples/flash/README +0 -34
  159. data/examples/flash/app.rb +0 -20
  160. data/examples/flash/config.rb +0 -38
  161. data/examples/flash/lib/flash.rb +0 -40
  162. data/examples/flash/tmp.swf +0 -0
  163. data/examples/tiny/app.rb +0 -19
  164. data/examples/tiny/config.rb +0 -29
  165. data/examples/tiny/root/nitro-small.png +0 -0
  166. data/lib/nitro/application.rb +0 -217
  167. data/lib/nitro/config.rb +0 -128
  168. data/lib/nitro/events.rb +0 -122
  169. data/lib/nitro/html.rb +0 -151
  170. data/lib/nitro/http.rb +0 -102
  171. data/lib/nitro/l10n.rb +0 -30
  172. data/lib/nitro/server.rb +0 -59
  173. data/lib/nitro/server/appserver.rb +0 -67
  174. data/lib/nitro/server/cookie.rb +0 -87
  175. data/lib/nitro/server/dispatcher.rb +0 -62
  176. data/lib/nitro/server/filters.rb +0 -75
  177. data/lib/nitro/server/filters/autologin.rb +0 -51
  178. data/lib/nitro/server/fragment.rb +0 -70
  179. data/lib/nitro/server/handlers.rb +0 -127
  180. data/lib/nitro/server/render.rb +0 -426
  181. data/lib/nitro/server/request.rb +0 -658
  182. data/lib/nitro/server/requestpart.rb +0 -54
  183. data/lib/nitro/server/script.rb +0 -387
  184. data/lib/nitro/server/server.rb +0 -57
  185. data/lib/nitro/server/session.rb +0 -220
  186. data/lib/nitro/server/user.rb +0 -46
  187. data/lib/nitro/server/webrick.rb +0 -180
  188. data/lib/nitro/service.rb +0 -26
  189. data/lib/xsl/ui.xsl +0 -51
  190. data/lib/xsl/xforms.xsl +0 -28
  191. data/test/nitro/server/tc_cookie.rb +0 -34
  192. data/test/nitro/server/tc_filters.rb +0 -38
  193. data/test/nitro/server/tc_request.rb +0 -70
  194. data/test/nitro/server/tc_requestpart.rb +0 -28
  195. data/test/nitro/server/tc_session.rb +0 -34
  196. data/test/nitro/tc_events.rb +0 -44
  197. data/test/nitro/tc_html.rb +0 -79
  198. data/test/nitro/tc_http.rb +0 -18
data/Rakefile CHANGED
@@ -1,8 +1,6 @@
1
- # code:
2
1
  # * George Moschovitis <gm@navel.gr>
3
- #
4
- # (c) 2004 Navel, all rights reserved.
5
- # $Id: connection.rb 71 2004-10-18 10:50:22Z gmosx $
2
+ # (c) 2004-2005 Navel, all rights reserved.
3
+ # $Id$
6
4
 
7
5
  require "rake"
8
6
  require "rake/rdoctask"
@@ -52,7 +50,7 @@ if 'nitro' == project
52
50
  #
53
51
  require "lib/nitro/version"
54
52
 
55
- PKG_VERSION = $srv_version
53
+ PKG_VERSION = Nitro::Version
56
54
  PKG_FILES = FileList[
57
55
  "[A-Z]*", "{bin,benchmark,etc,ext,examples,doc,lib,test,vendor}/**/*"
58
56
  # "examples/*.rb"
@@ -87,7 +85,7 @@ else
87
85
  #
88
86
  require "lib/og/version"
89
87
 
90
- PKG_VERSION = $og_version
88
+ PKG_VERSION = Og::Version
91
89
  PKG_FILES = FileList[
92
90
  "README.og", "RELEASES.og", "LICENSE", "AUTHORS", "Rakefile", "ChangeLog*",
93
91
  "examples/og/*", "lib/glue.rb", "lib/glue/**/*", "lib/og/**/*", "lib/og.rb",
@@ -114,7 +112,7 @@ else
114
112
  s.author = "George Moschovitis"
115
113
  s.email = "gm@navel.gr"
116
114
  s.homepage = "http://www.navel.gr/og"
117
- s.rubyforge_project = "og-rml"
115
+ s.rubyforge_project = "nitro"
118
116
  end
119
117
 
120
118
  end
@@ -0,0 +1,5 @@
1
+ # * George Moschovitis <gm@navel.gr>
2
+ # (c) 2005 Navel, all rights reserved.
3
+ # $Id$
4
+
5
+
@@ -0,0 +1,44 @@
1
+ This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
2
+ Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
3
+ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
4
+
5
+ Benchmarking localhost (be patient)
6
+
7
+
8
+ Server Software: WEBrick/1.3.1
9
+ Server Hostname: localhost
10
+ Server Port: 8080
11
+
12
+ Document Path: /index2
13
+ Document Length: 42 bytes
14
+
15
+ Concurrency Level: 1
16
+ Time taken for tests: 4.644158 seconds
17
+ Complete requests: 200
18
+ Failed requests: 0
19
+ Write errors: 0
20
+ Non-2xx responses: 200
21
+ Total transferred: 51200 bytes
22
+ HTML transferred: 8400 bytes
23
+ Requests per second: 43.06 [#/sec] (mean)
24
+ Time per request: 23.221 [ms] (mean)
25
+ Time per request: 23.221 [ms] (mean, across all concurrent requests)
26
+ Transfer rate: 10.77 [Kbytes/sec] received
27
+
28
+ Connection Times (ms)
29
+ min mean[+/-sd] median max
30
+ Connect: 1 1 2.2 1 31
31
+ Processing: 15 20 11.2 18 89
32
+ Waiting: 0 0 0.0 0 0
33
+ Total: 16 22 11.3 19 90
34
+
35
+ Percentage of the requests served within a certain time (ms)
36
+ 50% 19
37
+ 66% 19
38
+ 75% 19
39
+ 80% 20
40
+ 90% 48
41
+ 95% 52
42
+ 98% 55
43
+ 99% 56
44
+ 100% 90 (longest request)
@@ -0,0 +1,43 @@
1
+ This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
2
+ Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
3
+ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
4
+
5
+ Benchmarking localhost (be patient)
6
+
7
+
8
+ Server Software: WEBrick/1.3.1
9
+ Server Hostname: localhost
10
+ Server Port: 8080
11
+
12
+ Document Path: /test.html
13
+ Document Length: 18 bytes
14
+
15
+ Concurrency Level: 1
16
+ Time taken for tests: 4.108503 seconds
17
+ Complete requests: 200
18
+ Failed requests: 0
19
+ Write errors: 0
20
+ Total transferred: 51400 bytes
21
+ HTML transferred: 3600 bytes
22
+ Requests per second: 48.68 [#/sec] (mean)
23
+ Time per request: 20.543 [ms] (mean)
24
+ Time per request: 20.543 [ms] (mean, across all concurrent requests)
25
+ Transfer rate: 12.17 [Kbytes/sec] received
26
+
27
+ Connection Times (ms)
28
+ min mean[+/-sd] median max
29
+ Connect: 0 0 2.2 0 30
30
+ Processing: 14 19 10.2 16 59
31
+ Waiting: 0 11 12.2 13 58
32
+ Total: 14 19 10.4 16 59
33
+
34
+ Percentage of the requests served within a certain time (ms)
35
+ 50% 16
36
+ 66% 17
37
+ 75% 17
38
+ 80% 18
39
+ 90% 44
40
+ 95% 48
41
+ 98% 50
42
+ 99% 50
43
+ 100% 59 (longest request)
@@ -0,0 +1,43 @@
1
+ This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
2
+ Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
3
+ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
4
+
5
+ Benchmarking localhost (be patient)
6
+
7
+
8
+ Server Software:
9
+ Server Hostname: localhost
10
+ Server Port: 8080
11
+
12
+ Document Path: /index
13
+ Document Length: 892 bytes
14
+
15
+ Concurrency Level: 5
16
+ Time taken for tests: 0.887273 seconds
17
+ Complete requests: 200
18
+ Failed requests: 0
19
+ Write errors: 0
20
+ Total transferred: 201200 bytes
21
+ HTML transferred: 178400 bytes
22
+ Requests per second: 225.41 [#/sec] (mean)
23
+ Time per request: 22.182 [ms] (mean)
24
+ Time per request: 4.436 [ms] (mean, across all concurrent requests)
25
+ Transfer rate: 220.90 [Kbytes/sec] received
26
+
27
+ Connection Times (ms)
28
+ min mean[+/-sd] median max
29
+ Connect: 0 0 1.0 0 8
30
+ Processing: 5 21 16.0 14 88
31
+ Waiting: 1 20 16.1 14 87
32
+ Total: 6 21 16.1 14 88
33
+
34
+ Percentage of the requests served within a certain time (ms)
35
+ 50% 14
36
+ 66% 15
37
+ 75% 16
38
+ 80% 32
39
+ 90% 46
40
+ 95% 47
41
+ 98% 87
42
+ 99% 88
43
+ 100% 88 (longest request)
@@ -0,0 +1,44 @@
1
+ This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
2
+ Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
3
+ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
4
+
5
+ Benchmarking localhost (be patient)
6
+
7
+
8
+ Server Software: WEBrick/1.3.1
9
+ Server Hostname: localhost
10
+ Server Port: 8080
11
+
12
+ Document Path: /index
13
+ Document Length: 417 bytes
14
+
15
+ Concurrency Level: 5
16
+ Time taken for tests: 6.968057 seconds
17
+ Complete requests: 200
18
+ Failed requests: 0
19
+ Write errors: 0
20
+ Non-2xx responses: 202
21
+ Total transferred: 127664 bytes
22
+ HTML transferred: 84234 bytes
23
+ Requests per second: 28.70 [#/sec] (mean)
24
+ Time per request: 174.201 [ms] (mean)
25
+ Time per request: 34.840 [ms] (mean, across all concurrent requests)
26
+ Transfer rate: 17.80 [Kbytes/sec] received
27
+
28
+ Connection Times (ms)
29
+ min mean[+/-sd] median max
30
+ Connect: 0 14 29.1 0 119
31
+ Processing: 25 156 71.1 163 446
32
+ Waiting: 0 113 61.8 115 394
33
+ Total: 94 170 53.7 163 446
34
+
35
+ Percentage of the requests served within a certain time (ms)
36
+ 50% 163
37
+ 66% 188
38
+ 75% 196
39
+ 80% 199
40
+ 90% 210
41
+ 95% 221
42
+ 98% 409
43
+ 99% 425
44
+ 100% 446 (longest request)
@@ -0,0 +1,44 @@
1
+ This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
2
+ Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
3
+ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
4
+
5
+ Benchmarking localhost (be patient)
6
+
7
+
8
+ Server Software: WEBrick/1.3.1
9
+ Server Hostname: localhost
10
+ Server Port: 8080
11
+
12
+ Document Path: /index
13
+ Document Length: 417 bytes
14
+
15
+ Concurrency Level: 1
16
+ Time taken for tests: 4.214142 seconds
17
+ Complete requests: 200
18
+ Failed requests: 0
19
+ Write errors: 0
20
+ Non-2xx responses: 200
21
+ Total transferred: 126400 bytes
22
+ HTML transferred: 83400 bytes
23
+ Requests per second: 47.46 [#/sec] (mean)
24
+ Time per request: 21.071 [ms] (mean)
25
+ Time per request: 21.071 [ms] (mean, across all concurrent requests)
26
+ Transfer rate: 29.19 [Kbytes/sec] received
27
+
28
+ Connection Times (ms)
29
+ min mean[+/-sd] median max
30
+ Connect: 0 0 0.2 0 2
31
+ Processing: 14 20 11.3 16 86
32
+ Waiting: 0 18 11.5 15 85
33
+ Total: 14 20 11.3 16 86
34
+
35
+ Percentage of the requests served within a certain time (ms)
36
+ 50% 16
37
+ 66% 17
38
+ 75% 18
39
+ 80% 18
40
+ 90% 44
41
+ 95% 51
42
+ 98% 53
43
+ 99% 55
44
+ 100% 86 (longest request)
@@ -0,0 +1,44 @@
1
+ This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
2
+ Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
3
+ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
4
+
5
+ Benchmarking localhost (be patient)
6
+
7
+
8
+ Server Software: WEBrick/1.3.1
9
+ Server Hostname: localhost
10
+ Server Port: 8080
11
+
12
+ Document Path: /index2
13
+ Document Length: 42 bytes
14
+
15
+ Concurrency Level: 1
16
+ Time taken for tests: 3.794328 seconds
17
+ Complete requests: 200
18
+ Failed requests: 0
19
+ Write errors: 0
20
+ Non-2xx responses: 200
21
+ Total transferred: 41000 bytes
22
+ HTML transferred: 8400 bytes
23
+ Requests per second: 52.71 [#/sec] (mean)
24
+ Time per request: 18.972 [ms] (mean)
25
+ Time per request: 18.972 [ms] (mean, across all concurrent requests)
26
+ Transfer rate: 10.54 [Kbytes/sec] received
27
+
28
+ Connection Times (ms)
29
+ min mean[+/-sd] median max
30
+ Connect: 0 0 0.2 0 2
31
+ Processing: 12 18 10.9 14 85
32
+ Waiting: 0 16 11.4 13 83
33
+ Total: 12 18 10.9 15 85
34
+
35
+ Percentage of the requests served within a certain time (ms)
36
+ 50% 15
37
+ 66% 15
38
+ 75% 16
39
+ 80% 17
40
+ 90% 43
41
+ 95% 47
42
+ 98% 48
43
+ 99% 49
44
+ 100% 85 (longest request)
@@ -1,23 +1,22 @@
1
- # code:
2
1
  # * George Moschovitis <gm@navel.gr>
3
- #
4
- # (c) 2004 Navel, all rights reserved.
5
- # $Id: cluster.rb 167 2004-11-23 14:03:10Z gmosx $
2
+ # (c) 2004-2005 Navel, all rights reserved.
3
+ # $Id: cluster.rb 234 2005-01-27 13:01:40Z gmosx $
4
+
5
+ # WARNING: This is old code, not updated to work in the
6
+ # latest nitro release. Will be fixed ASAP.
6
7
 
7
- $:.unshift "lib"
8
+ $:.unshift 'lib'
8
9
 
9
- require "drb"
10
- require "monitor"
10
+ require 'drb'
11
+ require 'monitor'
11
12
 
12
- require "nitro/application"
13
- require "nitro/server"
14
- require "glue/cache"
15
- require "nitro/server/session"
13
+ require 'nitro/application'
14
+ require 'nitro/server'
15
+ require 'glue/cache'
16
+ require 'nitro/server/session'
16
17
 
17
18
  module N
18
19
 
19
- # = Cluster
20
- #
21
20
  # A Cluster manages the state of a collection of servers. The cluster
22
21
  # synchronizes the servers and distributes the state. An older version
23
22
  # used a polling system, ie: the servers polled the cluster to
@@ -25,25 +24,25 @@ module N
25
24
  # state is changed a delta is pushed to the clients.
26
25
  #
27
26
  # TODO: use Sync instead of Monitor
28
- #
27
+
29
28
  class Cluster < N::Application
30
29
 
31
- # = CHash ClusterHash
32
- #
33
30
  # The CHash 'endpoint' resides in the Cluster server
34
- #
31
+
35
32
  class CHash < Hash
36
33
  attr :mon
37
34
 
38
35
  # drbobject for this hash (local)
36
+
39
37
  attr_accessor :ldrb
40
38
 
41
39
  # the cluster, use a cluster to implement a set
42
40
  # (one server per drb_uri)
41
+
43
42
  attr_accessor :cluster
44
43
 
45
44
  #
46
- #
45
+
47
46
  def initialize(ldrb_uri = "druby://:8000")
48
47
  @mon = Monitor.new
49
48
  @ldrb = DRb.start_service(ldrb_uri, self)
@@ -51,7 +50,7 @@ class Cluster < N::Application
51
50
  end
52
51
 
53
52
  #
54
- #
53
+
55
54
  def join(sdrb_uri)
56
55
  @mon.synchronize {
57
56
  cluster[sdrb_uri] = DRbObject.new(nil, sdrb_uri)
@@ -61,7 +60,7 @@ class Cluster < N::Application
61
60
  alias_method :old_set, :[]=
62
61
 
63
62
  # Not really usefull
64
- #
63
+
65
64
  def []=(key, value)
66
65
  # store the value (useful on server restarts)
67
66
  @mon.synchronize {
@@ -110,10 +109,8 @@ class Cluster < N::Application
110
109
 
111
110
  end
112
111
 
113
- # = SHash ServerHash
114
- #
115
112
  # The SHash 'endpoint' resides in the App server
116
- #
113
+
117
114
  class SHash < Hash
118
115
  attr :mon
119
116
 
@@ -125,7 +122,7 @@ class Cluster < N::Application
125
122
 
126
123
  # ldrb = local drb uri
127
124
  # cdrb = cluster drb uri
128
- #
125
+
129
126
  def initialize(ldrb_uri = "druby://:9000", cdrb_uri = "druby://:8000")
130
127
  @mon = Monitor.new
131
128
  @ldrb_uri = ldrb_uri
@@ -171,8 +168,8 @@ class Cluster < N::Application
171
168
 
172
169
  end
173
170
 
174
- # = Clm Cluster Last Modified Hash
175
- #
171
+ # Cluster Last Modified Hash
172
+
176
173
  class Clm < CHash
177
174
  def [](key)
178
175
  @mon.synchronize {
@@ -187,7 +184,7 @@ class Cluster < N::Application
187
184
  end
188
185
 
189
186
  # = Slm Server Last Modified Hash
190
- #
187
+
191
188
  class Slm < SHash
192
189
  def set!(key, lm = nil)
193
190
  lm = Time.now.to_i unless lm
@@ -213,10 +210,9 @@ class Cluster < N::Application
213
210
 
214
211
  end
215
212
 
216
- end # module
213
+ end
217
214
 
218
215
  if $0 == __FILE__
219
- require "logger"; $log = Logger.new(STDERR)
220
-
216
+ require 'logger'
221
217
  N::Cluster.new.exec()
222
218
  end