unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: Using HTTP/1.1 and permanent connections
Date: Fri, 16 Apr 2010 13:09:18 -0700	[thread overview]
Message-ID: <20100416200918.GA10256@dcvr.yhbt.net> (raw)
In-Reply-To: <r2hcc1f582e1004161149ja4187a68k7867f794aeed8d7f@mail.gmail.com>

Iñaki Baz Castillo <ibc@aliax.net> wrote:
> Hi, I know that Unicorn forces TCP disconnection as it's explained at
> the top of lib/unicorn/http_response.rb:
> 
>   # A design decision was made to force the client to not pipeline or
>   # keepalive requests.  HTTP/1.1 pipelining really kills the
>   # performance due to how it has to be handled and how unclear the
>   # standard is.  To fix this the HttpResponse always gives a
>   # "Connection: close" header which forces the client to close right
>   # away.  The bonus for this is that it gives a pretty nice speed boost
>   # to most clients since they can close their connection immediately.
> 
> 
> However I want to try TCP permanent connections from the client (or a
> proxy) to Unicorn. I've tryed to modify same file as above by changing
> at the end:

<snip>

> But of course this is not enough and it fails. Not sure what exactly
> happens, it seems that a Unicorn worker doesn't process requests
> anymore until replying the first response.
> 
> So I would like to know if it's feasible to make Unicorn work in
> persistent mode.
> NOTE: I already know that the current design is really good, better
> than using persistent connections, but I want to experiment with
> persistent connections for other purposes I will explain in a future.

Hi Iñaki,

Unicorn won't try to read further requests from the socket (see
process_client() in lib/unicorn.rb).

However, you can use Rainbows! without specifying a concurrency model at
all (or "use :Base").  That way you'll get proper HTTP/1.1 keepalive
support and you can control keepalive_timeout:

# both of these values are the defaults for unconfigured Rainbows!
Rainbows! do
  use :Base
  keepalive_timeout 5
end

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


  reply	other threads:[~2010-04-16 20:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-16 18:49 Using HTTP/1.1 and permanent connections Iñaki Baz Castillo
2010-04-16 20:09 ` Eric Wong [this message]
2010-04-17 22:53   ` Iñaki Baz Castillo

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/unicorn/

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

  git send-email \
    --in-reply-to=20100416200918.GA10256@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=mongrel-unicorn@rubyforge.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/unicorn.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).