about summary refs log tree commit homepage
path: root/lib/rainbows.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-04 20:17:58 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-04 20:38:53 -0700
commite8eb252f64c94eb57532ef3de55d28e5d23e3cd8 (patch)
treecb7222112498789f2df7cd9f0cbc0ef7cf8a9466 /lib/rainbows.rb
parent9f11d1cec1975f4dcf35c68538243a44a629ed62 (diff)
downloadrainbows-e8eb252f64c94eb57532ef3de55d28e5d23e3cd8.tar.gz
Various concurrency models work and scale differently, pick
counts that make a reasonable amount of sense...
Diffstat (limited to 'lib/rainbows.rb')
-rw-r--r--lib/rainbows.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index b2c315d..04be9b4 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -13,14 +13,23 @@ module Rainbows
   require 'rainbows/http_response'
   require 'rainbows/base'
 
-  autoload :Revactor, 'rainbows/revactor'
-  autoload :ThreadPool, 'rainbows/thread_pool'
-  autoload :ThreadSpawn, 'rainbows/thread_spawn'
-
   class << self
     def run(app, options = {})
       HttpServer.new(app, options).start.join
     end
   end
 
+  # maps models to default worker counts, default worker count numbers are
+  # pretty arbitrary and tuning them to your application and hardware is
+  # highly recommended
+  MODEL_WORKER_CONNECTIONS = {
+    :Base => 1, # this one can't change
+    :Revactor => 50,
+    :ThreadSpawn => 30,
+    :ThreadPool => 10,
+  }.each do |model, _|
+    u = model.to_s.gsub(/([a-z0-9])([A-Z0-9])/) { "#{$1}_#{$2.downcase!}" }
+    autoload model, "rainbows/#{u.downcase!}"
+  end
+
 end