Way to queue connections until a uwsgi socket available?

Maxim Dounin mdounin at mdounin.ru
Thu Dec 9 01:47:38 MSK 2010


Hello!

On Wed, Dec 08, 2010 at 05:13:09PM -0500, kickme444 wrote:

> We are currently configuring nginx and uwsgi on ubuntu 9.10.  We are
> having a problem while load testing in that when uwsgi becomes
> saturated, nginx kills incoming connections rather than queueing.  I
> cannot figure out if there is a way to do this queueing in nginx.  The
> errors we get in the nginx error log look like:
> 
> 2010/12/08 12:57:03 [error] 15276#0: *10079 connect() to
> unix:///var/run/nginx-uwsgi/wsgi-app.sock failed (11: Resource
> temporarily unavailable) while connecting to upstream, client:
> xx.xxx.xx.xx, server: www.app.com, request: "GET /url/here/ HTTP/1.1",
> upstream: "uwsgi://unix:///var/run/nginx-uwsgi/wsgi-app.sock:", host:
> "ec2-xxx-xxx-xxx-xx.compute-1.amazonaws.com"

Enlarge listen queue on backend (i.e. uwsgi app).  According to 
[1] it should be possible via something like

<listen>4096</listen>

in uwsgi.xml.  Note that your OS may require tuning to make 4096 
possible, something like "echo 4096 > /proc/sys/net/core/somaxconn". 
Refer to your OS manuals for details.

[1] http://projects.unbit.it/uwsgi/wiki/Doc

> I have tried kqueue and poll to no avail. 

There is no kqueue on ubuntu, the best event method it has is 
epoll.  This is unrelated though.

Maxim Dounin



More information about the nginx mailing list