The pressure test httpclient reports Cannot assign requested address

 

 

 

 

The client frequently connects to the server. Because each connection ends in a very short time, resulting in a lot of TIME_WAIT, so that the available port number is used up, so the new connection cannot bind the port, that is, "Cannot assign requested" address". It's a client-side problem, not a server-side problem. Through netstat, I do see a lot of connections in the TIME_WAIT state.

The client side frequently establishes connections, but the port release is slow, resulting in no available ports when establishing new connections.

 

Port occupation

netstat -anp | grep 8080

Number of ports occupied

netstat -an | grep 8080 | wc -l

 

Modify the following 2 kernel parameters (requires root privileges) 

sysctl -w net.ipv4.tcp_timestamps=1 Enable support for TCP timestamps. If this item is set to 0, the following settings will not work

sysctl -w net.ipv4.tcp_tw_recycle=1 means to enable fast recycling of TIME-WAIT sockets in TCP connections

 

 

sysctl is an interface that allows you to make changes to a running Linux system. It includes some advanced options for the TCP/IP stack and virtual memory system, which allow experienced administrators to improve system performance impressively. More than five hundred system variables can be read and set with sysctl. Based on this, sysctl(8) provides two functions: reading and modifying system settings

 

 

 

 

 

 

 

 

 

 

 

 

 

Donate to developers 

Driven by interest, I write 免费something with joy and sweat. I hope you like my work and can support it at the same time. Of course, if you have money to support a money field (support Alipay, WeChat, and the buckle group), if you have no money to support a personal field, thank you.

 

Personal homepage : http://knight-black-bob.iteye.com/



 
 
 Thank you for your sponsorship, I will do better!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326487561&siteId=291194637