1 # -*- encoding: binary -*-
3 # This module adds \Rainbows! to the
4 # {Unicorn::Configurator}[http://unicorn.bogomips.org/Unicorn/Configurator.html]
5 module Rainbows::Configurator
7 # configures \Rainbows! with a given concurrency model to +use+ and
8 # a +worker_connections+ upper-bound. This method may be called
9 # inside a Unicorn/\Rainbows! configuration file:
12 # use :ThreadSpawn # concurrency model to use
13 # worker_connections 400
14 # keepalive_timeout 0 # zero disables keepalives entirely
15 # client_max_body_size 5*1024*1024 # 5 megabytes
18 # # the rest of the Unicorn configuration
21 # See the documentation for the respective Revactor, ThreadSpawn,
22 # and ThreadPool classes for descriptions and recommendations for
23 # each of them. The total number of clients we're able to serve is
24 # +worker_processes+ * +worker_connections+, so in the above example
25 # we can serve 8 * 400 = 3200 clients concurrently.
27 # The default is +keepalive_timeout+ is 5 seconds, which should be
28 # enough under most conditions for browsers to render the page and
29 # start retrieving extra elements for. Increasing this beyond 5
30 # seconds is not recommended. Zero disables keepalive entirely
31 # (but pipelining fully-formed requests is still works).
33 # The default +client_max_body_size+ is 1 megabyte (1024 * 1024 bytes),
34 # setting this to +nil+ will disable body size checks and allow any
35 # size to be specified.
37 block_given? or raise ArgumentError, "Rainbows! requires a block"
38 Rainbows::HttpServer.setup(block)
43 # inject the Rainbows! method into Unicorn::Configurator
44 Unicorn::Configurator.__send__(:include, Rainbows::Configurator)