rainbows 3.2.0 → 3.3.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 (70) hide show
  1. data/.document +1 -0
  2. data/COPYING +617 -282
  3. data/Documentation/comparison.haml +81 -24
  4. data/FAQ +3 -0
  5. data/GIT-VERSION-GEN +1 -1
  6. data/LICENSE +14 -5
  7. data/README +10 -9
  8. data/Sandbox +25 -0
  9. data/TODO +2 -22
  10. data/lib/rainbows.rb +50 -49
  11. data/lib/rainbows/client.rb +6 -5
  12. data/lib/rainbows/configurator.rb +191 -37
  13. data/lib/rainbows/const.rb +1 -1
  14. data/lib/rainbows/coolio.rb +4 -1
  15. data/lib/rainbows/coolio/client.rb +2 -2
  16. data/lib/rainbows/coolio/heartbeat.rb +2 -1
  17. data/lib/rainbows/coolio_fiber_spawn.rb +12 -7
  18. data/lib/rainbows/coolio_thread_pool.rb +19 -10
  19. data/lib/rainbows/coolio_thread_spawn.rb +3 -0
  20. data/lib/rainbows/epoll.rb +27 -5
  21. data/lib/rainbows/epoll/client.rb +3 -3
  22. data/lib/rainbows/ev_core.rb +2 -1
  23. data/lib/rainbows/event_machine.rb +4 -0
  24. data/lib/rainbows/event_machine/client.rb +2 -1
  25. data/lib/rainbows/fiber.rb +5 -0
  26. data/lib/rainbows/fiber/base.rb +1 -0
  27. data/lib/rainbows/fiber/coolio/methods.rb +0 -1
  28. data/lib/rainbows/fiber/io.rb +10 -6
  29. data/lib/rainbows/fiber/io/pipe.rb +6 -1
  30. data/lib/rainbows/fiber/io/socket.rb +6 -1
  31. data/lib/rainbows/fiber_pool.rb +12 -7
  32. data/lib/rainbows/fiber_spawn.rb +11 -6
  33. data/lib/rainbows/http_server.rb +55 -59
  34. data/lib/rainbows/join_threads.rb +4 -0
  35. data/lib/rainbows/max_body.rb +29 -10
  36. data/lib/rainbows/never_block.rb +7 -10
  37. data/lib/rainbows/pool_size.rb +14 -0
  38. data/lib/rainbows/process_client.rb +23 -1
  39. data/lib/rainbows/queue_pool.rb +8 -6
  40. data/lib/rainbows/response.rb +12 -11
  41. data/lib/rainbows/revactor.rb +14 -7
  42. data/lib/rainbows/revactor/client.rb +2 -2
  43. data/lib/rainbows/stream_file.rb +11 -4
  44. data/lib/rainbows/thread_pool.rb +12 -28
  45. data/lib/rainbows/thread_spawn.rb +14 -13
  46. data/lib/rainbows/thread_timeout.rb +118 -30
  47. data/lib/rainbows/writer_thread_pool/client.rb +1 -1
  48. data/lib/rainbows/writer_thread_spawn/client.rb +2 -2
  49. data/lib/rainbows/xepoll.rb +13 -5
  50. data/lib/rainbows/xepoll/client.rb +19 -17
  51. data/lib/rainbows/xepoll_thread_pool.rb +82 -0
  52. data/lib/rainbows/xepoll_thread_pool/client.rb +129 -0
  53. data/lib/rainbows/xepoll_thread_spawn.rb +58 -0
  54. data/lib/rainbows/xepoll_thread_spawn/client.rb +121 -0
  55. data/pkg.mk +4 -0
  56. data/rainbows.gemspec +4 -1
  57. data/t/GNUmakefile +5 -1
  58. data/t/client_header_buffer_size.ru +5 -0
  59. data/t/simple-http_XEpollThreadPool.ru +10 -0
  60. data/t/simple-http_XEpollThreadSpawn.ru +10 -0
  61. data/t/t0022-copy_stream-byte-range.sh +1 -15
  62. data/t/t0026-splice-copy_stream-byte-range.sh +25 -0
  63. data/t/t0027-nil-copy_stream.sh +60 -0
  64. data/t/t0041-optional-pool-size.sh +2 -2
  65. data/t/t0042-client_header_buffer_size.sh +65 -0
  66. data/t/t9100-thread-timeout.sh +1 -6
  67. data/t/t9101-thread-timeout-threshold.sh +1 -6
  68. data/t/test-lib.sh +58 -0
  69. data/t/test_isolate.rb +9 -3
  70. metadata +47 -16
