about summary refs log tree commit homepage
path: root/lib/rainbows.rb
DateCommit message (Collapse)
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-08-19add Rainbows::ThreadTimeout middleware
This allows for per-dispatch timeouts similar to (but not exactly) the way Mongrel (1.1.x) implemented them with threads.
2010-08-17avoid EBADF with certain middlewares when proxying
First off we use an FD_MAP to avoid creating redundant IO objects which map to the same FD. When that doesn't work, we'll fall back to trapping Errno::EBADF and IOError where appropriate.
2010-08-03doc: hide internal Response416 error constant
It's an internal implementation detail and not for user consumption.
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-20rely on autoload for Base and TeeInput
Its conceivable that we can avoid loading TeeInput for EventMachine and Rev concurrency models in the future since it's unused there.
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-08bump TCP_DEFER_ACCEPT default value
Unicorn 1.1.0 lets us change this default, and we need it higher to avoid wasting workers against stupidly (or maliciously) slow clients.
2010-07-08stream_file: split this out from rev/sendfile
Other concurrency models will eventually be able to use it, too.
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-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-21add Rainbows::Configurator module
Make it easier to link to the Rainbows! configuration documentation without anchors. This also reduces the amount of code we spew into Unicorn::Configurator.
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-06-06centralize body => IO conversion logic
Since EventMachine and Rev shared the same logic for optimizing and avoiding extra file opens for IO/File-ish response bodies, so centralize that. For Ruby 1.9 users, we've also enabled this logic so ThreadPool, ThreadSpawn, WriterThreadPool, and WriterThreadSpawn can take advantage of Rainbows::DevFdResponse-generated bodies while proxying sockets.
2010-06-03add Rainbows::Sendfile middleware
This lets most concurrency models understand and process X-Sendfile efficiently with IO.copy_stream under Ruby 1.9. EventMachine can take advantage of this middleware under both Ruby 1.8 and Ruby 1.9.
2010-05-26writer_thread_spawn: worker_connections limits thread spawned
This should be logical, since we keep the connection alive when writing in our writer threads.
2010-05-26add WriterThreadSpawn concurrency model
2010-05-17WriterThreadPool: default concurrency to 20 pools
Idle threads are cheap enough and having responses queued up with a single slow client on a large response is bad.
2010-05-14add WriterThreadPool concurrency model
This is based on an idea I originally had for Unicorn but never implemented in Unicorn since the benefits were unproven and the risks were too high.
2010-05-14add Rainbows::QueuePool helper
It'll be useful later on for a variety of things!
2010-05-04drop EventMachineDefer concurrency model
Since we have conditional deferred execution in the regular EventMachine concurrency model, we can drop this one. This concurrency model never fully worked due to lack of graceful shut downs, and was never promoted nor supported, either.
2010-05-03doc: misc updates
* avoid needless links to /Rainbows.html * keepalive_timeout has been 5 seconds by default for a while * update "Gemcutter" references to "RubyGems.org"
2010-05-03cleanup request size limiting for TeeInput users
WAvoid mucking with Unicorn::TeeInput, since other apps may depend on that class, so we subclass it as Rainbows::TeeInput and modify as necessary in worker processes. For Revactor, remove the special-cased Rainbows::Revactor::TeeInput class and instead emulate readpartial for Revactor sockets instead.
2010-05-03add client_max_body_size config directive
Since Rainbows! is supported when exposed directly to the Internet, administrators may want to limit the amount of data a user may upload in a single request body to prevent a denial-of-service via disk space exhaustion. This amount may be specified in bytes, the default limit being 1024*1024 bytes (1 megabyte). To override this default, a user may specify `client_max_body_size' in the Rainbows! block of their server config file: Rainbows! do client_max_body_size 10 * 1024 * 1024 end Clients that exceed the limit will get a "413 Request Entity Too Large" response if the request body is too large and the connection will close. For chunked requests, we have no choice but to interrupt during the client upload since we have no prior knowledge of the request body size.
2010-04-02use duck typing for REMOTE_ADDR detection
This gives us the option to use non-TCPSocket-derived IO-ish objects in the future, whatever that may be...
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-02-27keepalive_timeout defaults to 5 seconds
The previous 2 second default was not enough for folks on slow connections where our OS socket buffers would've masked the time it took to write out larger responses. ref: <20100219220904.GA11377@dcvr.yhbt.net>
2010-02-27don't bother supporting platforms without FD_CLOEXEC
No point in having extra code around for platforms we don't care about.
2009-12-29quiet spurious wakeups for accept() in Thread* models
Under all MRI 1.8, a blocking Socket#accept Ruby method (needs to[1]) translate to a non-blocking accept(2) system call that may wake up threads/processes unnecessarily. Unfortunately, we failed to trap and ignore EAGAIN in those cases. This issue did not affect Ruby 1.9 running under modern Linux kernels where a _blocking_ accept(2) system call is not (easily, at least) susceptible to spurious wakeups. Non-Linux systems running Ruby 1.9 may be affected. [1] - using a blocking accept(2) on a shared socket with green threads is dangerous, as noted in commit ee7fe220ccbc991e1e7cbe982caf48e3303274c7 (and commit 451ca6997b4f298b436605b7f0af75f369320425)
2009-12-22common Rainbows.sleep(nr) method
We'll export this across the board to all Rack applications to sleep with. This provides the optimum method of sleeping regardless of the concurrency model you choose. This method is still highly not recommended for pure event-driven models like Rev or EventMachine (but the threaded/fiber/actor-based variants are fine).
2009-12-22cleanup in Rainbows.accept definition
2009-12-22new RevFiberSpawn concurrency model
This is like the traditional FiberSpawn, but more scalable (but not necessarily faster) as it can use epoll or kqueue.
2009-12-08EventMachineDefer: preliminary (and) broken version
There's a good chunk of tests that fail with this, still. Worse, I haven't been able to figure out what's wrong since it looks like it would involve looking at C++ code...
2009-12-05larger thread pool default sizes ({Rev,}ThreadPool)
This matches what EM sets for its built-in thread pool
2009-12-02add RevThreadPool concurrency model
This should be like RevThreadSpawn except with more predictable performance (but higher memory usage under low load).
2009-12-01more consistent code for worker timeout/exits
We now correctly exit!(2) if our master can't kill us.
2009-11-29preliminary NeverBlock support with EventMachine
2009-11-29Allow options to be added to "use"
Eventually we hope to be able to accept arguments like the way Rack handlers do it: use :Foo, :bool1, :bool2, :option => value
2009-11-28always set FD_CLOEXEC if available
Some people fork processes, so it avoid hanging a connection open because of that...
2009-11-28common Rainbows.accept method
2009-11-27preliminary ActorSpawn model for Rubinius
It seems to basically work, this is based heavily on the Revactor one...
2009-11-26cleanup and refactor error handling
Make sure app errors get logged correctly, and we no longer return a 500 response when a client EOFs the write end (but not the read end) of a connection.
2009-11-25AppPool middleware now compatible with Fibers
This enables the safe use of Rainbows::AppPool with all concurrency models, not just threaded ones. AppPool is now effective with *all* Fiber-based concurrency models including Revactor (and of course the new Fiber{Pool,Spawn} ones).
2009-11-25add FiberPool concurrency model
This is another Fiber-based concurrency model that can exploit a streaming "rack.input" for clients. Spawning Fibers seems pretty fast, but maybe there are apps that will benefit from this.
2009-11-25add FiberSpawn concurrency model
This one seems a easy to get working and supports everything we need to support from the server perspective. Apps will need modified drivers, but it doesn't seem too hard to add more/better support for wrapping IO objects with Fiber::IO.
2009-11-24fix grammar fail in RDoc
2009-11-18make keepalive_timeout configurable
And change the default to 2 seconds, most clients can render the page and load all URLs within 2 seconds.
2009-11-08initial cut of the RevThreadSpawn model
Seems to pass all tests, but that may only mean our test cases are lacking...
2009-11-06cleanup worker heartbeat and master deathwatch
It turns out neither the EventMachine and Rev classes checked for master death in its heartbeat mechanism. Since we managed to forget the same thing twice, we now have a test case for it and also centralized the code to remove duplication.