gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-31 19:42:58 25 4
gpt4 key购买 nike

我创建了一个带有 HelloController 的简单 Spring 启动应用程序。

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

现在我已经创建了一个 JMeter 脚本,它有 10 万并发用户点击上面的获取 API。当我运行 JMeter 脚本时,在 30k 计数后,我开始收到错误:

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

这是什么原因?我该如何解决这个问题?

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

最佳答案

可以关注Lakshmi Narayan answer增加可用端口:

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 ourinternal Environment and machine used only for Jmeter load tests, weenabled 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 environmentswhere numerous short connections are open and left in TIME_WAIT state,such as web servers. Reusing the sockets can be very effective inreducing server load.

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

关于java - JMeter : java.net.NoRouteToHostException:无法分配请求的地址(地址不可用),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53189126/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com