[英]JMeter : java.net.NoRouteToHostException: Cannot assign requested address (Address not available)
I have created a simple Spring boot Application having a HelloController.我创建了一个简单的 Spring Boot 应用程序,它有一个 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.现在我创建了一个 JMeter 脚本,有 10 万并发用户点击上述 get API。 When I run the JMeter Script, after 30k count, I start getting the error:
当我运行 JMeter 脚本时,在 30k 计数后,我开始收到错误消息:
java.net.NoRouteToHostException: Cannot assign requested address (Address not available)
What is the reason for this?这是什么原因? How can I resolve this issue?
我该如何解决这个问题?
You can follow Lakshmi Narayan answer to increase available ports:您可以按照Lakshmi Narayan 的回答来增加可用端口:
Resolution:
解析度:
- Increased the local port range using below command:
使用以下命令增加本地端口范围:
echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range
回声 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range
This allows more local ports to be available.
这允许更多本地端口可用。
- Enable fast recycling TIME_WAIT sockets as below:
启用快速回收 TIME_WAIT 套接字如下:
$ sudo sysctl -w net.ipv4.tcp_tw_recycle=1
$ sudo sysctl -w net.ipv4.tcp_tw_recycle=1
By default,
默认情况下,
cat /proc/sys/net/ipv4/tcp_tw_recycle
cat /proc/sys/net/ipv4/tcp_tw_recycle
Output : 0 (disabled by default)
输出:0(默认禁用)
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.
如果在生产环境中启用请谨慎,因为这是我们的内部环境和机器仅用于 Jmeter 负载测试,我们启用了回收并解决了问题。
- Enable reuse of sockets as below:
启用套接字的重用如下:
$ sudo sysctl -w net.ipv4.tcp_tw_reuse=1
$ sudo sysctl -w net.ipv4.tcp_tw_reuse=1
By default,
默认情况下,
cat /proc/sys/net/ipv4/tcp_tw_reuse
cat /proc/sys/net/ipv4/tcp_tw_reuse
Output : 0 (disabled by default)
输出:0(默认禁用)
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.
注意:tcp_tw_reuse 设置在大量短连接打开并处于 TIME_WAIT 状态的环境中特别有用,例如 Web 服务器。 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.
启用快速回收和重用后,服务器可以支持单个 Unix 盒 5K 用户负载。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.