epoll/*: remove user-space array as active queue
[rainbows.git] / FAQ
blobcea032b0746bf7fa4da42214daa515c04c5005b1
1 = Frequently Asked Questions about \Rainbows!
3 === Why is \Rainbows! a separate project from Unicorn?
5 \Rainbows! is for the odd, corner-case requests that Unicorn is poorly
6 suited for.  More scalable concurrency models introduce additional
7 complexity that Unicorn users and developers are uncomfortable with for
8 the common cases.
11 === What complexity?  Threads/events/actors are easy to work with!
13 Good for you.  Some of us depend on libraries incompatible with those
14 models, or are just too lazy to deal with them for the majority of
15 requests we service.
18 === Isn't "rainbows" a branch of Unicorn?
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.
26 === What happened to the "gossamer" branch of Unicorn?
28 It became the ThreadPool model of \Rainbows!
31 === Which concurrency model should I use?
33 It depends on your application, libraries, Ruby stack and use cases.
34 That's why we support as many concurrency model as we can.  Each model
35 has their own strengths and weaknesses in terms of maturity,
36 ease-of-debugging, compatibility, performance, and memory usage.
39 === Should I put \Rainbows! behind nginx to serve slow clients?
41 It is optional.  You can still use nginx to route certain requests to
42 Unicorn and others to \Rainbows!  nginx will always outperform
43 \Rainbows! in both pure reverse proxy applications and for serving
44 static files,  but \Rainbows! is for hosting applications that are more
45 easily-implemented in Ruby than C.
48 === Should I use \Rainbows! to serve static files?
50 It depends on the size and amount of static files you're serving.  If
51 you're serving a lot of static files (especially large ones), then by
52 all means use nginx.  If not, then \Rainbows! is likely a "good enough"
53 solution even if nginx will always outperform it in raw throughput.
56 === How do I support SSL?
58 If you need streaming "rack.input" to do on-the-fly upload processing
59 within your Rack application, then using an SSL proxy such as
60 {Pound}[http://www.apsis.ch/pound/] or {Stunnel}[http://stunnel.org/] is
61 required.  Pound has built-in X-Forwarded-For support while Stunnel
62 requires a extra {patch}[http://haproxy.1wt.eu/download/patches/].
64 If you don't need streaming "rack.input", then nginx is a great HTTPS
65 reverse proxy.
67 Refer to the {Unicorn FAQ}[http://unicorn.bogomips.org/FAQ.html] on how
68 to ensure redirects go to "https://" URLs.
71 === Is there a "rainbows_rails" command like there is "unicorn_rails"?
73 No.
75 "unicorn_rails" was written primarily to support older versions of
76 Rails.  Since \Rainbows! is designed for newer applications based on
77 Rack, it can just use a "config.ru" file like other Rack frameworks and
78 applications.
80 For Rails 3.x, you should already have a config.ru file and
81 "rainbows(1)" will work out-of-the-box like "rackup(1)".  Rails 3
82 will support RACK_ENV as set by "rainbows(1)", so you won't need
83 to set RAILS_ENV.
85 For Rails 2.3.x, the following config.ru will work for you:
87   ENV["RAILS_ENV"] ||= ENV["RACK_ENV"]
88   require "#{::File.expand_path('config/environment')}"
89   use Rails::Rack::Static
90   run ActionController::Dispatcher.new
92 For older versions of Rails, the following config.ru will work:
94   ENV["RAILS_ENV"] ||= ENV["RACK_ENV"]
95   require "#{::File.expand_path('config/boot')}"
96   require "#{::File.expand_path('config/environment')}"
97   require 'unicorn/app/old_rails'
98   require 'unicorn/app/old_rails/static' # not needed with Unicorn 0.95+
99   use Unicorn::App::OldRails::Static
100   run Unicorn::App::OldRails.new
102 One thing to watch out for is that RAILS_ENV will not be set in the
103 environment for you, thus we set it to match RACK_ENV.
105 === I'm using threads and Rails is misbehaving!
107 If you use any of the threaded concurrency models, you will need to use
108 {config.threadsafe!}[http://m.onkey.org/thread-safety-for-your-rails]
109 in your config/environments/$RAILS_ENV.rb