之前晚上直播出现 Too many open files, 很多接口 access_log 出现500报错
查了下资料,更改步骤如下:
/etc/sysctl.conf fs.file-max = 70000 (这个数值应当大于等于下面的硬限制) /etc/security/limits.conf nginx soft nofile 10000 nginx hard nofile 30000 让上面的配置生效 sysctl -p 设置nginx应用层面的限制 vim /etc/nginx/nginx.conf # set open fd limit to 30000 worker_rlimit_nofile 30000;
测试:
ab -r -k -n200 -c30 -H "User-Agent: Test By George" "http://api.ltwen.com/test/ab"
参考资料
https://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/