Your server socket listen backlog is limited to 100 connections

前端 未结 4 1837
心在旅途
心在旅途 2020-12-23 21:31

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

4条回答
  •  情歌与酒
    2020-12-23 22:06

    Simply increasing the uwsgi's listen backlog using the -l or --listen option (as pointed by user4815162342) while starting the server, to a value greater than 128 might stop uwsgi from starting up. There is also a system level limit on Unix socket and TCP connection listen queue, whose default is 128, that needs to be increased.

    You can verify that setting like this:

    cat /proc/sys/net/core/somaxconn
    

    uwsgi has been patched such that if the value passed to --listen parameter while starting uwsgi is greater than the system level limit, it'll cause uwsgi to fail hard. If you want set uwsgi's listen queue limit greater than the system level limit, you must first increase the kernel's limit. That can be done executing the following commands:

    $ echo 4096 > /proc/sys/net/core/somaxconn
    

    Or

    $ sysctl -w net.core.somaxconn=4096
    

    Or, add net.core.somaxconn=4096 to /etc/sysctl.conf for it to persist through a reboot.

提交回复
热议问题