JMeter:java.net.NoRouteToHostException:无法分配请求的地址(地址不可用) [英] JMeter : java.net.NoRouteToHostException: Cannot assign requested address (Address not available)

查看:965
本文介绍了JMeter:java.net.NoRouteToHostException:无法分配请求的地址(地址不可用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个具有HelloController的简单Spring Boot应用程序.

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

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

现在,我已经创建了一个JMeter脚本,该脚本具有10万个并发用户,并点击了上述get API. 当我运行JMeter脚本时,经过30k计数后,我开始收到错误消息:

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?

  • 我正在使用具有8GB RAM的UBUNTU 18.04.
  • 在执行操作时,只有JMeter和STS处于打开状态.

推荐答案

您可以关注

You can follow Lakshmi Narayan answer to increase available ports:

解决方案:

Resolution:

  1. 使用以下命令增加本地端口范围:

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

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

这将允许更多本地端口可用.

This allows more local ports to be available.

  1. 启用如下所示的快速回收TIME_WAIT套接字:

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

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

默认情况下,

cat/proc/sys/net/ipv4/tcp_tw_recycle

cat /proc/sys/net/ipv4/tcp_tw_recycle

输出:0(默认情况下禁用)

Output : 0 (disabled by default)

在生产环境中启用时请务必谨慎,因为这是我们的 内部环境和机器仅用于Jmeter负载测试,我们 启用回收并解决了该问题.

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. 启用套接字的重用,如下所示:

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

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

默认情况下,

cat/proc/sys/net/ipv4/tcp_tw_reuse

cat /proc/sys/net/ipv4/tcp_tw_reuse

输出:0(默认情况下禁用)

Output : 0 (disabled by default)

注意:tcp_tw_reuse设置在环境中特别有用 在许多短连接处于打开状态并处于TIME_WAIT状态的情况下, 例如网络服务器.重复使用插座可以非常有效地 减少服务器负载.

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.

启用快速回收和重用后,服务器可以支持5K 用户使用单个Unix框加载.

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

这篇关于JMeter:java.net.NoRouteToHostException:无法分配请求的地址(地址不可用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