502s with Nginx, Unicorn, and Unix Domain Sockets

Tom Preston-Werner tom at github.com
Fri Sep 18 00:54:48 EDT 2009

I'm doing some benchmarking on our new Rackspace frontend machines (8
core, 16GB) and running into some problems with the Unix domain socket
setup. At high request rates (on simple pages) I'm getting a lot of
HTTP 502 errors from Nginx. Nothing shows up in the Unicorn error log,
but Nginx has the following in its error log:

2009/09/17 19:36:52 [error] 28277#0: *524824 connect() to
unix:/data/github/current/tmp/sockets/unicorn.sock failed (11:
Resource temporarily unavailable) while connecting to upstream,
client:, server: github.com, request: "GET /site/junk
HTTP/1.1", upstream:
orn.sock:/site/junk", host: "github.com"

This problem does not exist with the nginx -> haproxy -> unicorn
setup. Thinking this might be a file descriptor problem, I upped the
fd limit to 32768 with no luck. Then I tried upping net.core.somaxconn
to 262144 which also had no effect. I thought I'd ask about the
problem here to see if anyone knows a simple solution that I'm
missing. Perhaps there is an Nginx configuration directive I need?
Thanks. Unicorn rocks!


Tom Preston-Werner
GitHub Cofounder

More information about the mongrel-unicorn mailing list