Date | Commit message (Collapse) |
|
unicorn 5 will only support Ruby 1.9.3 and later, so remove
some checks for Hash#compare_by_identity and IO.copy_stream
which we know exist in Ruby 1.9.
Favor &:sym proc dispatch to avoid unnecessary captures and
bytecode size increases, too.
Finally, ensure we fail fast by converting some literal
hashes to use non-arrow syntax for symbolic keys.
|
|
The timeout (mis)feature in unicorn uses the monotonic clock
if available. We must follow suit to avoid having our timeout
functionality completely broken.
|
|
Also clarify the code while we're at it.
Thanks to Lin Jen-Shin for pointing this out.
ref: http://mid.gmane.org/CAA2_N1unOXb7Z4Jr8oKoSLu266O9Ko4o=oWzAcMA1w3=9X74KA@mail.gmail.com
|
|
Since kgio_wait_*able in kgio 2.5 takes an optional timeout
argument, we no longer have to load the extra "io/wait" module.
This saves us a small amount of some memory and also removes the
extra ioctl(FIONREAD) syscall IO#wait enforces.
Like IO#wait in Ruby 1.9.3dev, kgio_wait_readable may use
ppoll() to wait on high-numbered file descriptors as efficiently
as it waits on low-numbered descriptors.
|
|
Do not encourage their use, really.
|
|
There's actually no reason we can't have these methods
in Rainbows::Configurator where it's easier to document
nowadays.
|
|
Too much NIH and too fragile.
|
|
Fortunately it's a deprecated class that nobody
uses...
|
|
IO#trysendfile does not raise exceptions for common EAGAIN
errors, making it far less expensive to use with the following
concurrency models:
* Coolio
* CoolioFiberSpawn
* Revactor
* FiberSpawn
* FiberPool
This requires the new sendfile 1.1.0 RubyGem and removes support
for the sendfile 1.0.0. All sendfile users must upgrade or be
left without sendfile(2) support. IO#sendfile behaves the same
if you're using a multi-threaded concurrency option, but we
don't detect nor use it unless IO#trysendfile exists.
|
|
No need to allocate a proc every time when we can just
yield much more efficiently.
|
|
We were needlessly allocating objects even when using yield.
|
|
We want to use the singleton methods in Kgio to reduce
conditionals.
|
|
Code organization is hard :<
|
|
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.
|
|
Unique method names makes it easier to follow code and determine
where our methods come from.
|
|
We use Cool.io internally everywhere now, but preserve
Rev-based models for anybody using them.
|
|
Some middlewares require the Rack env to be preserved all
the way through to close, so we'll ensure all request models
preserve it.
We also need to better response body wrappers/proxies always get
fired properly when returning. IO.copy_stream and "sendfile"
gem users could hit cases where wrappers did not fire properly.
|
|
We still use and define Rev internally, but that's
mostly just manual labor of converting stuff over.
|
|
Blindly resuming fibers every second is a waste of cycles, we
can use the ZZ hash in regular FiberSpawn to resume expired
fibers on an as-needed basis.
While we're at it, merge the keepalive-timeout class into the
heartbeat, there's no reason to have separate timers and
classes here.
|
|
This is also our website, so we need to document the new
Cool.io-based concurrency options for users and point
existing Rev* users to it.
|
|
Cool.io is the new name for Rev. We'll continue to support Rev
until Cool.io breaks backwards compatibility. Rev may not be
supported if Cool.io is.
|
|
It's slightly faster this way, but string slicing sucks
anyways :<
|
|
We can use the same interface as Rainbows::Fiber.sleep to avoid
blindly waking up readers at ever scheduler invocation.
|
|
Less visual noise
|
|
This also cleans up some constant resolution for the root
Fiber class.
|
|
It's ugly to look at.
|
|
Kgio 2.0.0 has a superior API and less likely to conflict or
blow up with other applications. Unicorn 3.x requires Kgio 2.x,
too.
|
|
Errno::EAGAIN is still a problem under Ruby 1.9.2, so try harder
to avoid it and use kgio methods. Even when 1.9.3 is available,
kgio will still be faster as exceptions are slower than normal
return values.
|
|
The underlying symbolic names are easier to type and
recommended.
|
|
Once again we avoid documenting internals on the public
website and use code comments for other developers.
|
|
Rainbows::Client takes care of the I/O wait/read-ability
for us already.
|
|
Despite the large number of changes, most of it is code
movement here.
|
|
We get basic internal API changes from Unicorn,
code simplifications coming next.
|
|
It removes the burden of byte slicing and setting file
descriptor flags. In some cases, we can remove unnecessary
peeraddr calls, too.
|
|
Trying to avoid adding singleton methods since it's too easily
accessible by the public and not needed by the general public.
This also allows us (or just Zbatery) to more easily add support
systems without FD_CLOEXEC or fcntl, and also to optimize
away a fcntl call for systems that inherit FD_CLOEXEC.
|
|
This makes life easier for the lazy GC when proxying
large responses (and also improves memory locality).
|
|
It's a destructive method, and it does more than just parsing.
|
|
The FileStreamer class of EventMachine (and by extension
NeverBlock) unfortunately doesn't handle this. It's possible
to do with Revactor (since it uses Rev under the covers),
but we'll support what we can easily for now.
|
|
This will give each concurrency model more control over
particular code paths and serving static files.
|
|
Since we suck at building websites, we just rely on RDoc as a
website builder. And since Rainbows! is an application server
(and not a programming library), our internal API should be of
little interest to end users.
Anybody interested in Rainbows! (or any other project) internals
should be reading the source.
|
|
Cramp monkey patches Rainbows internals for WebSockets
support and we forgot about it. Add a new integration
test to ensure this continues to work in the future
(and force us to update the test for newer Cramp).
|
|
Fortunately this only affects the hardly-used FiberSpawn and
FiberPool concurrency models, and also unreleased revisions of
Rev. 1.9 encoding is tricky to handle right when doing I/O in
Ruby...
|
|
We shouldn't ever spew errors to the stderr/logger
on client disconnects (ECONNRESET/EPIPE/etc...).
|
|
This hopefully allows the "sendfile" gem to be required
anywhere in the Rainbows!/Unicorn config file, and not
have to be required via RUBYOPT or the '-r' command-line
switch.
We also modularize HttpResponse and avoids singleton methods
in the response path. This (hopefully) makes it easier for
individual concurrency models to share code and override
individual methods.
|
|
This still needs work and lots of cleanup, but the basics are
there. The sendfile 1.0.0 RubyGem is now safe to use under MRI
1.8, and is superior to current (1.9.2-preview3) versions of
IO.copy_stream for static files in that it supports more
platforms and doesn't truncate large files on 32-bit platforms.
|
|
This fleshes out Rainbows::Fiber::IO with a few
more methods for people using it.
|
|
|
|
|
|
This gives a tiny performance improvement to the FiberSpawn and
FiberPool concurrency models.
|
|
Not that many people will actually call Rainbows.sleep
outside of tests...
|