@@ -33,7 +33,7 @@
33
33
  %td.r18 Yes
34
34
  %td.r19 Yes
35
35
  %td.rbx Yes
36
- %td.slow OK
36
+ %td.slow Yes
37
37
  %tr.comp_row
38
38
  %td.mod Coolio
39
39
  %td.tee No
@@ -47,7 +47,7 @@
47
47
  %td.r18 Yes
48
48
  %td.r19 Yes
49
49
  %td.rbx Yes
50
- %td.slow OK
50
+ %td.slow Yes
51
51
  %tr.comp_row
52
52
  %td.mod EventMachine
53
53
  %td.tee No
@@ -118,6 +118,34 @@
118
118
  %td.r19 Yes
119
119
  %td.rbx Yes
120
120
  %td.slow no
121
+ %tr.comp_row
122
+ %td.mod Epoll
123
+ %td.tee no
124
+ %td.r18 Yes
125
+ %td.r19 Yes
126
+ %td.rbx Yes
127
+ %td.slow Yes
128
+ %tr.comp_row
129
+ %td.mod XEpoll
130
+ %td.tee no
131
+ %td.r18 Yes
132
+ %td.r19 Yes
133
+ %td.rbx Yes
134
+ %td.slow Yes
135
+ %tr.comp_row
136
+ %td.mod XEpollThreadSpawn
137
+ %td.tee Yes
138
+ %td.r18 Yes
139
+ %td.r19 Yes
140
+ %td.rbx Yes
141
+ %td.slow Yes
142
+ %tr.comp_row
143
+ %td.mod XEpollThreadPool
144
+ %td.tee Yes
145
+ %td.r18 Yes
146
+ %td.r19 Yes
147
+ %td.rbx Yes
148
+ %td.slow Yes
121
149
  %ul
122
150
  %li
