I'm getting the following error in my nginx server error log file:
2010/04/16 13:24:16 [crit] 21974#0: *3188937 open() "/usr/local/nginx/html/50x.html" failed (24: Too many open files), client: 88.x.y.z, server: example.com, request: "GET /file/images/background.jpg HTTP/1.1", upstream: "http://10.8.4.227:81//file/images/background.jpg", host: "example.com"
...
2010/12/21 12:39:25 [crit] 20157#0: *230260 open() "/usr/local/nginx/html/50x.html" failed (24: Too many open files), client: 58.245.186.49, server: example.com, request: "GET /style/all.css HTTP/1.1", host: "example.com", referrer: "http://domain.com/x.php?..."
2010/12/21 12:39:25 [alert] 20157#0: accept() failed (24: Too many open files)
How do I fix this problem under CentOS / RHEL / Fedora Linux or UNIX like operating systems?
Linux / UNIX sets soft and hard limit for the number of file handles and open files. You can use ulimit command to view those limitations:su - nginx
To see the hard and soft values, issue the command as follows:ulimit -Hn
ulimit -Sn
Your operating system set limits on how many files can be opened by nginx server. You can easily fix this problemby setting or increasing system open file limits under Linux. Edit file /etc/sysctl.conf, enter:# vi /etc/sysctl.conf
Append / modify the following line:fs.file-max = 70000
Save and close the file. Edit /etc/security/limits.conf, enter:# vi /etc/security/limits.conf
Set soft and hard limit for all users or nginx user as follows:
nginx soft nofile 10000 nginx hard nofile 30000
Save and close the file. Finally, reload the changes with sysctl command:# sysctl -p
Nginx also comes with worker_rlimit_nofile directive which allows to enlarge this limit if it's not enough on fly at process level. To set the value for maximum file descriptors that can be opened by nginx process. Edit nginx.conf file, enter:# vi /usr/local/nginx/conf/nginx.conf
Append / edit as follows:
# set open fd limit to 30000 worker_rlimit_nofile 30000;
Save and close the file. Reload nginx web server, enter:# /usr/local/nginx/sbin/nginx -t && /usr/local/nginx/sbin/nginx -s reload
# su - nginx
$ ulimit -Hn
$ ulimit -Sn
Sample outputs:
30000 10000
cat /proc/<pid>/limits
本日志由 flyinweb 于 2010-12-22 09:50:18 发表,目前已经被浏览 3100 次,评论 0 次;
作者添加了以下标签: Too Many Open Files;
引用通告:http://www.517sou.net/Article/550/Trackback.ashx
而且直接配置文件是效率最高的,通过其它驱动效率都相对较低,BDB
这个测试不太准确,看官方的测试结果:http://bind-dlz.sourceforg
为什么使用BDB时QPS这么低? 我在bind版本基本相似的环境中测试的
It is quite useful and interesting too.
VIRT 的上限是64G,也就是36位, cat /proc/cpuinfo的结果是:addre
昨天要准备用线程重写webbench,试验了下Fedora Linux 2.6.35.14
不明白您的具体的意思是什么?
已经发送到你QQ邮箱