MAC 下通过 jmeter对spring boot 程序进行压测
-
问题描述:无论指定线程数为多少,运行一段时间(5-20秒)左右,jmeter就会卡死,过一段时间(15-20秒)恢复,如此往复,更换JDK版本,增大MAC的文件描述符大小都没有效果.
-
解决方法:
-
首先排除代码问题,同样的代码windows工作正常.怀疑是系统哪里被限制(参考Linux增大了文件打开数量,但还是不行.)
-
偶然间通过brew 安装siege,安装完毕有如下提示:
macOS has only 16K ports available that won't be released until socket
TIME_WAIT is passed. The default timeout for TIME_WAIT is 15 seconds.
Consider reducing in case of available port bottleneck.
You can check whether this is a problem with netstat:
# sysctl net.inet.tcp.msl
net.inet.tcp.msl: 15000
# sudo sysctl -w net.inet.tcp.msl=1000
net.inet.tcp.msl: 15000 -> 1000
Run siege.config to create the ~/.siegerc config file.
- 解决方案是按照上面的命令去执行,或者直接编辑 /etc/sysctl.conf文件加入相同的内容,我这里把15秒改为200毫秒,基本就没有问题了.