Way to queue connections until a uwsgi socket available?

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

I have tried kqueue and poll to no avail.

Here is our nginx.conf


user www-data;
worker_processes 2;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;

access_log  /var/log/nginx/access.log;

sendfile        on;

keepalive_timeout  65;
tcp_nodelay        on;

gzip  on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
client_max_body_size 50m;

server {
listen 80;
server_name app;

  access_log  /var/log/nginx/access_80.log;

  location / {
              uwsgi_connect_timeout 10;
              uwsgi_pass

unix:///var/run/nginx-uwsgi/wsgi-app.sock;
include uwsgi_params;
}
}
include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/
;
}

here is our uwsgi.xml file

/var/run/nginx-uwsgi/wsgi-app.sock
/path/to/python/app
wsgi
33
33
12

60
256
10
10

Any help here would be GREATLY appreciated!

Posted at Nginx Forum:

We had similar problems;
The uWSGI project — uWSGI 2.0 documentation helped us
lick them, along with the following entry about socket timeout.

Posted at Nginx Forum:

Hello!

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

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

4096

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] The uWSGI project — uWSGI 2.0 documentation

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