Your server socket listen backlog is limited to 100 connections

shoujs picture shoujs · Sep 9, 2012 · Viewed 37k times · Source

I run a flask app on uwsgi. I use supervisor to manage uwsgi process. I find the log saying that

your server socket listen backlog is limited to 100 connections.

How to overcome 100 connections limitation? My running script is as below:

[program:myapp]
command=uwsgi --master -s /tmp/app.sock --module myapp:app --processes 2 -H /srv/sites/mysite chmod-socket 666 --enable-threads

Answer

user4815162342 picture user4815162342 · Sep 9, 2012

Note that a "listen backlog" of 100 connections doesn't mean that your server can only handle 100 simultaneous (or total) connections - this is instead dependent on the number of configured processes or threads. The listen backlog is a socket setting telling the kernel how to limit the number of outstanding (as yet unaccapted) connections in the listen queue of a listening socket. If the number of pending connections exceeds the specified size, new ones are automatically rejected. A functioning server regularly servicing its connections should not require a large backlog size.

According to the manual, you can change the listen backlog with the -l option:

-l|--listen <num>
       set  socket  listen queue to <n> (default 100, maximum is system
       dependent)