高并发Nodejs参数调整
来源:互联网 发布:金淘淘软件 编辑:程序博客网 时间:2024/05/22 03:21
关闭v8 空时通知机制
--nouse-idle-notification
修改http.Agent
官网说明:agent.maxSocketsBy default set to 5. Determines how many concurrent sockets the agent can have open per host.(为了http请求能复用connection连接,Nodejs在http.Agent创建了一个默认大小为5的连接池)修改后如下:require("http").globalAgent.maxSockets = Infinity;
修改–max-old-space-size
--max-old-space-size=2048(根据自己情况,可以调大,单位是M)说明:v8 在64位操作系统默认使用的max-old-space-size是1.7G,大家可以通过:node --v8-options 查看V8参数
使用PM2管理
例如:{"apps" : [ { "name": "comet-server-4000", "script": "server.js", "port": 4000, "args": "['-p4000','-t','plan']", "run-as-group" : "comet", "exec_mode": "cluster_mode", "node-args": "--nouse-idle-notification --gc_global --max-old-space-size=2048 --max-new-space-size=1024" }, { "name": "comet-server-4001", "script": "server.js", "port": 4001, "run-as-group": "comet", "args": "['-p4001','-t','plan']", "exec_mode": "cluster_mode", "node-args": "--nouse-idle-notification --gc_global --max-old-space-size=2048 --max-new-space-size=10240" }]}
避免在socket.io实时推送项目中使用同步代码,推送项目应该是以中间件的身份出现的,只传输数据
高并发系统参数调整
以Linux为例子 调整文件句柄数
- 查看liunx 最大文件句柄数 cat /proc/sys/fs/file-max
- 查看进程使用的文件句柄数 ls /proc/pid/fd | wc -l
- 查看进程句柄数限制 cat /proc/pid/limits | grep “files”
- 修改/etc/sysctl.conf 添加 fs.file-max=1000000
0 0
- 高并发Nodejs参数调整
- linux服务器调整参数支持高并发
- 高并发下Linux内核参数调整
- nodejs经典高并发
- nodejs + nginx + redis cluster 高并发解决方案
- nodejs + nginx + redis cluster 高并发解决方案
- nginx 高并发配置参数
- nginx 高并发参数配置
- 高负载系统,网络参数调整
- 高负载系统,网络参数调整
- 高负载web服务器内核参数调整
- NodeJs与Redis实现高并发的队列存储
- NodeJS VS Tomcat搭建高并发静态文件服务器
- nodeJS express mysql 高并发时连接数不够用问题 以及如何处理高并发
- java 高并发参数调优
- nginx 高并发配置参数(转载)
- IIS 7.5 高并发参数配置
- nginx 高并发配置参数(转载)
- 转载:cassandra读写性能原理分析
- Git 合并时冲突 Merge Conflict:file still marked as conflicted 解决方法
- 年终总结
- css3动画 抖动效果
- ImageView功能
- 高并发Nodejs参数调整
- 利用hibernate建立底层数据的心得
- android日常开发总结的技术经验60条
- Android 自定义View (三) ProgressBar
- iOS Mac系统下Ruby环境安装
- atomikos的几个坑
- Too many open files 问题处理一例
- 自定义View -- 实现字符串按弧线位置显示
- GoogleCpp风格指南 5) 其他特性_part3