Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
* [RFD] keepalive_timeout default: 2s => 5s
@ 2010-02-19 22:09 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2010-02-19 22:09 UTC (permalink / raw)
  To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw

This is mostly only relevant to folks who run Rainbows! without a proxy
in front of it, which I suppose are few...

The current keepalive time is only 2s, which is enough for broadband
connections and even tiny HTTP responses on dialup, but not enough
for large responses to slow clients.

For HTTP keepalive, there needs to be enough time to load all inline
assets (images/frames/iframes/JS/CSS/AJAX) without an additional TCP
connection.

For larger responses on slow connections (say 4K/s), this means the last
chunk of the response is written into the kernel socket buffer and the
userspace process (Rainbows!) has no visibility into when the client
finishes receiving data.

With Linux 2.6 defaults (16K TCP send buffer) with 4K/s downstream to
the client, that's 4 seconds of transfer time a userspace process
(Rainbows!) can't account for at all.

With the 2s default keepalive, Rainbows! would've timed out the client
connection before the client has even had a chance to finish receiving
data.

So with a 5s keepalive, we still leave the client with 1 second to fully
parse the initial HTML page and send more requests upstream.  Some
clients (afaik) parse HTML and send additional requests while
downloading.

Using 6 seconds would give some more room to deal with latency and slow
clients for little additional cost.

For reference, Apache 2.2 uses 5 seconds as the default, too.

  http://httpd.apache.org/docs/2.2/mod/core.html#keepalivetimeout

Given that several of Rainbows! concurrency models are less overhead
per-connection than Apache threaded/prefork models, 5-6 seconds should
be a safe enough default for us.

-- 
Eric Wong
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-02-19 22:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-19 22:09 [RFD] keepalive_timeout default: 2s => 5s Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).