JMeter : java.net.NoRouteToHostException: Cannot assign requested address (Address not available)

99封情书 提交于 2020-03-18 11:38:06

问题


I have created a simple Spring boot Application having a HelloController.

Get API: http://localhost:8080/hello
Response: Hello World 

Now I have created a JMeter Script having 0.1 million concurrent users hitting the above get API. When I run the JMeter Script, after 30k count, I start getting the error:

java.net.NoRouteToHostException: Cannot assign requested address (Address not available)

What is the reason for this? How can I resolve this issue?

  • I'm using UBUNTU 18.04 with 8gb RAM.
  • While performing the operation, only JMeter and STS was open.

回答1:


You can follow Lakshmi Narayan answer to increase available ports:

Resolution:

  1. Increased the local port range using below command:

echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range

This allows more local ports to be available.

  1. Enable fast recycling TIME_WAIT sockets as below:

$ sudo sysctl -w net.ipv4.tcp_tw_recycle =1

By default,

cat /proc/sys/net/ipv4/tcp_tw_recycle

Output : 0 (disabled by default)

Be cautious if enabled in production environments, since this is our internal Environment and machine used only for Jmeter load tests, we enabled recycle and resolved the issue.

  1. Enable reuse of sockets as below:

$ sudo sysctl -w net.ipv4.tcp_tw_reuse=1

By default,

cat /proc/sys/net/ipv4/tcp_tw_reuse

Output : 0 (disabled by default)

Note: The tcp_tw_reuse setting is particularly useful in environments where numerous short connections are open and left in TIME_WAIT state, such as web servers. Reusing the sockets can be very effective in reducing server load.

After enabling fast recycling and reuse the server could support 5K user Load with single Unix box.



来源:https://stackoverflow.com/questions/53189126/jmeter-java-net-noroutetohostexception-cannot-assign-requested-address-addre

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!