Recently, when using jmeter for stress testing, I found a problem. When the thread continues to rise to a certain value, an error is reported: java.net.BindException: Address already in use: connect, as shown in the following figure:
Reason: Windows provides 1024-5000 ports for TCP / IP links, and it takes four minutes to recycle them, which causes us to fill up the port when running a large number of requests in a short period of time, resulting in the error reported above.
There are currently two solutions:
Solution one: .
Modify Jmeter configuration items
If Use KeepAlive is not checked, the configuration is checked by default. After removing the check, the request becomes a short connection. (What is the long connection short connection can refer to: https://www.cnblogs.com/zzcsza/p/12688956.html)
Solution two: .
Modify the operating system registry
- Open the registry: ctrl + r enter regedit
- Enter-Computer \ HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters
- New DWORD value, name: TcpTimedWaitDe, value: 30 (decimal) is set to 30 seconds
- New DWORD value, name: MaxUserPort, value: 65534 (decimal) maximum number of connections 65534
- Restart the computer