简体   繁体   English

JMeter:java.net.NoRouteToHostException:无法分配请求的地址(地址不可用)

[英]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?我该如何解决这个问题?

  • I'm using UBUNTU 18.04 with 8gb RAM.我正在使用带有 8GB RAM 的 UBUNTU 18.04。
  • While performing the operation, only JMeter and STS was open.在执行操作时,只有 JMeter 和 STS 处于打开状态。

You can follow Lakshmi Narayan answer to increase available ports:您可以按照Lakshmi Narayan 的回答来增加可用端口:

Resolution:解析度:

  1. 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.这允许更多本地端口可用。

  1. 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 负载测试,我们启用了回收并解决了问题。

  1. 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.

相关问题 什么是“ java.net.NoRouteToHostException:无法分配请求的地址”? - What is “java.net.NoRouteToHostException: Cannot assign requested address”? 高负载下的HttpURLConnection给出异常NoRouteToHostException无法分配请求的地址 - HttpURLConnection on high load gives exception NoRouteToHostException Cannot assign requested address java.net.BindException:无法在Heroku上分配请求的地址 - java.net.BindException: Cannot assign requested address on Heroku 遇到 java.net.bindexception 的问题无法分配请求的地址 - Problem running into java.net.bindexception cannot assign requested address 连接时,Zookeeper java.net.NoRouteToHostException - Zookeeper java.net.NoRouteToHostException when connecting java.net.BindException:无法分配请求的地址 - java.net.BindException: Cannot assign requested address 异常:java.net.BindException:无法分配请求的地址 - Exception : java.net.BindException: Cannot assign requested address 无法分配请求的地址 - Cannot assign requested address Selenium RemoteWebDriver I / O异常java.net.NoRouteToHostException - Selenium RemoteWebDriver I/O Exception java.net.NoRouteToHostException Java-java.net.NoRouteToHostException:没有路由到主机:连接 - Java - java.net.NoRouteToHostException: No route to host: connect
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM