From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=1.0 required=3.0 tests=AWL,HK_RANDOM_FROM, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: [RFD] keepalive_timeout default: 2s => 5s Date: Fri, 19 Feb 2010 14:09:04 -0800 Message-ID: <20100219220904.GA11377@dcvr.yhbt.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1266617359 8031 80.91.229.12 (19 Feb 2010 22:09:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Feb 2010 22:09:19 +0000 (UTC) To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Fri Feb 19 23:09:15 2010 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:70 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nib2B-0001Vx-FG for gclrrg-rainbows-talk@m.gmane.org; Fri, 19 Feb 2010 23:09:15 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 6FC111D788D4; Fri, 19 Feb 2010 17:09:12 -0500 (EST) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 048E31D788D4 for ; Fri, 19 Feb 2010 17:09:05 -0500 (EST) Received: from localhost (unknown [127.0.2.5]) by dcvr.yhbt.net (Postfix) with ESMTP id CDCB01F500; Fri, 19 Feb 2010 22:09:04 +0000 (UTC) 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