The following is excerpted from: http://blog.sina.com.cn/s/blog_658c8cea0101l2sw.html
Today's stress test, the beginning of a lot of anomalies, are java.net.NoRouteToHostException:Cannot assign requested address.
Through the online data, is due to the Linux allocation of the client connection port is exhausted, unable to establish a socket connection, although the socket gracefully shut down, but the port is not immediately released, but in the TIME_WAIT state, the default wait for 60s to release.
View the client connection port range supported by Linux, which is 28,232 ports:
Cat/proc/sys/net/ipv4/ip_local_port_range
32768-61000
Workaround:
1. Adjust the wait time after the low-end port release, the default is 60s, modified to 15~30s
Echo >/proc/sys/net/ipv4/tcp_fin_timeout
2. Modify the TCP/IP protocol configuration, by configuring/proc/sys/net/ipv4/tcp_tw_resue, default to 0, modify to 1, release time_wait port for new connection use.
Echo 1 >/proc/sys/net/ipv4/tcp_tw_reuse
3. Modify the TCP/IP protocol configuration, quickly reclaim the socket resource, default is 0, modify to 1.
Echo 1 >/proc/sys/net/ipv4/tcp_tw_recycle
The pressure test runs normally with the above 3 adjustments.
Java.net.NoRouteToHostException:Cannot Assign Requ