jmeter web压测临时端口耗尽解决办法

3月 14, 2019 |

Windows cmd->regedit
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
add MaxUserPort (DWORD) =65534
add TcpTimedWaitDelay(DWORD) = 30 //TIME_WAIT时长

java.net.SocketException: Connection reset
at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394)

如果windows 客户端和服务器的时间不一致也会抛出这个异常, 因为端口重用需要校验时间戳。
linux

vi /etc/sysctl.conf need reboot
net.ipv4.tcp_max_tw_buckets = 30000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
---- or
/sbin/sysctl -w net.ipv4.tcp_tw_recycle=1
/sbin/sysctl -w net.ipv4.tcp_tw_reuse=1
/sbin/sysctl -w net.ipv4.tcp_max_tw_buckets=30000

参考文档

solved-java-net-bindexception-address-use-connect-issue-windows
apache-multiple-requests-with-jmeter
2014-tcp-time-wait-state-linux

Posted in: JMeter

Comments are closed.