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

标签 java performance spring-boot jmeter load-testing

我创建了一个带有 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 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.

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

相关文章:

java - Gradle 在单元测试期间运行 flywayMigration

java - 仅当不直接扩展 RecyclerView 时才会出现 InflateException

javascript - 使用键与条件语句获取值

java - 按计划运行 "jmap -histo:live"来触发垃圾回收是否安全(或者是个好主意)?

hibernate - CRUD 存储库不遵守 UNIQUE 约束

java - 配置 Jersey 时,Spring Boot HandlerInterceptor 没有触发?

java - 将 Jython 与 M2Eclipse 结合使用

java - 在另一台服务器上创建文件

java - 员工排类实体关系

performance - 通用多面体内的长方体