123
151
  Cool.io should also work with Rubinius (though we haven't had time to test).
@@ -232,6 +260,26 @@
232
260
  %td.slowio avoid
233
261
  %td.thr Maybe
234
262
  %td.reent Maybe
263
+ %tr.comp_base
264
+ %td.mod Epoll
265
+ %td.slowio No
266
+ %td.thr No
267
+ %td.reent No
268
+ %tr.comp_base
269
+ %td.mod XEpoll
270
+ %td.slowio No
271
+ %td.thr No
272
+ %td.reent No
273
+ %tr.comp_base
274
+ %td.mod XEpollThreadSpawn
275
+ %td.slowio thread-safe Ruby
276
+ %td.thr Yes
277
+ %td.reent No
278
+ %tr.comp_base
279
+ %td.mod XEpollThreadPool
280
+ %td.slowio thread-safe Ruby
281
+ %td.thr Yes
282
+ %td.reent No
235
283
  %ul
236
284
  %li
237
285
  Requirements for single thread reentrancy are loose in that there is
@@ -264,91 +312,78 @@
264
312
  %th.lock
265
313
  %a(href="http://rack.rubyforge.org/doc/Rack/Lock.html") Rack::Lock
266
314
  %th.async async
267
- %th.ws Web Sockets
268
315
  %tr.comp_row
269
316
  %td.mod Unicorn/Base
270
317
  %td.devfd no-op
271
318
  %td.app_pool no-op
272
319
  %td.lock no-op
273
320
  %td.async lots of RAM :P
274
- %td.ws no
275
321
  %tr.comp_row
276
322
  %td.mod Revactor
277
323
  %td.devfd no-op
278
324
  %td.app_pool Yes
279
325
  %td.lock No!
280
326
  %td.async Revactor itself
281
- %td.ws no
282
327
  %tr.comp_row
283
328
  %td.mod ThreadPool
284
329
  %td.devfd Yes
285
330
  %td.app_pool Yes
286
331
  %td.lock Yes
287
- %td.async standard Ruby
288
- %td.ws no
332
+ %td.async thread-safe Ruby
289
333
  %tr.comp_row
290
334
  %td.mod Coolio
291
335
  %td.devfd Yes
292
336
  %td.app_pool no-op
293
337
  %td.lock no-op
294
338
  %td.async DevFdResponse
295
- %td.ws no
296
339
  %tr.comp_row
297
340
  %td.mod ThreadSpawn
298
341
  %td.devfd Yes
299
342
  %td.app_pool Yes
300
343
  %td.lock Yes
301
- %td.async standard Ruby
302
- %td.ws no
344
+ %td.async thread-safe Ruby
303
345
  %tr.comp_row
304
346
  %td.mod EventMachine
305
347
  %td.devfd Yes
306
348
  %td.app_pool no-op
307
349
  %td.lock no-op
308
350
  %td.async async_sinatra, Cramp, rack-fiber_pool
309
- %td.ws no
310
351
  %tr.comp_row
311
352
  %td.mod CoolioThreadSpawn
312
353
  %td.devfd Yes
313
354
  %td.app_pool Yes
314
355
  %td.lock Dumb
315
- %td.async standard Ruby
316
- %td.ws no
356
+ %td.async thread-safe Ruby
317
357
  %tr.comp_row
318
358
  %td.mod FiberSpawn
319
359
  %td.devfd Yes
320
360
  %td.app_pool Yes
321
361
  %td.lock No!
322
362
  %td.async Rainbows::Fiber::IO, Rainbows.sleep
323
- %td.ws no
324
363
  %tr.comp_row
325
364
  %td.mod FiberPool
326
365
  %td.devfd Yes
327
366
  %td.app_pool Yes
328
367
  %td.lock No!
329
368
  %td.async Rainbows::Fiber::IO, Rainbows.sleep
330
- %td.ws no
331
369
  %tr.comp_row
332
370
  %td.mod ActorSpawn
333
371
  %td.devfd no-op
334
372
  %td.app_pool Yes
335
373
  %td.lock Yes
336
- %td.async standard Ruby
337
- %td.ws no
374
+ %td.async thread-safe Ruby
338
375
  %tr.comp_row
339
376
  %td.mod NeverBlock
340
377
  %td.devfd Yes
341
378
  %td.app_pool Yes*
342
379
  %td.lock Yes*
343
380
  %td.async NeverBlock, async_sinatra
344
- %td.ws no
345
381
  %tr.comp_row
346
382
  %td.mod CoolioThreadPool
347
383
  %td.devfd Yes
348
384
  %td.app_pool Yes
349
385
  %td.lock Dumb
350
- %td.async Coolio, standard Ruby
351
- %td.ws no
386
+ %td.async Coolio, thread-safe Ruby
352
387
  %tr.comp_row
353
388
  %td.mod CoolioFiberSpawn
354
389
  %td.devfd Yes
@@ -360,15 +395,37 @@
360
395
  %td.devfd Yes
361
396
  %td.app_pool no-op
362
397
  %td.lock no-op
363
- %td.async Standard Ruby in response body only
364
- %td.ws response body only
398
+ %td.async thread-safe Ruby in response body only
365
399
  %tr.comp_row
366
400
  %td.mod WriterThreadSpawn
367
401
  %td.devfd Yes
368
402
  %td.app_pool no-op
369
403
  %td.lock no-op
370
- %td.async Standard Ruby in response body only
371
- %td.ws response body only
404
+ %td.async thread-safe Ruby in response body only
405
+ %tr.comp_row
406
+ %td.mod Epoll
407
+ %td.devfd Yes
408
+ %td.app_pool no-op
409
+ %td.lock no-op
410
+ %td.async DevFdResponse
411
+ %tr.comp_row
412
+ %td.mod XEpoll
413
+ %td.devfd Yes
414
+ %td.app_pool no-op
415
+ %td.lock no-op
416
+ %td.async DevFdResponse
417
+ %tr.comp_row
418
+ %td.mod XEpollThreadPool
419
+ %td.devfd Yes
420
+ %td.app_pool Yes
421
+ %td.lock Yes
422
+ %td.async thread-safe Ruby
423
+ %tr.comp_row
424
+ %td.mod XEpollThreadSpawn
425
+ %td.devfd Yes
426
+ %td.app_pool Yes
427
+ %td.lock Yes
428
+ %td.async thread-safe Ruby
372
429
  %ul
373
430
  %li
374
431
  "No!" means it's fundamentally incompatible, use an
data/FAQ CHANGED
@@ -18,6 +18,9 @@ requests we service.
18
18
  === Isn't "rainbows" a branch of Unicorn?
19
19
 
20
20
  That functionality is now in the Revactor model of \Rainbows!
21
+ However, \Revactor is not recommended since it is dormant
22
+ upstream and requires your application (and all its libraries)
23
+ to cooperate with \Revactor for concurrency.
21
24
 
22
25
 
23
26
  === What happened to the "gossamer" branch of Unicorn?
data/GIT-VERSION-GEN CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v3.2.0.GIT
4
+ DEF_VER=v3.3.0.GIT
5
5
 
6
6
  LF='
7
7
  '
data/LICENSE CHANGED
@@ -1,8 +1,17 @@
1
- \Rainbows! is copyrighted Free Software by all contributors, see the
2
- logs in revision control for all of them. You can redistribute it
3
- and/or modify it under either the terms of the
4
- {GPL2}[http://www.gnu.org/licenses/gpl-2.0.txt] (see link:COPYING) or
5
- the conditions below:
1
+ \Rainbows! is copyrighted Free Software by all contributors, see the logs in
2
+ revision control for names and email addresses of all of them.
3
+
4
+ You can redistribute it and/or modify it under either the terms of the
5
+ GNU General Public License (GPL) as published by the Free Software
6
+ Foundation (FSF), version {3.0}[http://www.gnu.org/licenses/gpl-3.0.txt]
7
+ or version {2.0}[http://www.gnu.org/licenses/gpl-2.0.txt]
8
+ or the Ruby-specific license terms (see below).
9
+
10
+ The \Rainbows! project leader (Eric Wong) reserves the right to add future
11
+ versions of the GPL (and no other licenses) as published by the FSF to
12
+ the licensing terms.
13
+
14
+ === Ruby-specific terms (if you're not using the GPLv2/GPLv3)
6
15
 
7
16
  1. You may make and give away verbatim copies of the source form of the
8
17
  software without restriction, provided that you duplicate all of the
data/README CHANGED
@@ -22,18 +22,22 @@ suck; differently.
22
22
  For network concurrency, models we currently support are:
23
23
 
24
24
  * {Coolio}[link:Rainbows/Coolio.html]
25
+ * {CoolioFiberSpawn}[link:Rainbows/CoolioFiberSpawn.html]
26
+ * {CoolioThreadPool}[link:Rainbows/CoolioThreadPool.html]
27
+ * {CoolioThreadSpawn}[link:Rainbows/CoolioThreadSpawn.html]
28
+ * {Epoll}[link:Rainbows/Epoll.html]
25
29
  * {EventMachine}[link:Rainbows/EventMachine.html]
26
- * {FiberSpawn}[link:Rainbows/FiberSpawn.html]
27
30
  * {FiberPool}[link:Rainbows/FiberPool.html]
31
+ * {FiberSpawn}[link:Rainbows/FiberSpawn.html]
28
32
  * {NeverBlock}[link:Rainbows/NeverBlock.html]
29
33
  * {Revactor}[link:Rainbows/Revactor.html]
30
34
  * {ThreadPool}[link:Rainbows/ThreadPool.html]
31
35
  * {ThreadSpawn}[link:Rainbows/ThreadSpawn.html]
32
36
  * {WriterThreadPool}[link:Rainbows/WriterThreadPool.html]
33
37
  * {WriterThreadSpawn}[link:Rainbows/WriterThreadSpawn.html]
34
- * {CoolioFiberSpawn}[link:Rainbows/CoolioFiberSpawn.html]
35
- * {CoolioThreadPool}[link:Rainbows/CoolioThreadPool.html]
36
- * {CoolioThreadSpawn}[link:Rainbows/CoolioThreadSpawn.html]
38
+ * {XEpoll}[link:Rainbows/XEpoll.html]
39
+ * {XEpollThreadPool}[link:Rainbows/XEpollThreadPool.html]
40
+ * {XEpollThreadSpawn}[link:Rainbows/XEpollThreadSpawn.html]
37
41
 
38
42
  We have {many more on the way}[link:TODO.html] for handling network
39
43
  concurrency. Additionally, we also use multiple processes (managed by
@@ -86,11 +90,8 @@ fast applications.
86
90
  == License
87
91
 
88
92
  \Rainbows! is copyright 2009,2010 by all contributors (see logs in git).
89
- It is based on Mongrel 1.1.5 and Unicorn and carries the same license.
90
-
91
- Mongrel is copyright 2007 Zed A. Shaw and contributors. It is licensed
92
- under the Ruby (1.8) license and the GPL2. See the included LICENSE file for
93
- details.
93
+ \Rainbows! is licensed under the Ruby (1.8) license or the GPL (v2 or v3).
94
+ See the included {LICENSE}[link:LICENSE.html] file for more details.
94
95
 
95
96
  \Rainbows! is 100% Free Software.
96
97
 
data/Sandbox ADDED
@@ -0,0 +1,25 @@
1
+ = Tips for using \Rainbows! with Sandbox installation tools
2
+
3
+ Most {tips for Unicorn}[http://unicorn.bogomips.org/Sandbox.html]
4
+ for Bundler and Isolate apply to \Rainbows! as well.
5
+
6
+ == TLDR (Bundler)
7
+
8
+ You need to add "rainbows" to your Gemfile for Bundler and start
9
+ \Rainbows! with:
10
+
11
+ bundle exec rainbows ...
12
+
13
+ == TLDR (Isolate)
14
+
15
+ Isolate "rainbows" and execute the "rainbows" launcher in your isolated
16
+ GEM_PATH:
17
+
18
+ $APP_ROOT/tmp/ruby-1.9/bin/rainbows ...
19
+
20
+ == Explanation
21
+
22
+ Due to the variety of potential dependencies, \Rainbows! lazy loads many
23
+ of its internals, often after the application itself is loaded. This
24
+ results in more potential to interact badly with sandbox tools that
25
+ modify the gem environment.
data/TODO CHANGED
@@ -3,35 +3,15 @@
3
3
  We're lazy and pick the easy items to do first, then the ones people
4
4
  care about.
5
5
 
6
- * documentation improvements
6
+ * investigate non-Rack frameworks (e.g. Goliath)
7
7
 
8
- * Split out NeverBlock into NeverBlockEventMachine and NeverBlockReactor
9
- NeverBlock will default to one of them (depending on NB upstream).
8
+ * documentation improvements
10
9
 
11
10
  * allow _OPTIONAL_ splice(2) with DevFdResponse under Linux
12
11
  (splice is very broken under some older kernels)
13
12
 
14
- * use IO#trysendfile for EventMachine/NeverBlock
15
-
16
- * Open file cache Rack app/middleware (idea from nginx), since sendfile
17
- (and IO.copy_stream) allows pread(2)-style offsets
18
-
19
13
  * Improve test suite coverage. We won't waste cycles with puny
20
14
  unit tests, only integration tests that exercise externally
21
15
  visible parts.
22
16
 
23
- * EventMachine+Fibers+streaming input
24
- (those who do not require streaming input can use
25
- {rack-fiber_pool}[http://github.com/mperham/rack-fiber_pool])
26
-
27
- * CoolioFiberPool
28
-
29
- * ThreadPoolRevFiber{Spawn,Pool}: just because
30
-
31
- * Coolio + callcc - current Coolio model with callcc (should work with MBARI)
32
-
33
- * Omnibus - haven't looked into it, probably like Revactor with 1.8?
34
-
35
- * Packet - pure Ruby, EventMachine-like library
36
-
37
17
  * test and improve performance (throughput/latency/memory usage)
data/lib/rainbows.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # -*- encoding: binary -*-
2
2
  require 'kgio'
3
3
  require 'unicorn'
4
+ require 'io/wait'
4
5
  Unicorn::SocketHelper::DEFAULTS.merge!({
5
6
  # the value passed to TCP_DEFER_ACCEPT actually matters in Linux 2.6.32+
6
7
  :tcp_defer_accept => 60,
@@ -15,17 +16,16 @@ Unicorn::SocketHelper::DEFAULTS.merge!({
15
16
  :tcp_nopush => false,
16
17
  })
17
18
 
19
+ # See http://rainbows.rubyforge.org/ for documentation
18
20
  module Rainbows
19
-
20
- O = {} # :nodoc:
21
+ # :stopdoc:
22
+ O = {}
21
23
 
22
24
  # map of numeric file descriptors to IO objects to avoid using IO.new
23
25
  # and potentially causing race conditions when using /dev/fd/
24
26
  FD_MAP = {}
25
27
  FD_MAP.compare_by_identity if FD_MAP.respond_to?(:compare_by_identity)
26
28
 
27
- # :startdoc:
28
-
29
29
  require 'rainbows/const'
30
30
  require 'rainbows/http_parser'
31
31
  require 'rainbows/http_server'
@@ -41,23 +41,25 @@ module Rainbows
41
41
  autoload :EvCore, 'rainbows/ev_core'
42
42
  autoload :SocketProxy, 'rainbows/socket_proxy'
43
43
 
44
+ # :startdoc:
44
45
  # Sleeps the current application dispatch. This will pick the
45
46
  # optimal method to sleep depending on the concurrency model chosen
46
47
  # (which may still suck and block the entire process). Using this
47
48
  # with the basic :Coolio or :EventMachine models is not recommended.
48
49
  # This should be used within your Rack application.
49
- def self.sleep(nr)
50
+ def self.sleep(seconds)
50
51
  case Rainbows.server.use
51
52
  when :FiberPool, :FiberSpawn
52
- Rainbows::Fiber.sleep(nr)
53
+ Rainbows::Fiber.sleep(seconds)
53
54
  when :RevFiberSpawn, :CoolioFiberSpawn
54
- Rainbows::Fiber::Coolio::Sleeper.new(nr)
55
+ Rainbows::Fiber::Coolio::Sleeper.new(seconds)
55
56
  when :Revactor
56
- Actor.sleep(nr)
57
+ Actor.sleep(seconds)
57
58
  else
58
- Kernel.sleep(nr)
59
+ Kernel.sleep(seconds)
59
60
  end
60
61
  end
62
+ # :stopdoc:
61
63
 
62
64
  # runs the Rainbows! HttpServer with +app+ and +options+ and does
63
65
  # not return until the server has exited.
@@ -65,27 +67,30 @@ module Rainbows
65
67
  HttpServer.new(app, options).start.join
66
68
  end
67
69
 
68
- # :stopdoc:
69
70
  class << self
70
- attr_accessor :max_bytes, :keepalive_timeout
71
71
  attr_accessor :server
72
72
  attr_accessor :cur # may not always be used
73
73
  attr_reader :alive
74
74
  attr_writer :tick_io
75
+ attr_writer :forked
75
76
  end
76
- # :startdoc:
77
-
78
- # the default max body size is 1 megabyte (1024 * 1024 bytes)
79
- @max_bytes = 1024 * 1024
80
77
 
81
- # the default keepalive_timeout is 5 seconds
82
- @keepalive_timeout = 5
78
+ def self.config!(mod, *opts)
79
+ @forked or abort "#{mod} should only be loaded in a worker process"
80
+ opts.each do |opt|
81
+ mod.const_set(opt.to_s.upcase, Rainbows.server.__send__(opt))
82
+ end
83
+ end
83
84
 
84
- # :stopdoc:
85
85
  @alive = true
86
86
  @cur = 0
87
87
  @tick_mod = 0
88
88
  @expire = nil
89
+ @at_quit = []
90
+
91
+ def self.at_quit(&block)
92
+ @at_quit << block
93
+ end
89
94
 
90
95
  def self.tick
91
96
  @tick_io.chmod(@tick_mod = 0 == @tick_mod ? 1 : 0)
@@ -102,41 +107,36 @@ module Rainbows
102
107
  @alive = false
103
108
  Rainbows::HttpParser.quit
104
109
  @expire = Time.now + (@server.timeout * 2.0)
105
- @server.class.const_get(:LISTENERS).map! { |s| s.close rescue nil }.clear
110
+ Unicorn::HttpServer::LISTENERS.each { |s| s.close rescue nil }.clear
111
+ @at_quit.each { |task| task.call }
106
112
  end
107
113
  false
108
114
  end
109
115
 
110
- # maps models to default worker counts, default worker count numbers are
111
- # pretty arbitrary and tuning them to your application and hardware is
112
- # highly recommended
113
- MODEL_WORKER_CONNECTIONS = {
114
- :Base => 1, # this one can't change
115
- :WriterThreadPool => 20,
116
- :WriterThreadSpawn => 20,
117
- :Revactor => 50,
118
- :ThreadSpawn => 30,
119
- :ThreadPool => 20,
120
- :Rev => 50,
121
- :RevThreadSpawn => 50,
122
- :RevThreadPool => 50,
123
- :RevFiberSpawn => 50,
124
- :Coolio => 50,
125
- :CoolioThreadSpawn => 50,
126
- :CoolioThreadPool => 50,
127
- :CoolioFiberSpawn => 50,
128
- :Epoll => 50,
129
- :XEpoll => 50,
130
- :EventMachine => 50,
131
- :FiberSpawn => 50,
132
- :FiberPool => 50,
133
- :ActorSpawn => 50,
134
- :NeverBlock => 50,
135
- }.each do |model, _|
136
- u = model.to_s.gsub(/([a-z0-9])([A-Z0-9])/) { "#{$1}_#{$2.downcase!}" }
137
- autoload model, "rainbows/#{u.downcase!}"
138
- end
139
- # :startdoc:
116
+ autoload :Base, "rainbows/base"
117
+ autoload :WriterThreadPool, "rainbows/writer_thread_pool"
118
+ autoload :WriterThreadSpawn, "rainbows/writer_thread_spawn"
119
+ autoload :Revactor, "rainbows/revactor"
120
+ autoload :ThreadSpawn, "rainbows/thread_spawn"
121
+ autoload :ThreadPool, "rainbows/thread_pool"
122
+ autoload :Rev, "rainbows/rev"
123
+ autoload :RevThreadSpawn, "rainbows/rev_thread_spawn"
124
+ autoload :RevThreadPool, "rainbows/rev_thread_pool"
125
+ autoload :RevFiberSpawn, "rainbows/rev_fiber_spawn"
126
+ autoload :Coolio, "rainbows/coolio"
127
+ autoload :CoolioThreadSpawn, "rainbows/coolio_thread_spawn"
128
+ autoload :CoolioThreadPool, "rainbows/coolio_thread_pool"
129
+ autoload :CoolioFiberSpawn, "rainbows/coolio_fiber_spawn"
130
+ autoload :Epoll, "rainbows/epoll"
131
+ autoload :XEpoll, "rainbows/xepoll"
132
+ autoload :EventMachine, "rainbows/event_machine"
133
+ autoload :FiberSpawn, "rainbows/fiber_spawn"
134
+ autoload :FiberPool, "rainbows/fiber_pool"
135
+ autoload :ActorSpawn, "rainbows/actor_spawn"
136
+ autoload :NeverBlock, "rainbows/never_block"
137
+ autoload :XEpollThreadSpawn, "rainbows/xepoll_thread_spawn"
138
+ autoload :XEpollThreadPool, "rainbows/xepoll_thread_pool"
139
+
140
140
  autoload :Fiber, 'rainbows/fiber' # core class
141
141
  autoload :StreamFile, 'rainbows/stream_file'
142
142
  autoload :HttpResponse, 'rainbows/http_response' # deprecated
@@ -145,6 +145,7 @@ module Rainbows
145
145
  autoload :SyncClose, 'rainbows/sync_close'
146
146
  autoload :ReverseProxy, 'rainbows/reverse_proxy'
147
147
  autoload :JoinThreads, 'rainbows/join_threads'
148
+ autoload :PoolSize, 'rainbows/pool_size'
148
149
  end
149
150
 
150
151
  require 'rainbows/error'