Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Jake Douglas <jakecdouglas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Rainbows! list" <rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org>
Subject: Re: Zbatery/Rainbows keepalive problem?
Date: Fri, 26 Nov 2010 20:35:16 -0800	[thread overview]
Message-ID: <AANLkTi=J9cXKj+7Wi5AbL6FvwsqdJeb9UH6e-Yfs05v-@mail.gmail.com> (raw)
In-Reply-To: <20101124221402.GA28625-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>

On Wed, Nov 24, 2010 at 2:14 PM, Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> wrote:
> Jake Douglas <jakecdouglas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> On Wed, Nov 24, 2010 at 1:17 PM, Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> wrote:
>> > Jake Douglas <jakecdouglas-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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?  Rainbows!/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.
>
> <top posting corrected>
>
> 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


  parent reply	other threads:[~2010-11-27  5:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-24 20:38 Zbatery/Rainbows keepalive problem? Jake Douglas
     [not found] ` <AANLkTimSuK7-ihgCa00D-fot4U-FbZt2diQFndyN4uit-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-24 21:17   ` Eric Wong
     [not found]     ` <20101124211714.GA25256-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2010-11-24 21:29       ` Jake Douglas
     [not found]         ` <AANLkTi=oKL0Saw9sjf8Lrw-JakmOUKHnM363Qw=6JQO8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-24 22:14           ` Eric Wong
     [not found]             ` <20101124221402.GA28625-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2010-11-27  4:35               ` Jake Douglas [this message]
     [not found]                 ` <AANLkTi=J9cXKj+7Wi5AbL6FvwsqdJeb9UH6e-Yfs05v--JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-27  8:50                   ` Eric Wong
     [not found]                     ` <20101127085011.GA8663-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2010-11-27 21:55                       ` Jake Douglas
     [not found]                         ` <AANLkTimkvFSjiz60Bm90NQUa0+7-UE7-R35nVwU8LcQi-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-28  5:30                           ` Jake Douglas
     [not found]                             ` <AANLkTimPgtZ47OVJtBz5JMtHs8U5wk6=ULMSou_3e18z-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-28 10:07                               ` Eric Wong
     [not found]                                 ` <20101128100705.GA23779-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2010-11-28 17:26                                   ` Jake Douglas
     [not found]                                     ` <AANLkTi=bt+cMTYdc+SMi0DJ3ZBB2iV8PryaWPm5-YqC--JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-29 21:12                                       ` Eric Wong
     [not found]                                         ` <20101129211236.GA18934-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2010-11-29 22:45                                           ` Jake Douglas
     [not found]                                             ` <AANLkTimE+t6o1U--N3MP7btZa0xKXEMHnhTTW=8Sn_x0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-07  0:20                                               ` Eric Wong

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='AANLkTi=J9cXKj+7Wi5AbL6FvwsqdJeb9UH6e-Yfs05v-@mail.gmail.com' \
    --to=jakecdouglas-re5jqeeqqe8avxtiumwx3w@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).