Java.net.NoRouteToHostException:Cannot Assign Requ

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.