Now the Django application is basically using UWSGI to deploy, similar to listen queue of socket "127.0.0.1:9001" (fd: 3)
the following error occurred 2 times, below the two errors occurred in the process of resolution.
Error scenario
- CentOS 6.6
- uwsgi2.0
- nginx1.6
Error log interception
TueJun217:33:272015uWSGIlistenqueueofsocket"127.0.0.1:9001" (fd3full!!! (101/100) ***TueJun217:33:282015uWSGIlistenqueueofsocket"127.0.0.1:9001" (fd3full!!! (101/100) ***
The first time is because the Unicom computer room firewall configuration is wrong, limit the server output, that is, the external contract to the server is not a problem, but the server returned to the outside of the package is very slow, almost unusable, this time Uwsgi log in a large number of errors
The second is a large increase in concurrency, when the active link remains around 6000, and this error occurs a lot.
Analysis
Based on this error, query the relevant information, should be the system-level parameters, specifically, you can refer to the Linux man page listen (2).
LZZ Note: The simple understanding is that each listening socket, before the accept, wait for the socket queue length, Linux (at least in centos6.6) default is 128, in my this compiled uwsgi default is 100, That is, before the system parameters are adjusted, the highest is 128.
So how can the length of the queue be adjusted longer?
* System parameters must be adjusted to make it effective
* You must adjust the UWSGI configuration and then restart the app
Operation
modifying system parameters
The configuration file is changed directly here, and is still valid after rebooting.
Modify the/etc/sysctl.conf file to add or modify these parameter values
#对于一个经常处理新连接的高负载 web服务环境来说,默认的 128 太小了net.core.somaxconn262144?#表示SYN队列的长度,默认为1024,加大队列长度为8192,可以容纳更多等待连接的网络连接数net.ipv4.tcp8192#网卡设备将请求放入队列的长度net.core.netdev65536
Remember to reload the parameters after the modification is complete sysctl -p
Uwsgi Adjustment
Add the following configuration to the configuration, or to the command line plus an option such as the. ini file
listen=1024
Then restart the app and reload the configuration.
Summary
By modifying the configuration, this error basically does not occur, and the throughput and concurrency of the system are greatly improved. So system features and tuning are important for improving the quality of the service.
Reference
- Somaxconn-that pesky limit.
- Listen (2)-Linux man page
Copyright NOTICE: This article is Orangleliu (http://blog.csdn.net/orangleliu/) original article, the article reproduced please declare.
The above describes the listen queue of socket FD:3 error analysis, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.