unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Jamie Wilkinson <jamie@tramchase.com>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: scaling unicorn
Date: Mon, 21 Jun 2010 19:34:33 -0700	[thread overview]
Message-ID: <F596AC52-4CD1-4543-9B04-7A19762995DC@tramchase.com> (raw)
In-Reply-To: <20100622001632.GA10082@dcvr.yhbt.net>

On Jun 21, 2010, at 5:16 PM, Eric Wong wrote:

>> overloading the server or hitting memory bandwidth issues.  The
>> backlog is at the somaxconn default of 128, I'm still not sure if we
>> will bump that up or not.
> The default backlog we try to specify is actually 1024 (same as
> Mongrel).  But it's always a murky value anyways, as it's
> kernel/sysctl-dependent.  With Unix domain sockets, some folks use
> crazy values like 2048 to look better on synthetic benchmarks :)

Somewhat related -- I've been meaning to discuss the finer points of backlog tuning.

I've been experimenting with the multi-server socket+TCP megaunicorn configuration from your CDT:

Which I think is what this sentence from TUNING is talking about?

	"Setting a very low value for the :backlog parameter in “listen” directives can allow failover to happen more quickly if your cluster is configured for it."

Our app can catch a batch of requests which will be slow (1-3s), and these can pool on one individual server in our load-balanced EC2 cluster -- exactly the case for the multi-server failover setup. 

I've put this into production under a healthy load (5000+ RPM) and it appears to work really well!  Produces very high requests/s rates at significantly higher concurrency than without, and serves zero 502 errors (part of the goal)

I currently I have the unix socket set to a backlog of 64, then failing over to a TCP listener using backlog 1024 (so that things are queued rather than 502'd)

I can imagine there might be a case for keeping the TCP backlog low as well & serving errors when overloaded, rather than getting caught in an unrecoverable back-queue tarpit

I'm currently failing-over to a dedicated "backup" instance, so that I could measure exactly how much traffic is being offloaded. This means my benchmarks w/o failover are 1 server, but with failover is actually 2 servers. We're reconfiguring to something more like the original diagram at which point I'll do some cluster-wide stress-tests & share data/scripts/process. 

BTW, this configuration needs a cool name!


Unicorn mailing list - mongrel-unicorn@rubyforge.org
Do not quote signatures (like this one) or top post when replying

  reply	other threads:[~2010-06-22  2:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTilv4e_DPDKy440xotrlE7ucFIFXs74uHyGrzCKL@mail.gmail.com>
2010-06-22  0:16 ` [Mongrel] scaling unicorn Eric Wong
2010-06-22  2:34   ` Jamie Wilkinson [this message]
2010-06-22  4:53     ` Eric Wong
2010-06-22 18:03       ` snacktime
2010-06-22 18:57         ` Jamie Wilkinson
2010-06-23  9:32         ` Eric Wong
2010-06-22 19:18       ` Jamie Wilkinson
2010-06-22 17:30   ` [Mongrel] " snacktime

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:

  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=F596AC52-4CD1-4543-9B04-7A19762995DC@tramchase.com \
    --to=jamie@tramchase.com \
    --cc=mongrel-unicorn@rubyforge.org \


* 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


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).