Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org>
To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Subject: [RFD] keepalive_timeout default: 2s => 5s
Date: Fri, 19 Feb 2010 14:09:04 -0800	[thread overview]
Message-ID: <20100219220904.GA11377@dcvr.yhbt.net> (raw)

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


                 reply	other threads:[~2010-02-19 22:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/rainbows/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100219220904.GA11377@dcvr.yhbt.net \
    --to=normalperson-rmlxzr9ms24@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).