about summary refs log tree commit homepage
path: root/lib/rainbows/fiber
DateCommit message (Collapse)
2011-05-10configurator: move validation logic over
There's actually no reason we can't have these methods in Rainbows::Configurator where it's easier to document nowadays.
2011-04-26doc: stop recommending Fiber* stuff
Too much NIH and too fragile.
2011-03-15fiber/io: fix broken call to Kgio.trywrite
Fortunately it's a deprecated class that nobody uses...
2011-03-10switch from IO#sendfile_nonblock to IO#trysendfile
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.
2011-02-06minimize &block usage for yield
No need to allocate a proc every time when we can just yield much more efficiently.
2011-02-06kill some unnecessary &block usage
We were needlessly allocating objects even when using yield.
2011-02-04bump required Unicorn dependency for Kgio
We want to use the singleton methods in Kgio to reduce conditionals.
2011-01-06eliminate G constant and just use the Rainbows! module
Code organization is hard :<
2011-01-04globally 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.
2011-01-04refactor response sendfile body handling for easier debugging
Unique method names makes it easier to follow code and determine where our methods come from.
2010-12-28complete Rev => Coolio renaming
We use Cool.io internally everywhere now, but preserve Rev-based models for anybody using them.
2010-12-28several response body#close fixes
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.
2010-12-27coolio*: favor Coolio over Rev
We still use and define Rev internally, but that's mostly just manual labor of converting stuff over.
2010-12-27coolio_fiber_spawn: decrease CPU usage for keepalive
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.
2010-12-27doc: misc cleanups and additions for RDoc
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.
2010-12-27initial cool.io support
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.
2010-12-27fiber/io: avoid allocating Range objects for slicing
It's slightly faster this way, but string slicing sucks anyways :<
2010-12-27fiber/*: more efficient keepalive_timeout expiry
We can use the same interface as Rainbows::Fiber.sleep to avoid blindly waking up readers at ever scheduler invocation.
2010-12-27fiber/base: use bare "select" where possible
Less visual noise
2010-12-26fiber/queue: unindent
This also cleans up some constant resolution for the root Fiber class.
2010-12-26remove unnecessary "::" constant prefixing
It's ugly to look at.
2010-11-19upgrade to Kgio 2.x and Unicorn 3.x
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.
2010-11-05avoid Errno::EAGAIN, harder
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.
2010-11-04avoid Kgio::WaitReadable/WaitWritable constants
The underlying symbolic names are easier to type and recommended.
2010-10-26doc: RDoc updates
Once again we avoid documenting internals on the public website and use code comments for other developers.
2010-10-22fiber_pool: no need for old Fiber::IO
Rainbows::Client takes care of the I/O wait/read-ability for us already.
2010-10-22code shuffling for kgio
Despite the large number of changes, most of it is code movement here.
2010-10-21unicorn 2.x updates + kgio
We get basic internal API changes from Unicorn, code simplifications coming next.
2010-09-28start using kgio library
It removes the burden of byte slicing and setting file descriptor flags. In some cases, we can remove unnecessary peeraddr calls, too.
2010-08-26split out accept() callers to acceptor module
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.
2010-07-29fiber/io: reuse buffer in Rainbows::Fiber::IO#each
This makes life easier for the lazy GC when proxying large responses (and also improves memory locality).
2010-07-23rename parse_range => make_range!
It's a destructive method, and it does more than just parsing.
2010-07-22enable Range: responses for static files for most models
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.
2010-07-19refactor response handling for each concurrency model
This will give each concurrency model more control over particular code paths and serving static files.
2010-07-10doc: avoid documenting internals on RDoc website
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.
2010-07-08restore Rainbows::HttpResponse.write for Cramp
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).
2010-07-06fix string slicing under 1.9 after short writes
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...
2010-07-06cleanup error handling for aborted downloads
We shouldn't ever spew errors to the stderr/logger on client disconnects (ECONNRESET/EPIPE/etc...).
2010-07-04refactor response body handling for sendfile(2)
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.
2010-06-28add preliminary sendfile (1.0.0) gem support
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.
2010-06-28fiber/base: reuse process_client logic in base
This fleshes out Rainbows::Fiber::IO with a few more methods for people using it.
2010-06-28(style) prefer "until" instead of "while !"
2010-06-28base: constant/namespace cleanup
2010-06-18fiber/{base,io}: use arrays instead of hashes for r/w accounting
This gives a tiny performance improvement to the FiberSpawn and FiberPool concurrency models.
2010-06-18fiber/base: more accurate sleep timeout
Not that many people will actually call Rainbows.sleep outside of tests...
2010-06-18prefer Array#[] lookup to Array#first/Array#last
Array#[] lookups are slightly faster under both rbx and 1.9, and easier to read.
2010-03-28cleanup: avoid redundant REMOTE_ADDR logic
Every concurrency model does this the same way. This removes the Rainbows::Const::LOCALHOST constant and may break some existing apps that rely on it.
2010-03-28fiber/base: do not modify hash during iteration (1.9.2dev)
It's generally dangerous to do so regardless of language and Ruby 1.9.2dev is stricter about this sort of behaviour.
2010-02-26avoid leaks if app uses Rainbows::Fiber::IO
For the very rare apps out there using Rainbows::Fiber::IO, the FiberSpawn and FiberPool (but not RevFiberSpawn) models could leak memory if the app-created Rainbows::Fiber::IO objects were dereferenced without being removed from the RD/WR hashes.
2010-02-11use Hash#compare_by_identity for performance
When available (Ruby 1.9), we can use Hash#compare_by_identity to improve performance.