rainbows 2.0.1 → 2.1.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.
- data/.document +1 -0
- data/.gitignore +1 -0
- data/.manifest +46 -18
- data/.wrongdoc.yml +8 -0
- data/ChangeLog +849 -374
- data/Documentation/comparison.haml +26 -21
- data/FAQ +6 -0
- data/GIT-VERSION-GEN +1 -1
- data/GNUmakefile +23 -65
- data/LATEST +27 -0
- data/NEWS +53 -26
- data/README +7 -7
- data/Rakefile +1 -98
- data/Summary +0 -7
- data/TODO +2 -2
- data/lib/rainbows/app_pool.rb +2 -1
- data/lib/rainbows/base.rb +1 -0
- data/lib/rainbows/configurator.rb +9 -0
- data/lib/rainbows/const.rb +1 -1
- data/lib/rainbows/coolio/client.rb +191 -0
- data/lib/rainbows/coolio/core.rb +25 -0
- data/lib/rainbows/{rev → coolio}/deferred_chunk_response.rb +3 -2
- data/lib/rainbows/{rev → coolio}/deferred_response.rb +3 -3
- data/lib/rainbows/coolio/heartbeat.rb +20 -0
- data/lib/rainbows/{rev → coolio}/master.rb +2 -3
- data/lib/rainbows/{rev → coolio}/sendfile.rb +1 -1
- data/lib/rainbows/coolio/server.rb +11 -0
- data/lib/rainbows/coolio/thread_client.rb +36 -0
- data/lib/rainbows/coolio.rb +45 -0
- data/lib/rainbows/coolio_fiber_spawn.rb +26 -0
- data/lib/rainbows/coolio_support.rb +9 -0
- data/lib/rainbows/coolio_thread_pool/client.rb +8 -0
- data/lib/rainbows/coolio_thread_pool/watcher.rb +14 -0
- data/lib/rainbows/coolio_thread_pool.rb +57 -0
- data/lib/rainbows/coolio_thread_spawn/client.rb +8 -0
- data/lib/rainbows/coolio_thread_spawn.rb +27 -0
- data/lib/rainbows/dev_fd_response.rb +6 -2
- data/lib/rainbows/ev_core/cap_input.rb +3 -2
- data/lib/rainbows/ev_core.rb +13 -3
- data/lib/rainbows/event_machine/client.rb +124 -0
- data/lib/rainbows/event_machine/response_pipe.rb +1 -2
- data/lib/rainbows/event_machine/server.rb +15 -0
- data/lib/rainbows/event_machine.rb +13 -137
- data/lib/rainbows/fiber/base.rb +6 -7
- data/lib/rainbows/fiber/body.rb +4 -2
- data/lib/rainbows/fiber/coolio/heartbeat.rb +15 -0
- data/lib/rainbows/fiber/{rev → coolio}/methods.rb +4 -5
- data/lib/rainbows/fiber/{rev → coolio}/server.rb +1 -1
- data/lib/rainbows/fiber/{rev → coolio}/sleeper.rb +2 -2
- data/lib/rainbows/fiber/coolio.rb +12 -0
- data/lib/rainbows/fiber/io/methods.rb +6 -0
- data/lib/rainbows/fiber/io.rb +8 -10
- data/lib/rainbows/fiber/queue.rb +24 -30
- data/lib/rainbows/fiber.rb +7 -4
- data/lib/rainbows/fiber_pool.rb +1 -1
- data/lib/rainbows/http_server.rb +9 -2
- data/lib/rainbows/max_body.rb +3 -1
- data/lib/rainbows/never_block/core.rb +15 -0
- data/lib/rainbows/never_block/event_machine.rb +8 -3
- data/lib/rainbows/never_block.rb +37 -70
- data/lib/rainbows/process_client.rb +3 -6
- data/lib/rainbows/rack_input.rb +17 -0
- data/lib/rainbows/response/body.rb +18 -19
- data/lib/rainbows/response.rb +1 -1
- data/lib/rainbows/rev.rb +21 -43
- data/lib/rainbows/rev_fiber_spawn.rb +4 -19
- data/lib/rainbows/rev_thread_pool.rb +21 -75
- data/lib/rainbows/rev_thread_spawn.rb +18 -36
- data/lib/rainbows/revactor/body.rb +4 -1
- data/lib/rainbows/revactor/tee_socket.rb +44 -0
- data/lib/rainbows/revactor.rb +13 -48
- data/lib/rainbows/socket_proxy.rb +24 -0
- data/lib/rainbows/sync_close.rb +37 -0
- data/lib/rainbows/thread_pool.rb +66 -70
- data/lib/rainbows/thread_spawn.rb +40 -50
- data/lib/rainbows/thread_timeout.rb +33 -27
- data/lib/rainbows/timed_read.rb +5 -1
- data/lib/rainbows/worker_yield.rb +16 -0
- data/lib/rainbows/writer_thread_pool/client.rb +19 -0
- data/lib/rainbows/writer_thread_pool.rb +60 -91
- data/lib/rainbows/writer_thread_spawn/client.rb +69 -0
- data/lib/rainbows/writer_thread_spawn.rb +37 -117
- data/lib/rainbows.rb +12 -4
- data/rainbows.gemspec +15 -19
- data/t/GNUmakefile +4 -4
- data/t/close-has-env.ru +65 -0
- data/t/simple-http_Coolio.ru +9 -0
- data/t/simple-http_CoolioFiberSpawn.ru +10 -0
- data/t/simple-http_CoolioThreadPool.ru +9 -0
- data/t/simple-http_CoolioThreadSpawn.ru +9 -0
- data/t/t0004-heartbeat-timeout.sh +2 -2
- data/t/t0007-worker-follows-master-to-death.sh +1 -1
- data/t/t0015-working_directory.sh +7 -1
- data/t/t0017-keepalive-timeout-zero.sh +1 -1
- data/t/t0019-keepalive-cpu-usage.sh +62 -0
- data/t/t0040-keepalive_requests-setting.sh +51 -0
- data/t/t0050-response-body-close-has-env.sh +109 -0
- data/t/t0102-rack-input-short.sh +6 -6
- data/t/t0106-rack-input-keepalive.sh +48 -2
- data/t/t0113-rewindable-input-false.sh +28 -0
- data/t/t0113.ru +12 -0
- data/t/t0114-rewindable-input-true.sh +28 -0
- data/t/t0114.ru +12 -0
- data/t/t9100-thread-timeout.sh +24 -2
- data/t/t9101-thread-timeout-threshold.sh +6 -13
- data/t/test-lib.sh +2 -1
- data/t/test_isolate.rb +9 -4
- data/t/times.ru +6 -0
- metadata +109 -42
- data/GIT-VERSION-FILE +0 -1
- data/lib/rainbows/fiber/rev/heartbeat.rb +0 -8
- data/lib/rainbows/fiber/rev/kato.rb +0 -22
- data/lib/rainbows/fiber/rev.rb +0 -13
- data/lib/rainbows/rev/client.rb +0 -194
- data/lib/rainbows/rev/core.rb +0 -41
- data/lib/rainbows/rev/heartbeat.rb +0 -23
- data/lib/rainbows/rev/thread.rb +0 -46
- data/man/man1/rainbows.1 +0 -193
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# -*- encoding: binary -*-
|
|
2
|
-
# :enddoc:
|
|
3
|
-
module Rainbows
|
|
4
|
-
module Rev
|
|
5
|
-
|
|
6
|
-
# This class handles the Unicorn fchmod heartbeat mechanism
|
|
7
|
-
# in Rev-based concurrency models to prevent the master
|
|
8
|
-
# process from killing us unless we're blocked. This class
|
|
9
|
-
# will also detect and execute the graceful exit if triggered
|
|
10
|
-
# by SIGQUIT
|
|
11
|
-
class Heartbeat < ::Rev::TimerWatcher
|
|
12
|
-
|
|
13
|
-
def on_timer
|
|
14
|
-
if (ot = G.kato) >= 0
|
|
15
|
-
ot = Time.now - ot
|
|
16
|
-
KATO.delete_if { |client, time| time < ot and client.timeout? }
|
|
17
|
-
end
|
|
18
|
-
exit if (! G.tick && CONN.size <= 0)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
data/lib/rainbows/rev/thread.rb
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# -*- encoding: binary -*-
|
|
2
|
-
# :enddoc:
|
|
3
|
-
require 'thread'
|
|
4
|
-
require 'rainbows/rev/master'
|
|
5
|
-
|
|
6
|
-
RUBY_VERSION =~ %r{\A1\.8} && Rev::VERSION < "0.3.2" and
|
|
7
|
-
warn "Rev (< 0.3.2) and Threads do not mix well under Ruby 1.8"
|
|
8
|
-
|
|
9
|
-
module Rainbows
|
|
10
|
-
module Rev
|
|
11
|
-
|
|
12
|
-
class ThreadClient < Client
|
|
13
|
-
|
|
14
|
-
def app_call
|
|
15
|
-
KATO.delete(self)
|
|
16
|
-
disable if enabled?
|
|
17
|
-
@env[RACK_INPUT] = @input
|
|
18
|
-
app_dispatch # must be implemented by subclass
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# this is only called in the master thread
|
|
22
|
-
def response_write(response)
|
|
23
|
-
alive = @hp.keepalive? && G.alive
|
|
24
|
-
rev_write_response(response, alive)
|
|
25
|
-
return quit unless alive && :close != @state
|
|
26
|
-
|
|
27
|
-
@hp.reset
|
|
28
|
-
@state = :headers
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# fails-safe application dispatch, we absolutely cannot
|
|
32
|
-
# afford to fail or raise an exception (killing the thread)
|
|
33
|
-
# here because that could cause a deadlock and we'd leak FDs
|
|
34
|
-
def app_response
|
|
35
|
-
begin
|
|
36
|
-
@env[REMOTE_ADDR] = @_io.kgio_addr
|
|
37
|
-
APP.call(@env.update(RACK_DEFAULTS))
|
|
38
|
-
rescue => e
|
|
39
|
-
Error.app(e) # we guarantee this does not raise
|
|
40
|
-
[ 500, {}, [] ]
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
data/man/man1/rainbows.1
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
.TH rainbows 1 "December 3, 2009" "Rainbows! User Manual"
|
|
2
|
-
.SH NAME
|
|
3
|
-
.PP
|
|
4
|
-
rainbows - rackup-like command to launch Rainbows!
|
|
5
|
-
.SH SYNOPSIS
|
|
6
|
-
.PP
|
|
7
|
-
rainbows [-c CONFIG_FILE] [-E RACK_ENV] [-D] [RACKUP_FILE]
|
|
8
|
-
.SH DESCRIPTION
|
|
9
|
-
.PP
|
|
10
|
-
A rackup(1)-like command to launch Rack applications using
|
|
11
|
-
Rainbows!.
|
|
12
|
-
It is expected to be started in your application root (APP_ROOT),
|
|
13
|
-
but the \[lq]working_directory\[rq] directive may be used in the
|
|
14
|
-
CONFIG_FILE.
|
|
15
|
-
.PP
|
|
16
|
-
While Rainbows! takes a myriad of command-line options for
|
|
17
|
-
compatibility with ruby(1) and rackup(1), it is recommended to
|
|
18
|
-
stick to the few command-line options specified in the SYNOPSIS and
|
|
19
|
-
use the CONFIG_FILE as much as possible.
|
|
20
|
-
.SH RACKUP FILE
|
|
21
|
-
.PP
|
|
22
|
-
This defaults to "config.ru" in APP_ROOT.
|
|
23
|
-
It should be the same file used by rackup(1) and other Rack
|
|
24
|
-
launchers, it uses the \f[I]Rack::Builder\f[] DSL.
|
|
25
|
-
.PP
|
|
26
|
-
Embedded command-line options are mostly parsed for compatibility
|
|
27
|
-
with rackup(1) but strongly discouraged.
|
|
28
|
-
.SH UNICORN OPTIONS
|
|
29
|
-
.TP
|
|
30
|
-
.B -c, --config-file CONFIG_FILE
|
|
31
|
-
Path to the Unicorn-specific config file.
|
|
32
|
-
The config file is implemented as a Ruby DSL, so Ruby code may
|
|
33
|
-
executed.
|
|
34
|
-
See the RDoc/ri for the \f[I]Unicorn::Configurator\f[] class for
|
|
35
|
-
the full list of directives available from the DSL.
|
|
36
|
-
.RS
|
|
37
|
-
.RE
|
|
38
|
-
.TP
|
|
39
|
-
.B -D, --daemonize
|
|
40
|
-
Run daemonized in the background.
|
|
41
|
-
The process is detached from the controlling terminal and stdin is
|
|
42
|
-
redirected to \[lq]/dev/null\[rq].
|
|
43
|
-
Unlike many common UNIX daemons, we do not chdir to "/" upon
|
|
44
|
-
daemonization to allow more control over the startup/upgrade
|
|
45
|
-
process.
|
|
46
|
-
Unless specified in the CONFIG_FILE, stderr and stdout will also be
|
|
47
|
-
redirected to \[lq]/dev/null\[rq].
|
|
48
|
-
.RS
|
|
49
|
-
.RE
|
|
50
|
-
.TP
|
|
51
|
-
.B -E, --env RACK_ENV
|
|
52
|
-
Run under the given RACK_ENV.
|
|
53
|
-
See the RACK ENVIRONMENT section for more details.
|
|
54
|
-
.RS
|
|
55
|
-
.RE
|
|
56
|
-
.TP
|
|
57
|
-
.B -l, --listen ADDRESS
|
|
58
|
-
Listens on a given ADDRESS.
|
|
59
|
-
ADDRESS may be in the form of HOST:PORT or PATH, HOST:PORT is taken
|
|
60
|
-
to mean a TCP socket and PATH is meant to be a path to a UNIX
|
|
61
|
-
domain socket.
|
|
62
|
-
Defaults to \[lq]0.0.0.0:8080\[rq] (all addresses on TCP port 8080)
|
|
63
|
-
For production deployments, specifying the \[lq]listen\[rq]
|
|
64
|
-
directive in CONFIG_FILE is recommended as it allows fine-tuning of
|
|
65
|
-
socket options.
|
|
66
|
-
.RS
|
|
67
|
-
.RE
|
|
68
|
-
.SH RACKUP COMPATIBILITY OPTIONS
|
|
69
|
-
.TP
|
|
70
|
-
.B -o, --host HOST
|
|
71
|
-
Listen on a TCP socket belonging to HOST, default is
|
|
72
|
-
\[lq]0.0.0.0\[rq] (all addresses).
|
|
73
|
-
If specified multiple times on the command-line, only the
|
|
74
|
-
last-specified value takes effect.
|
|
75
|
-
This option only exists for compatibility with the rackup(1)
|
|
76
|
-
command, use of \[lq]-l\[rq]/\[lq]--listen\[rq] switch is
|
|
77
|
-
recommended instead.
|
|
78
|
-
.RS
|
|
79
|
-
.RE
|
|
80
|
-
.TP
|
|
81
|
-
.B -p, --port PORT
|
|
82
|
-
Listen on the specified TCP PORT, default is 8080.
|
|
83
|
-
If specified multiple times on the command-line, only the
|
|
84
|
-
last-specified value takes effect.
|
|
85
|
-
This option only exists for compatibility with the rackup(1)
|
|
86
|
-
command, use of \[lq]-l\[rq]/\[lq]--listen\[rq] switch is
|
|
87
|
-
recommended instead.
|
|
88
|
-
.RS
|
|
89
|
-
.RE
|
|
90
|
-
.TP
|
|
91
|
-
.B -s, --server SERVER
|
|
92
|
-
No-op, this exists only for compatibility with rackup(1).
|
|
93
|
-
.RS
|
|
94
|
-
.RE
|
|
95
|
-
.SH RUBY OPTIONS
|
|
96
|
-
.TP
|
|
97
|
-
.B -e, --eval LINE
|
|
98
|
-
Evaluate a LINE of Ruby code.
|
|
99
|
-
This evaluation happens immediately as the command-line is being
|
|
100
|
-
parsed.
|
|
101
|
-
.RS
|
|
102
|
-
.RE
|
|
103
|
-
.TP
|
|
104
|
-
.B -d, --debug
|
|
105
|
-
Turn on debug mode, the $DEBUG variable is set to true.
|
|
106
|
-
.RS
|
|
107
|
-
.RE
|
|
108
|
-
.TP
|
|
109
|
-
.B -w, --warn
|
|
110
|
-
Turn on verbose warnings, the $VERBOSE variable is set to true.
|
|
111
|
-
.RS
|
|
112
|
-
.RE
|
|
113
|
-
.TP
|
|
114
|
-
.B -I, --include PATH
|
|
115
|
-
specify $LOAD_PATH.
|
|
116
|
-
PATH will be prepended to $LOAD_PATH.
|
|
117
|
-
The \[aq]:\[aq] character may be used to delimit multiple
|
|
118
|
-
directories.
|
|
119
|
-
This directive may be used more than once.
|
|
120
|
-
Modifications to $LOAD_PATH take place immediately and in the order
|
|
121
|
-
they were specified on the command-line.
|
|
122
|
-
.RS
|
|
123
|
-
.RE
|
|
124
|
-
.TP
|
|
125
|
-
.B -r, --require LIBRARY
|
|
126
|
-
require a specified LIBRARY before executing the application.
|
|
127
|
-
The "require" statement will be executed immediately and in the
|
|
128
|
-
order they were specified on the command-line.
|
|
129
|
-
.RS
|
|
130
|
-
.RE
|
|
131
|
-
.SH SIGNALS
|
|
132
|
-
.PP
|
|
133
|
-
The following UNIX signals may be sent to the master process:
|
|
134
|
-
.IP \[bu] 2
|
|
135
|
-
HUP - reload config file, app, and gracefully restart all workers
|
|
136
|
-
.IP \[bu] 2
|
|
137
|
-
INT/TERM - quick shutdown, kills all workers immediately
|
|
138
|
-
.IP \[bu] 2
|
|
139
|
-
QUIT - graceful shutdown, waits for workers to finish their current
|
|
140
|
-
request before finishing.
|
|
141
|
-
.IP \[bu] 2
|
|
142
|
-
USR1 - reopen all logs owned by the master and all workers See
|
|
143
|
-
Unicorn::Util.reopen_logs for what is considered a log.
|
|
144
|
-
.IP \[bu] 2
|
|
145
|
-
USR2 - reexecute the running binary.
|
|
146
|
-
A separate QUIT should be sent to the original process once the
|
|
147
|
-
child is verified to be up and running.
|
|
148
|
-
.IP \[bu] 2
|
|
149
|
-
WINCH - gracefully stops workers but keep the master running.
|
|
150
|
-
This will only work for daemonized processes.
|
|
151
|
-
.IP \[bu] 2
|
|
152
|
-
TTIN - increment the number of worker processes by one
|
|
153
|
-
.IP \[bu] 2
|
|
154
|
-
TTOU - decrement the number of worker processes by one
|
|
155
|
-
.PP
|
|
156
|
-
See the SIGNALS (http://rainbows.rubyforge.org/SIGNALS.html)
|
|
157
|
-
document for full description of all signals used by Rainbows!.
|
|
158
|
-
.SH RACK ENVIRONMENT
|
|
159
|
-
.PP
|
|
160
|
-
Accepted values of RACK_ENV and the middleware they automatically
|
|
161
|
-
load (outside of RACKUP_FILE) are exactly as those in rackup(1):
|
|
162
|
-
.IP \[bu] 2
|
|
163
|
-
development - loads Rack::CommonLogger, Rack::ShowExceptions, and
|
|
164
|
-
Rack::Lint middleware
|
|
165
|
-
.IP \[bu] 2
|
|
166
|
-
deployment - loads Rack::CommonLogger middleware
|
|
167
|
-
.IP \[bu] 2
|
|
168
|
-
none - loads no middleware at all, relying entirely on RACKUP_FILE
|
|
169
|
-
.PP
|
|
170
|
-
All unrecognized values for RACK_ENV are assumed to be
|
|
171
|
-
\[lq]none\[rq].
|
|
172
|
-
Production deployments are strongly encouraged to use
|
|
173
|
-
\[lq]deployment\[rq] or \[lq]none\[rq] for maximum performance.
|
|
174
|
-
.PP
|
|
175
|
-
Note that the Rack::ContentLength and Rack::Chunked middlewares are
|
|
176
|
-
never loaded by default.
|
|
177
|
-
If needed, they should be individually specified in the
|
|
178
|
-
RACKUP_FILE, some frameworks do not require them.
|
|
179
|
-
.SH SEE ALSO
|
|
180
|
-
.IP \[bu] 2
|
|
181
|
-
unicorn(1)
|
|
182
|
-
.IP \[bu] 2
|
|
183
|
-
\f[I]Rack::Builder\f[] ri/RDoc
|
|
184
|
-
.IP \[bu] 2
|
|
185
|
-
\f[I]Unicorn::Configurator\f[] ri/RDoc
|
|
186
|
-
.IP \[bu] 2
|
|
187
|
-
Rainbows! RDoc (http://rainbows.rubyforge.org/)
|
|
188
|
-
.IP \[bu] 2
|
|
189
|
-
Rack RDoc (http://rack.rubyforge.org/doc/)
|
|
190
|
-
.IP \[bu] 2
|
|
191
|
-
Rackup HowTo (http://wiki.github.com/rack/rack/tutorial-rackup-howto)
|
|
192
|
-
.SH AUTHOR
|
|
193
|
-
Rainbows! Hackers <rainbows-talk@rubyforge.org>
|