unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Chris Wanstrath <chris@ozmm.org>
Cc: mongrel-unicorn@rubyforge.org
Subject: Re: Our Unicorn Setup
Date: Fri, 9 Oct 2009 13:30:25 -0700	[thread overview]
Message-ID: <20091009203025.GA23205@dcvr.yhbt.net> (raw)
In-Reply-To: <8b73aaca0910091242u78ac787aj48fb1b63b5bf55bc@mail.gmail.com>

Chris Wanstrath <chris@ozmm.org> wrote:
> Hi list,
> 
> I've just published a post detailing our Unicorn setup, migration
> process, and reasons for choosing it:
> http://github.com/blog/517-unicorn

Cool!

"The Unicorn master manages the workers and balancing"

Actually, the master never manages balancing, just the workers.  The
diagram is a little inaccurate as it looks like the master sees the
requests, it never does.

The request flow is like this:

           requests
              |
              |
              |
        shared socket(s)
             /|\
            / | \
           |  |  |
           |  |  |
         worker pool

While the shared socket is opened and configured by the master, but the
master does nothing else with the sockets.  You're completely right
about the pull balancing, it's one of the most distinctive differences
between Unicorn and other setups.



Also, for the 502s, do you get more 502s after the initial worker times
out?  I think nginx may (still)[1] mark a backend as completely dead/down
when a backend dies.  That may cause nginx to stop forwarding to that
backend entirely and throw more 502s for a few seconds until nginx
decides to actually try that backend again.

Setting fail_timeout=0 causes nginx to never mark backends as down and
always try to send a request to them:

  upstream github {
    server unix:/data/github/current/tmp/sockets/unicorn.sock fail_timeout=0;
  }

I'll add this bit somewhere in the Unicorn docs and release 0.93.3 with
the OpenBSD fix for Jeremy in a bit.

> Thanks again!

No problem :)


[1] - I'm not 100% sure if nginx still does this, but I don't see
      anything in the 0.6.x changelog that indicates otherwise.
      I don't see a huge amount of harm in doing this always, we've been
      using fail_timeout=0 for ~2 years now regardless of the backend.

-- 
Eric Wong

  reply	other threads:[~2009-10-09 20:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09 19:42 Our Unicorn Setup Chris Wanstrath
2009-10-09 20:30 ` Eric Wong [this message]
2009-10-09 21:25   ` Chris Wanstrath
2009-10-09 21:03 ` Dusty Doris
2009-10-09 22:01   ` Eric Wong
2009-10-09 22:44     ` Dusty Doris
2009-10-09 23:11       ` Eric Wong
2009-10-09 23:17         ` Dusty Doris

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=20091009203025.GA23205@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=chris@ozmm.org \
    --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).