uWSGI detected max file descriptor number : 1024
@China_OS 你好,想跟你请教个问题:在Ubuntu下构建有一个Web APP框架,Nginx+uWSGI+Django,
通过负载测试工具高压测试,结果只能产生1024个并发量,修改单进程最大可操作文件描述符,修改后为65535,重启后,uWSGI日志报告,detected max file descriptor number : 1024。请问是什么会导致这个问题无法正常修改?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
主要相关配置:
#add to /etc/sysctl.conf,内核参数
fs.file-max = 999999
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_rmem = 4096 32768 262142
net.ipv4.tcp_wmem = 4096 32768 262142
net.core.netdev_max_backlog = 8096
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 65536
#参数配置结果
libing~$ sudo sysctl -p
fs.file-max = 999999
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_rmem = 4096 32768 262142
net.ipv4.tcp_wmem = 4096 32768 262142
net.core.netdev_max_backlog = 8096
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_syn_backlog = 65536
#add to /etc/security/limits.conf
* hard nofile 65535
* soft nofile 10000
#配置结果
libing~$ ulimit -n
65535
#uWSGI配置文件,未设置用户及用户组,设置也是同样1024
[uwsgi]
socket=127.0.0.1:8090
chmod-socket=777
plugins=python
pythonpath=/home/libing/Agriculture/agriculture/
module=agriculture.wsgi
master=true
processes=4
vacuum=true
max-request=51200
pidfile=/home/libing/Agriculture/logs/Agriculture.pid
logto=/home/libing/Agriculture/logs/Agriculture.log
回复
先单压nginx 看看是不是有1024限制,然后再压nginx+uwsgi看看,看配置应该没问题的,fs.file-max 999999没有设置这么大的...
回复
单压Nginx发现,产生负载时就只能产生2000左右,产生压力就已经受限制了,尝试去修改/usr/include/bits/typesizes.h的__FD_SETSIZE,重新编译测试工具httperf,发现没有奏效,是否是select和epoll选择的问题?
回复
这个看来你nginx这一层并发就上不来,不需要修改源码,应该是系统参数哪里设置的有问题。
回复
我使用的ubuntu 14.04系统,不知道还要改哪些配置,主要参考http://itlab.idcquan.com/linux/administer/958961.html
回复
最近在外地乱跑....
你修改的哪里?