Error: EMFILE, too many open files 'xxx.ejs'
来源:互联网 发布:厦门大学网络教育 编辑:程序博客网 时间:2024/06/04 20:01
node 服务挂掉了,优化如下:
编辑文件:/etc/sysctl.conf 加入以下:
net.ipv4.ip_local_port_range='1024 65000'
net.ipv4.tcp_tw_reuse='1'
net.ipv4.tcp_fin_timeout='15'
net.core.netdev_max_backlog='4096'
net.core.rmem_max='16777216'
net.core.somaxconn='4096'
net.core.wmem_max='16777216'
net.ipv4.tcp_max_syn_backlog='20480'
net.ipv4.tcp_max_tw_buckets='400000'
net.ipv4.tcp_no_metrics_save='1'
net.ipv4.tcp_rmem='4096 87380 16777216'
net.ipv4.tcp_syn_retries='2'
net.ipv4.tcp_synack_retries='2'
net.ipv4.tcp_wmem='4096 65536 16777216'
vm.min_free_kbytes='65536'
优化nginx代理设置,
keepalive_timeout 15;
keepalive 64; #设置存活时间。如果不设置可能会产生大量的timewait。
重新启动nginx
用netstat -nop | grep 3000|wc -l 或ss -s查看timewait 明显减少。
附nginx配置:
upstream nodejs__upstream {
server 127.0.0.1:3001;
keepalive 64;
}
server {
listen 80;
server_name www.xxx.com xxx.com;
access_log /data/var/log/nginx/xxx.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://nodejs__upstream;
}
}
过了几天问题依旧:
vim /etc/security/limits.conf
加入下面两行
* soft nofile 10240
* hard nofile 10240
重启ssh,ulimit -n 查看。。生效。。
待观察。。
参考:
http://www.oschina.net/translate/optimising-nginx-node-js-and-networking-for-heavy-workloads?print
http://blog.fens.me/nodejs-nginx-log4js/
- Error: EMFILE, too many open files 'xxx.ejs'
- Nodejs中Error:EMFILE,too many open files的解决方案
- java.io.FileNotFoundException: open failed: EMFILE (Too many open files)
- readdir时抛出异常:EMFILE, too many open files
- Tomcat启报错,error:too many open files
- Redis too many open files error
- too many open files
- too many open files
- Too many open files
- too many open files
- Too many open files
- too many files open
- too many open files
- too many open files
- Too many open files
- Open Too Many files
- Too many open files
- Too many open files
- Tomcat下热部署
- 数学篇----参数估计之最大似然估计法[概率论]
- 《coredump问题原理探究》Linux x86版6.6节单继承
- 15.02.04,C数据类型笔记
- 背包问题——“01背包”最优方案总数的求解
- Error: EMFILE, too many open files 'xxx.ejs'
- cocoapods 找不到头文件
- Play on Words——字母首尾相连
- ArrayList
- 常用CSS样式总结
- 本文整理了四种在MySQL中修改root密码的方法
- 初次在Android上运行opencv app时,出现的错误,以及解决
- C/C++堆和栈的区别
- URIs, URLs, and URNs