秒级百万压测
压力测试工具:
Apache JMeter
运行 apache-jmeter-5.4.1\bin\jmeter.bat
配置 linux 系统连接数
ulimit -n 200000 备注 没用
使用修改文件方式
vim /etc/security/limits.conf
* soft nofile 200000
* hard nofile 200000
调优:NGINX 配置
# 线程数 自动
worker_processes auto;
events {
# 工作连接数 增加至 20w
worker_connections 200000;
# 收到新连接通知后接受尽可能多的连接
multi_accept on;
# 作用于event的I/O多路复用模型 linux独有内核
use epoll;
}
http {
# 保持会话时长 0 默认65 与 请求头 Connection close 同等
keepalive_timeout 0;
}