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=0.0 required=3.0 tests=AWL,MIME_QP_LONG_LINE, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Jake Douglas Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: Zbatery/Rainbows keepalive problem? Date: Fri, 26 Nov 2010 20:35:16 -0800 Message-ID: References: <20101124211714.GA25256@dcvr.yhbt.net> <20101124221402.GA28625@dcvr.yhbt.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1290834548 3981 80.91.229.12 (27 Nov 2010 05:09:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 27 Nov 2010 05:09:08 +0000 (UTC) To: "Rainbows! list" Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Sat Nov 27 06:09:04 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=5+aAUWo2iofgyZt+wFCzirVa0YXPwwK4qTpvj3xOgGQ=; b=uzB1AvEg0VnPhR550n5HgA2+K3V57MJ9ziyZiGVyqTp+jzr/FmnrpKncuZPCg+eXYs 25S/jKZlYRtBMgzh/THfZ2z4vBqdpClf+I3YhcOuLu6Bb3Ir0eyxEi8LMHy5zxm4ptCk g3XnszzzfZcthDaoi+l+BXcE3qBNfkORb+hGQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=i/P9SJ2Sb9dU5O1+RfA6qzS1Rf4vG1AlSL8sLReUhsQ+lQxa24hYp6Jpa43eEY0rnQ UUG8fLYyxTrsoLvgctgvCvzyW++zh4rviY2fYZWv/rY9bEfnG15xUB7zRDgfrOaISRI9 47rKyZgbaRcNK0CJ/ZFYai8vVLIMj66/HFRYc= In-Reply-To: <20101124221402.GA28625-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org> 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:151 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PMD1y-000674-V1 for gclrrg-rainbows-talk@m.gmane.org; Sat, 27 Nov 2010 06:09:03 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 6D33B1858321 for ; Sat, 27 Nov 2010 00:09:02 -0500 (EST) Received: from mail-fx0-f50.google.com (mail-fx0-f50.google.com [209.85.161.50]) by rubyforge.org (Postfix) with ESMTP id 8D7C318581F3 for ; Fri, 26 Nov 2010 23:35:17 -0500 (EST) Received: by fxm14 with SMTP id 14so2081944fxm.23 for ; Fri, 26 Nov 2010 20:35:16 -0800 (PST) Received: by 10.223.71.199 with SMTP id i7mr2886850faj.57.1290832516817; Fri, 26 Nov 2010 20:35:16 -0800 (PST) Received: by 10.223.105.207 with HTTP; Fri, 26 Nov 2010 20:35:16 -0800 (PST) On Wed, Nov 24, 2010 at 2:14 PM, Eric Wong wrote: > Jake Douglas wrote: >> On Wed, Nov 24, 2010 at 1:17 PM, Eric Wong wrote: >> > Jake Douglas wrote: >> >> I am using zbatery with ThreadPool and just upgraded to 0.5.0, which >> >> subsequently upgraded rainbows to 2.0.0 and unicorn to 3.0.0. My >> >> browser(s) now hangs for a while during each request. I noticed some >> > >> > Are you setting a Content-Length or Transfer-Encoding in your app? >> > >> > You can add Rack::Chunked and Rack::ContentLength middlewares to your >> > config (some frameworks like Rails already do this, I think). >> > >> > Which versions of Zbatery/Rainbows!/Unicorn were you using before which >> > exhibited this? =A0Rainbows!/Zbatery has supported keepalive for some = time >> > and none of the three servers ever included >> > Rack::Chunked/Rack::ContentLength in its middleware stack by default. >> >> I was using zbatery 0.4.0, Unicorn 2.0.1, unsure of the rainbows >> version. This is a Rails 3.0.3 app and I am not setting any headers >> myself. Are you saying that Rails is doing something that is causing >> the problem? Please bear with me, as I am not familiar with the >> details of how keep alive works. > > > > Responses without keepalive don't need additional headers since the > server just closes the connection to notify the client. > > HTTP/1.1 with keepalive requires a Content-Length (or Transfer-Encoding: > chunked) header to determine response boundaries, otherwise clients > would never know when one response ends and another begins. > > The normal Rails "render" path already seems[1] to add Content-Length; > are you doing something else to send responses from Rails? > > Including the Rack::Chunked/Rack::ContentLength middlewares (at the top > of the middleware stack) should solve all your problems. > > If you only serve HTTP/1.1, you can probably get away with only > Rack::Chunked... > > > [1] - I haven't had a chance to test this myself > > -- > Eric Wong I am not doing anything special to send responses from Rails, only 'render'. I can see in my browser that keep-alive is set, and Content-Length is also set. It looks like the first couple requests finish quickly, and then the remaining take an additional 5 seconds each. It seems the browser is hanging for the default keep-alive timeout of 5 seconds on each request before proceeding. This happens with different browsers. Is there additional information I can provide to give better insight into why this is happening? Thanks _______________________________________________ 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