about summary refs log tree commit homepage
path: root/lib/rainbows/http_server.rb
DateCommit message (Collapse)
2019-01-02quiet mismatched indentation warnings
Ruby trunk started warning about more mismatched indentations starting around r62836.
2015-11-21tiny bytecode reductions for cold paths
Less code in cold paths can improve speed for hot paths. Single-byte strings for String#split is optimized in mainline Ruby, so it's not actually a performance loss for sendfile_range in response.rb Regexps are at least 400 bytes each, so prefer non-Regexps if possible, especially for cold sites where performance does not matter.
2015-11-21http_server: add master_pid attribute
We'll need this for unicorn 5, as they dropped this publically accessible attribute while retaining the ivar. Eventually we may not have to check this attribute at all, instead detecting parent death via worker pipe.
2015-11-18http_parser: handle keepalive_requests internally
unicorn 5 dropped support for this, essentially allowing unlimited persistent connections if we used the parser as-is. Since most of our concurrency models cannot handle infinite persistent connections without being vulnerable to DoS, we must support keepalive_requests like nginx does.
2011-10-12http_server: fix log message if using Base (no concurrency)
Telling the user worker_connections=50 when using the Base concurrency model is misleading.
2011-06-29Revert "http_server: cap timeout at 32-bit LONG_MAX seconds"
Unicorn (> 4.0.1) already handles this for us, not that it affects many people... This reverts commit 37c376a9253ed62d134cbb4dbc6eaecc6076c77e.
2011-06-27http_server: cap timeout at 32-bit LONG_MAX seconds
We can't wait for longer than 68 years.
2011-06-11configurator: add client_max_header_size directive
Lowering this will lower worst-case memory usage and mitigate some denial-of-service attacks. This should be larger than client_header_buffer_size. The default value is carried over from Mongrel and Unicorn.
2011-06-09move reopen_worker_logs to base
We may not always use Rainbows! :Base since we don't want keepalive/immediate log reopening in some cases.
2011-05-16use :pool_size for RLIMIT_NPROC with thread pool models
Only needed for Ruby 1.9
2011-05-16add "copy_stream" config directive
This allows using IO::Splice.copy_stream from the "io_splice" RubyGem on recent Linux systems. This also allows users to disable copy_stream usage entirely and use traditional response_body.each calls which are compatible with all Rack servers (to workaround bugs in IO.copy_stream under 1.9.2-p180).
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-05-05http_server: XEpollThreadSpawn sets RLIMIT_NPROC
It *can* have as many threads as it does idle connections.
2011-05-03Rainbows! defaults more DRY
We won't forget to reset defaults on SIGHUP anymore.
2011-05-03s/max_bytes/client_max_body_size/ for consistency
Too confusing otherwise...
2011-05-03add client_header_buffer_size tuning parameter
We're changing our default to 1K buffers to save memory. This should reduce memory usage of idle clients and lower pressure on the MRI GC. Rails applications using session cookies (the default) may want to up this to 2K or more.
2011-05-02http_server: default all options to 50 connections
pavinging the way for changing MODEL_WORKER_CONNECTIONS
2011-04-21increase RLIMIT_NPROC for thread-crazy folks
Might as well, threads are free and cheap on 64-bit
2011-04-21http_server: attempt to increase RLIMIT_NOFILE
In case people try to do C10K, make life easier for them.
2011-04-19http_server: less hacky loading of concurrency model
Ugh the old way was gross.
2011-03-20fix various warnings with "check-warnings" target
Run under 1.9.3dev
2011-02-07fix optional "use" argument handling
Actually use the Rainbows::O constant for use [ew: rewritten commit message subject] Acked-by: Eric Wong <normalperson@yhbt.net>
2011-02-05http_server: kill a warning
Ugh, I need to think of a way to clean this up...
2011-02-04rename XAcceptEpoll to XEpoll
It's too long especially since XEpollThreadPool is planned :>
2011-01-24initial XAcceptEpoll concurrency model
Edge-triggered epoll concurrency model with blocking accept() in a (hopefully) native thread. This is recommended over Epoll for Ruby 1.9 users as it can workaround accept()-scalability issues on multicore machines.
2011-01-19initial edge-triggered epoll model
Coolio and EventMachine only use level-triggered epoll, but being Rainbows!, we live on the EDGE!
2011-01-06eliminate G constant and just use the Rainbows! module
Code organization is hard :<
2011-01-06simplify keepalive_timeout accounting
Easier just to use an instance variable
2010-12-28enable the keepalive_requests config option
This will allow servers to limit the number of keepalive requests that can be made over a single connection to prevent denial-of-service and also to improve fairness in load-balancing.
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-10-28HUP reload restores defaults on unset settings
For consistency, changed settings are reset back to their default values if they are removed or commented out from the config file.
2010-10-22unindent most files
This simplifies and disambiguates most constant resolution issues as well as lowering our identation level. Hopefully this makes code easier to understand.
2010-10-21unicorn 2.x updates + kgio
We get basic internal API changes from Unicorn, code simplifications coming next.
2010-10-21http_server: more descriptive error for debugging
Sometimes we have stupid syntax or constant resolution errors in our code.
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-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-09http_server: use super instead of alias_method
duh!
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-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-02rainbows/http_*: remove unnecessary circular requires
http_response and http_server are never NOT loaded when "rainbows" is required.
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-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-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-15Revert "Threaded models have trouble with late loading under 1.9"
This reverts commit e1dcadef6ca242e36e99aab19e3e040bf01070f9. This is fixed separately in Unicorn 0.95.0 (commit 560216c2fecfc5cf3489f749dc7a0221fd78eb26)
2009-11-13gracefully exit workers if reopening logs fails
Permissions for the logs could've been badly set by the master. So we we'll let the master reopen them and refork children to get around this problem. We have to be more careful when reopening logs because we can reopen them in the middle of client requests (we have to) whereas Unicorn has the luxury of _knowing_ it has no active clients when it does the reopen.
2009-11-07remove unnecessary class variable
It's already global...
2009-11-05Threaded models have trouble with late loading under 1.9
Loading TeeInput or HttpResponse late does not always work well in multithreaded situations and have been causing random test failures on heavily loaded multicore boxes.
2009-11-04http_server: add one second to any requested timeout
This is because our timeout implementations are less precise than Unicorn. Since we handle multiple clients with the same process, we sacrifice precision for performance and instead implement our fchmod heartbeats at a fixed rate, as doing fchmod() repeated for short-lived connections would hurt performance and we have to call fchmod even when connected clients are idle.
2009-11-02Allow 'use "model"' as a string as well as symbol
Since const_get works with a string as well as a symbol, allow that to be used. It's easier and simpler to just allow strings as use arguments than to error check and raise exceptions. So both of the following should now work: Rainbows! do use :Revactor end Rainbows! do use "Revactor" end Rainbows! will always use the symbol variant internally, however, so applications can alway expect env['rainbows.model'] to be a symbol.