502s with Nginx, Unicorn, and Unix Domain Sockets

Tom Preston-Werner tom at github.com
Sat Sep 19 16:23:24 EDT 2009

On Thu, Sep 17, 2009 at 11:48 PM, Eric Wong <normalperson at yhbt.net> wrote:
> At what request rates were you running into this?  Also how large are
> your responses?  It could be the listen() backlog overflowing if Unicorn
> isn't logging anything.

I was hitting the 502s at about 1300 req/sec and 80% CPU utilization.
Response size was only a few bytes + headers. I was just testing a
very simple string response from our Rails app to make sure our setup
could tolerate very high request rates.

> Does increasing the listen :backlog parameter work?  Default is 1024
> (which is pretty high already), maybe try a higher number along with the
> net.core.netdev_max_backlog sysctl.

This was the first thing I tried after getting your response, and it
seems that upping the :backlog to 2048 solves the 502 problem! I'm now
able to get 1500 req/sec out of Unicorn/UNIX (as opposed to 1350
req/sec with the TCP/HAProxy setup). I'm quite satisfied with this
result, and I think this is how we'll end up deploying the app.

Thanks for your help, and I'll try to keep you updated on how our
installation performs and if I see any strange behavior under normal


More information about the mongrel-unicorn mailing list