writer_thread_pool: fix include ordering issues under 1.8
[rainbows.git] / FAQ
blobffe03a6ae191a4512e46f73431f850c8e0d62dd0
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!
23 === What happened to the "gossamer" branch of Unicorn?
25 It became the ThreadPool model of \Rainbows!
28 === Which concurrency model should I use?
30 It depends on your application, libraries, Ruby stack and use cases.
31 That's why we support as many concurrency model as we can.  Each model
32 has their own strengths and weaknesses in terms of maturity,
33 ease-of-debugging, compatibility, performance, and memory usage.
36 === Should I put \Rainbows! behind nginx to serve slow clients?
38 It is optional.  You can still use nginx to route certain requests to
39 Unicorn and others to \Rainbows!  nginx will always outperform
40 \Rainbows! in both pure reverse proxy applications and for serving
41 static files,  but \Rainbows! is for hosting applications that are more
42 easily-implemented in Ruby than C.
45 === Should I use \Rainbows! to serve static files?
47 It depends on the size and amount of static files you're serving.  If
48 you're serving a lot of static files (especially large ones), then by
49 all means use nginx.  If not, then \Rainbows! is likely a "good enough"
50 solution even if nginx will always outperform it in raw throughput.
53 === How do I support SSL?
55 If you need a streaming "rack.input" to do upload processing within your
56 Rack application, then {stunnel}[http://stunnel.org/] is required.
57 Otherwise, nginx is a perfectly good reverse proxy.
59 Refer to the {Unicorn FAQ}[http://unicorn.bogomips.org/FAQ.html] on how
60 to ensure redirects go to "https://" URLs.
63 === Is there a "rainbows_rails" command like there is "unicorn_rails"?
65 No.
67 "unicorn_rails" was written primarily to support older versions of
68 Rails.  Since \Rainbows! is designed for newer applications based on
69 Rack, it can just use a "config.ru" file like other Rack frameworks and
70 applications.
72 For Rails 3.x, you should already have a config.ru file and
73 "rainbows(1)" will work out-of-the-box like "rackup(1)".  Rails 3
74 will support RACK_ENV as set by "rainbows(1)", so you won't need
75 to set RAILS_ENV.
77 For Rails 2.3.x, the following config.ru will work for you:
79   ENV["RAILS_ENV"] ||= ENV["RACK_ENV"]
80   require "config/environment"
81   use Rails::Rack::Static
82   run ActionController::Dispatcher.new
84 For older versions of Rails, the following config.ru will work:
86   ENV["RAILS_ENV"] ||= ENV["RACK_ENV"]
87   require 'config/boot'
88   require 'config/environment'
89   require 'unicorn/app/old_rails'
90   require 'unicorn/app/old_rails/static' # not needed with Unicorn 0.95+
91   use Unicorn::App::OldRails::Static
92   run Unicorn::App::OldRails.new
94 One thing to watch out for is that RAILS_ENV will not be set in the
95 environment for you, thus we set it to match RACK_ENV.