Release Name: 3.0.0
Notes:
Rainbows! is an HTTP server for sleepy Rack applications. It is based on
Unicorn, but designed to handle applications that expect long
request/response times and/or slow clients.
* http://rainbows.rubyforge.org/
* rainbows-talk@rubyforge.org
* git://git.bogomips.org/rainbows.git
Changes:
There is one incompatible change: We no longer assume application
authors are crazy and use strangely-cased headers for "Content-Length",
"Transfer-Encoding", and "Range". This allows us to avoid the
case-insensitivity of Rack::Utils::HeaderHash for a speed boost on the
few apps that already serve thousands of requests/second per-worker.
:Coolio got "async.callback" support like :EventMachine, but it
currently lacks EM::Deferrables which would allow us to call
"succeed"/"fail" callbacks. This means only one-shot response writes
are supported.
There are numerous internal code cleanups and several bugfixes for
handling partial static file responses.
Changes:
GIT-VERSION-GEN | 2 +-
GNUmakefile | 5 +-
Rakefile | 7 +-
lib/rainbows.rb | 126 +++++++------
lib/rainbows/base.rb | 16 +-
lib/rainbows/client.rb | 29 +++-
lib/rainbows/const.rb | 2 +-
lib/rainbows/coolio.rb | 9 +-
lib/rainbows/coolio/client.rb | 135 ++++++++------
lib/rainbows/coolio/core.rb | 5 +-
lib/rainbows/coolio/heartbeat.rb | 5 +-
lib/rainbows/coolio/master.rb | 5 +-
...ed_chunk_response.rb => response_chunk_pipe.rb} | 3 +-
.../{deferred_response.rb => response_pipe.rb} | 2 +-
lib/rainbows/coolio/sendfile.rb | 17 --
lib/rainbows/coolio/thread_client.rb | 10 +-
lib/rainbows/coolio_fiber_spawn.rb | 2 +-
lib/rainbows/coolio_thread_pool.rb | 2 +-
lib/rainbows/coolio_thread_pool/watcher.rb | 6 +-
lib/rainbows/coolio_thread_spawn.rb | 2 +-
lib/rainbows/dev_fd_response.rb | 4 +-
lib/rainbows/error.rb | 12 +-
lib/rainbows/ev_core.rb | 27 ++-
lib/rainbows/event_machine.rb | 11 +-
lib/rainbows/event_machine/client.rb | 99 +++++-----
lib/rainbows/event_machine/response_pipe.rb | 5 +-
lib/rainbows/fiber/base.rb | 10 +-
lib/rainbows/fiber/body.rb | 17 +--
lib/rainbows/fiber/coolio/heartbeat.rb | 4 +-
lib/rainbows/fiber/coolio/server.rb | 11 +-
lib/rainbows/fiber_pool.rb | 2 +-
lib/rainbows/fiber_spawn.rb | 4 +-
lib/rainbows/http_parser.rb | 12 ++
lib/rainbows/http_server.rb | 12 +-
lib/rainbows/max_body.rb | 4 +-
lib/rainbows/never_block/core.rb | 2 +-
lib/rainbows/process_client.rb | 44 ++---
lib/rainbows/queue_pool.rb | 4 +-
lib/rainbows/rack_input.rb | 6 +-
lib/rainbows/response.rb | 202 ++++++++++++++++----
lib/rainbows/response/body.rb | 127 ------------
lib/rainbows/response/range.rb | 34 ----
lib/rainbows/revactor.rb | 70 +-------
lib/rainbows/revactor/client.rb | 60 ++++++
.../revactor/{body.rb => client/methods.rb} | 28 ++--
lib/rainbows/revactor/{ => client}/tee_socket.rb | 2 +-
lib/rainbows/sendfile.rb | 3 +-
lib/rainbows/server_token.rb | 2 +-
lib/rainbows/thread_pool.rb | 18 +-
lib/rainbows/thread_spawn.rb | 13 +-
lib/rainbows/thread_timeout.rb | 2 +-
lib/rainbows/timed_read.rb | 28 ---
lib/rainbows/writer_thread_pool.rb | 34 +---
lib/rainbows/writer_thread_pool/client.rb | 45 +++++-
lib/rainbows/writer_thread_spawn.rb | 13 +-
lib/rainbows/writer_thread_spawn/client.rb | 66 +++++--
rainbows.gemspec | 15 +--
t/async_chunk_app.ru | 62 ++++++
t/byte-range-common.sh | 142 ++++++++++++++
t/t0022-copy_stream-byte-range.sh | 113 +-----------
t/t0023-sendfile-byte-range.sh | 34 +---
t/t0025-write-on-close.sh | 23 +++
t/t0040-keepalive_requests-setting.sh | 5 -
t/t0402-async-keepalive.sh | 146 ++++++++++++++
t/t0500-cramp-streaming.sh | 2 +
t/t0501-cramp-rainsocket.sh | 2 +
t/t9000-rack-app-pool.sh | 2 +-
t/test_isolate.rb | 15 +-
t/test_isolate_cramp.rb | 26 +++
t/write-on-close.ru | 11 +
70 files changed, 1149 insertions(+), 876 deletions(-)
commit 2eb58a62a5e738c287db8239f4f4e8d1d02ed328
Author: Eric Wong
Date: Tue Jan 11 16:43:10 2011 -0800
Rainbows! 3.0.0 - serving the fastest apps to slow clients faster!
There is one incompatible change: We no longer assume application
authors are crazy and use strangely-cased headers for "Content-Length",
"Transfer-Encoding", and "Range". This allows us to avoid the
case-insensitivity of Rack::Utils::HeaderHash for a speed boost on the
few apps that already serve thousands of requests/second per-worker.
:Coolio got "async.callback" support like :EventMachine, but it
currently lacks EM::Deferrables which would allow us to call
"succeed"/"fail" callbacks. This means only one-shot response writes
are supported.
There are numerous internal code cleanups and several bugfixes for
handling partial static file responses.
commit 9caff8ecc7912306366cebb9c57b65ab12fde5ad
Author: Eric Wong
Date: Tue Jan 11 16:36:08 2011 -0800
add write-on-close test from Unicorn
We need to ensure this esoteric feature keeps working for some
people.
commit 89f948aeaef34114ec61291ff8ffbebcf85a748e
Author: Eric Wong
Date: Tue Jan 11 16:01:20 2011 -0800
event_machine: buffer reads when waiting for async.callback
We cannot trigger on_read events and invoke the HTTP parser and
modify @env while we're waiting for an application to run
async.callback. We also need to clear (and *maybe* re-set)
@deferred if we're writing from async.callback
commit 0515dee246536cb3942f51f8d264737f106d3985
Author: Eric Wong
Date: Tue Jan 11 15:46:56 2011 -0800
event_machine/client: rename ivar for consistency with Coolio
Both use @deferred to refer to the state where there's a
deferred response body in the queue.
commit f9256a6897645e709753f37b723ed1c6388c0c84
Author: Eric Wong
Date: Tue Jan 11 15:44:57 2011 -0800
event_machine/client: remove unused :body accessor
Nobody uses it anymore
commit 69d8ec2f167eb99a1efec4a770ba5951e7c366f0
Author: Eric Wong
Date: Mon Jan 10 18:07:21 2011 -0800
coolio: enable async.callback for one-shot body responses
The lack of an equivlent to EM::Deferrable prevents us from
doing streaming/trickling responses, but a one-shot body
should work fine for Coolio and generating dynamic responses.
commit bf6eb8f1f79ed57ee317b2e6f73c70a59708739f
Author: Eric Wong
Date: Fri Jan 7 18:16:27 2011 -0800
rainbows/coolio/client: set LOOP constant in module
It's more natural and easier to maintain this way
since Coolio::Client is always lazy loaded.
commit 4747aa0d07950b9abbb036bc02491c4639dc9f80
Author: Eric Wong
Date: Fri Jan 7 17:10:46 2011 -0800
coolio/client: small optimizations
* lazy load uncommon classes: StreamFile, Response{Chunk,}Pipe
* remove needless rainbows/coolio/sendfile module since we're
lazily loaded now along with the rest of rainbows/coolio/client
and only in the worker.
commit 37ec9ef3272931f42b4b0bb3f04a3855a8702a05
Author: Eric Wong
Date: Fri Jan 7 18:06:54 2011 -0800
coolio_thread_*: lazy load Rainbows::Coolio::Client
We don't want that loaded in the parent process since
we want config reloadability.
commit f6d448bc21c3bde3ab39b55664722b40f5801c20
Author: Eric Wong
Date: Fri Jan 7 18:05:28 2011 -0800
redirect unexpected test output to /dev/null
We check the return code anyways, and spewing random binary
data to the terminal with verbosity on is not a good idea.
commit 25c9cf0d8420a971840297d9ca62e7dd9c05b09e
Author: Eric Wong
Date: Fri Jan 7 17:07:48 2011 -0800
event_machine: fold write_response back into client
No point in having too many modules to search around
(for both hackers and the runtime).
commit 7e4a7225dbd01df27a6b3ec44e53c013b889a724
Author: Eric Wong
Date: Fri Jan 7 16:12:26 2011 -0800
event_machine: cleanup async logic
Since we support keepalive now, setting @state can be
harmful and the comment is out-of-date.
commit 9d2fdee38f990e44b3a232c27f51287173e60e91
Author: Eric Wong
Date: Fri Jan 7 15:49:02 2011 -0800
ev_core: small organization cleanup
We want to put all constants in one place.
commit 63c32b35cccd5f2358565f828db240200e8bffa7
Author: Eric Wong
Date: Fri Jan 7 15:47:33 2011 -0800
more consistent use/avoidance of HeaderHash
Rack::Utils::HeaderHash is still expensive, so avoid
forcing it on users since we can assume app/library
authors use normally-cased HTTP headers.
commit 58dbf0952b94b01d4a434fa880755f9a320c6103
Author: Eric Wong
Date: Fri Jan 7 10:27:30 2011 -0800
favor Hash#include? for some existence checks
Hash#[] is slightly slower on the miss case due to calling
Hash#default (but faster for the hit case, probably because it
is inlined in 1.9).
commit 2d2416daa554dd530b5f2cfeffe3e0e31505c824
Author: Eric Wong
Date: Fri Jan 7 11:59:42 2011 -0800
test_isolate: bump versions and simplify
We can't possibly keep track of all sub-dependencies,
so only declare primary dependencies until we find
a known problem with a sub-dependency.
commit fbedef35186609f9e1cdedaa3a9d2a016423fe82
Author: Eric Wong
Date: Fri Jan 7 11:55:12 2011 -0800
test_isolate: prevent concurrent execution
I realize this lock overly covers different versions of
Ruby, but it's simple and we don't need to invoke isolate
too often (we hope).
commit efbdc44a5a301e5ea16d5135afaa9cda3a33f5d3
Author: Eric Wong
Date: Fri Jan 7 11:54:35 2011 -0800
tests: bump async_sinatra dependency to 0.4.0
It's out and it works, so why not.
commit f1893ae9786db250fd95def1cf958f2351cb84c5
Author: Eric Wong
Date: Fri Jan 7 11:47:05 2011 -0800
bump dependency on Rack to 1.2.1
We need to split out Cramp tests to Isolate to a
different path, which sucks, but oh well. Cramp
hasn't had a release in a while...
commit 360ba90a9a50b5aabd1c65d51034c7ebe77e36ef
Author: Eric Wong
Date: Fri Jan 7 10:20:24 2011 -0800
response: do not skip Status header set by app
Rack::Lint already stops apps from using it. If a developer
insists on it, then users who inspect their HTTP headers can
point and laugh at them for not using Rack::Lint!
commit c162bd4d620bc1421f104d9d0dfba21fb9b43068
Author: Eric Wong
Date: Fri Jan 7 10:10:20 2011 -0800
response: fix skipping of Status: header from app
We already set a Status: header by default for compatibility
with some existing, broken libraries out there.
commit b788a0f1eedfb358f9d57f40cec6ba0960dea3fe
Author: Eric Wong
Date: Fri Jan 7 10:02:52 2011 -0800
ev_core: garbage reduction with const strings
Reading headers is common and we don't want to create new String
objects (even if they're tiny or copy-on-write) for the GC to
munch on.
commit 370fb8c7811704ed65384f599b52ac1b6d0c36c9
Author: Eric Wong
Date: Wed Jan 5 18:01:36 2011 -0800
event_machine: refactor async.callback for keepalive
async.callback will be useful with Coolio (and more!) soon, so
ensure it works as well as the rest of Rainbows!
commit 2cb26ba8084cd37996330616b885de1c780d848e
Author: Eric Wong
Date: Wed Jan 5 17:39:11 2011 -0800
event_machine: factor out async.callback handling
This will allow Coolio to use it, too.
commit 31a93152c8977f31045bd182ae99df4ebd088abf
Author: Eric Wong
Date: Wed Jan 5 17:18:05 2011 -0800
minor cleanups following state cleanups
We noticed a few more things that could be cleaned
up after the last commit.
commit 6bde32081338ce8075854f4c47ce8ca5347df919
Author: Eric Wong
Date: Wed Jan 5 17:06:20 2011 -0800
eliminate G constant and just use the Rainbows! module
Code organization is hard :<
commit d6e4975937a9590f48dc39b1a4aefa9d62f34616
Author: Eric Wong
Date: Wed Jan 5 16:38:46 2011 -0800
rainbows.rb: unindent
commit ea6831e1eaeeb862afa7ed9213e2d9bc0180e706
Author: Eric Wong
Date: Wed Jan 5 16:33:04 2011 -0800
eliminate timed_read module
No need to split it out when there's only a single
class using it.
commit ed7669ced3aba5c0ba6f5fbee9411546b32c96df
Author: Eric Wong
Date: Wed Jan 5 16:29:53 2011 -0800
simplify keepalive_timeout accounting
Easier just to use an instance variable
commit 4060b7742d047c0000fd1bf4ac2c3b9cae95585a
Author: Eric Wong
Date: Wed Jan 5 16:19:17 2011 -0800
disable Nagle's algorithm by default
Nagle's algorithm is harmful with the write-write-read sequence
during keepalive, so we disable it performance for users using
keepalive. We always write headers with a separate write
because Rack response bodies may not always be ready for writing
when headers are.
This requires Unicorn 3.3.0
commit 9b6679ec50ecd184fccd195bd14bda3c6ea2070f
Author: Eric Wong
Date: Wed Jan 5 16:15:29 2011 -0800
simplify Rainbows.max_bytes implementation
Yes, I'm still learning Ruby.
commit 950b4ba1454543de492efffdf4022f481ca7e4c2
Author: Eric Wong
Date: Wed Jan 5 16:14:07 2011 -0800
response: use optimized httpdate implementation
Believe it or not, Time#httpdate showed up at the top
of my profiler output for the past couple of years now.
I guess that's what happens when all HTTP applications
I write are less complex than Rack::Lobster :P
commit 4768850390bb1d1e3c2e36273e9aad953e18de19
Author: Eric Wong
Date: Wed Jan 5 16:08:09 2011 -0800
Bump unicorn dependency to 3.3.0
This means we can remove Time.now.httpdate in the next commit
commit e8ae2e483e75ad163212cc8d3a7107eb2a014a9c
Author: Eric Wong
Date: Wed Jan 5 10:56:50 2011 -0800
response: allow normal Hash for crafting Range headers
HeaderHash is quite expensive, and Rack::File currently
uses a regular Ruby Hash with properly-cased headers the
same way they're presented in rfc2616.
commit 16b24c86cecec0697b35ac321cddd500bc9cfdea
Author: Eric Wong
Date: Wed Jan 5 10:54:45 2011 -0800
tests: ensure 416 responses do keepalive
This is useful for clients that specify a bad range,
we can preserve the connection for them to specify
a good response.
commit 89e1f00cd540bca54c2cbcb7d9b6cad5e0e3cf34
Author: Eric Wong
Date: Wed Jan 5 10:22:11 2011 -0800
send proper 416 responses
416 responses without a body should respond with a zero
Content-Length and a Content-Range that allows clients
to specify a proper range in the future.
rfc2616, section 14.16 says:
> A server sending a response with status code 416 (Requested
> range not satisfiable) SHOULD include a Content-Range field
> with a byte-range- resp-spec of "*". The instance-length
> specifies the current length of the selected resource.
commit 429e9948d91fa159c2daa9944a5026cebb78bade
Author: Eric Wong
Date: Tue Jan 4 18:13:45 2011 -0800
writer_thread_pool: remove unnecesary debug messages
Oops
commit 104f7bd76696e42c0b8a97f3780cabea9a7dd44c
Author: Eric Wong
Date: Tue Jan 4 17:12:22 2011 -0800
prefer Hash#merge! to Hash#update for consistency
It's more likely to be in the method cache since Rack::URLMap
uses it and also is more consistent when looking at profiling
output against various concurrency models.
commit e21939d776673b2f8887adf7a5c64812b7d2e98e
Author: Eric Wong
Date: Thu Dec 30 08:33:15 2010 +0000
globally refactor Range handling for responses
Rack::Utils::HeaderHash is still very expensive in Rack 1.2,
especially for simple things that we want to run as fast as
possible with minimal interference. HeaderHash is unnecessary
for most requests that do not send Content-Range in responses.
commit 4a76da1833922c74e147be5def9bfe04fd0c16a2
Author: Eric Wong
Date: Thu Dec 30 08:32:28 2010 +0000
coolio: rename deferred_response => response_pipe
For consistency with the EventMachine code
commit ed28feabd79697cb27722036622aeca1fbf0723d
Author: Eric Wong
Date: Thu Dec 30 08:32:27 2010 +0000
event_machine: cleanup response_pipe
No need to pass unnecessary variables to response_pipe,
just let the client handle it all.
commit c38bc88363d4c4f5f639540ca86f4dd1225df79e
Author: Eric Wong
Date: Thu Dec 30 08:32:26 2010 +0000
refactor response sendfile body handling for easier debugging
Unique method names makes it easier to follow code and determine
where our methods come from.
commit 1a03f9a525faf4c997546c419de6854223b645c4
Author: Eric Wong
Date: Thu Dec 30 08:32:25 2010 +0000
t9000: disable this test for CoolioThread* models
It's not appropriate to use AppPool middleware with
these. It was disabled for RevThread*, too.
commit 72a315441937f9e0531112f2b7080da39ca6064d
Author: Eric Wong
Date: Thu Dec 30 08:32:24 2010 +0000
simplify per-client keepalive state checks
This lets us simplify repetitive checks worry less about
properly maintaining/closing client connections for each
concurrency model we support.
commit 1f28534fce2b30bf3099ea0d014b62ac4a3205f0
Author: Eric Wong
Date: Thu Dec 30 08:32:23 2010 +0000
coolio/master: small garbage reduction
Creating unnecessary string objects for every response
is not a good idea.
commit a471d10cd793c4dc7182b4e588a21d6ac7c41de7
Author: Eric Wong
Date: Thu Dec 30 08:32:22 2010 +0000
return 206 status for partial sendfile responses
Although curl did not complain, 206 is the correct error
code for partial HTTP responses.
commit dc77752eb7bfe528c60dc0ac028717877342e22a
Author: Eric Wong
Date: Thu Dec 30 08:32:21 2010 +0000
coolio_thread_*: fix 416 response handling
After beefing up and enabling byte range tests for "sendfile"
(and no just IO.copy_stream), we noticed threaded-Coolio
variants did not handle invalid byte ranges correctly.
commit 5c5aea99a57d07c1d0e0ea471b62acf2852526c7
Author: Eric Wong
Date: Thu Dec 30 08:32:20 2010 +0000
t0022: fix up broken/incomplete tests
Tests for checking the Content-Range were totally broken,
but fortunately the code itself works.
commit 0e7d1a8b2923a20c452a300a48d25f7224b0b35b
Author: Eric Wong
Date: Tue Jan 4 16:18:46 2011 -0800
*gemspec: fix build, we have no unit tests
commit 558abace15eefb06163b741cc7090893d532fb1d
Author: Eric Wong
Date: Wed Dec 29 09:29:13 2010 +0000
Packaging cleanups, reinstate generated files for the tarball
commit 074b2ddc09517274b058a68fd1d40c59e35ca3a5
Author: Eric Wong
Date: Wed Dec 29 09:03:37 2010 +0000
Rakefile: fix fm_update task
Oops
commit e98836e165fa46b67fc57adc1ce59620f4f3fc4d
Author: Eric Wong
Date: Wed Dec 29 02:13:04 2010 +0000
Rainbows! 2.1.0 - Cool.io, bugfixes and more!
Cool.io (new version of Rev) support is explicitly added
(it always worked before). ":Coolio" may be used in place
of ":Rev" anywhere in your Rainbows! config file.
There is a new "keepalive_requests" config directive to limit
the number of requests a single connection may make (default:
100, same as nginx). This may be useful for better
load-balancing characteristics.
The old "Rev" prefixes remain supported as long as Cool.io
remains compatible with Rev (likely forever).
Bug fixes:
* Rainbows::ThreadTimeout middleware with multiple clients
* large, pipelined upload errors with Revactor+Coolio(Rev)
* high CPU usage for maintaining idle keepalive on *Fiber*
* needless ThreadPool wakeups
* request env prematurely cleared keepalive requests,
breaking some middlewares such as Clogger.
* "close" not called on body if wrapper and sendfile used together
Various code cleanups, and our RDoc website is JavaScript-free.
See the ChangeLog or git for all changes.
|