Non HTTP response code: java.net.NoRouteToHostException/Non HTTP response message: No route to host (Host unreachable)

huangapple go评论50阅读模式
英文:

Non HTTP response code: java.net.NoRouteToHostException/Non HTTP response message: No route to host (Host unreachable)

问题

有一个在JMeter中的Thread Group,其中包含多个HTTP请求。在分布式测试环境中以更多线程执行时,结果中会出现大量的“主机不可达”错误。

非HTTP响应代码: java.net.NoRouteToHostException/非HTTP
响应消息: 主机不可达 (主机不可达)

所有错误中的70%都是由这个错误消息引起的。这可能是由防火墙或速率限制器引起的吗?

英文:

I have a Thread Group in JMeter with multiple HTTP requests. When it is executed on higher number of threads in a distributed testing environment there are a lot of Host unreachable errors in results.

> Non HTTP response code: java.net.NoRouteToHostException/Non HTTP
> response message: No route to host (Host unreachable)

70% of all the errors are caused by this error message.Could it be caused by a firewall or rate limiter?

答案1

得分: 1

根据异常描述:

> 在尝试连接套接字到远程地址和端口时发生错误。通常,由于中间防火墙或中间路由器宕机,无法到达远程主机。

如果仅在负载下发生,我可以考虑两种可能情况(或它们的组合):

  1. 您的测试系统无法处理如此多的并发用户,相关应用程序关闭或变得无响应,HTTP请求采样器无法访问它。

    • 检查测试系统日志
    • 检查其在CPU、RAM等方面是否有足够的余地运行。如果您没有更好的监控解决方案,可以使用JMeter PerfMon插件
  2. 存在一个路由器交换机认为这个流量异常并阻止访问。

您还可以通过将下一行添加到log4j2.xml文件来启用JMeter的HttpComponents的调试日志记录:

<Logger name="org.apache.http" level="debug" />

然后查看jmeter.log文件,它应该包含来自网络层的更多信息

英文:

As per exception description:

>Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the remote host cannot be reached because of an intervening firewall, or if an intermediate router is down.

If it happens only under the load I can think of 2 possible cases (or combination):

  1. Your system under test cannot handle that many concurrent users, the related application shuts down or becomes unresponsive and HTTP Request samplers cannot reach it.

    • check system under test logs
    • check whether it has enough headroom to operate in terms of CPU, RAM, etc. If you don't have better monitoring solutions you can use JMeter PerfMon Plugin
  2. There is a router or switch which considers this traffic as anomaly and blocks the access.

You can also enable debug logging for JMeter's HttpComponents by adding the next line to log4j2.xml file:

<Logger name="org.apache.http" level="debug" />

and then take a look at jmeter.log file, it should contain more information from the network level

答案2

得分: 1

如果您能够成功执行小吞吐量的负载测试,但在尝试将测试扩展到更高吞吐量(即更大负载)时出现“主机不可达”错误,有几个要考虑的因素:

  • 如果您在本地运行负载测试而没有出现这些错误,但在使用云负载提供商运行具有相同更高吞吐量的负载测试时出现这些错误,请考虑以下原因:

    1. 目标测试应用程序的网络带宽已被耗尽。特别是如果这些错误发生在测试的后期或吞吐量增加的地方,请考虑此情况。
    2. 从负载生成器实例(例如,在AWS或Azure上运行的虚拟机被列入ACL、请求限制上限、阻止来自相同端点的请求过多的规则、标记为可疑流量等)进行了路由规则。
  • 如果在相同环境中以更高吞吐量运行测试时遇到这些错误,请考虑以下原因:

    1. 本地计算机无法处理更高的吞吐量,可能是由于本地计算机资源不足(CPU、内存等)。
    2. 本地计算机的网络带宽已被耗尽,因此无法完成请求路由。
    3. 本地计算机与目标测试应用程序之间的网络带宽容量已经耗尽。
    4. 存在阻止请求的路由规则(例如,请求限制上限、阻止来自相同端点的请求过多的规则、标记为可疑流量等)。
  • 在任何情况下,导致错误的原因可能是目标测试应用程序因请求过多而不堪重负。 如果您的目标是通过探测应用程序的破裂点来测试最大负载,那么这将被视为负载测试的积极和期望的终点。

请注意,并非所有这些原因都一定指向您的测试存在问题。根据您的测试目标,遇到这些错误可能是预期的结果。如果您遇到了本地计算机资源有限或本地网络带宽有限的情况,云负载测试提供商可能具有优势,因为几乎可以获得无限的资源。在这种情况下,阅读更多关于在云中扩展负载测试的信息可能会有帮助。

英文:

If you are able to successfully execute your load test with a small throughput, however you are receiving Host Unreachable errors when attempting to scale your test to higher throughputs (i.e., higher loads), there are several things to consider:

  • If you are running your load test locally without these errors, however they appear when you run your load test through a cloud-based load provider with the same or higher throughput, consider the following causes:

    1. Network bandwidth to the target test application has been exceeded. Consider this especially if the these errors occur later in the test or at a point where throughput is increased.
    2. Routing rules are in place from load generator instances (e.g., VMs running on AWS or Azure are blacklisted on an ACL, request limit cap, rules preventing too many requests from same endpoint, traffic flagged as suspicious, etc.).
  • If you are encountering these errors when running your test from the same environment, only with a higher throughput, consider the following causes:

    1. The local machine cannot handle the higher throughput, due to either insufficient local machine resources (CPU, memory, etc.).
    2. The local machine network bandwidth has been exceeded and therefore request routing cannot complete.
    3. Network bandwidth capacity between the local machine and the target test application has been exceeded.
    4. Routing rules are in place preventing requests (e.g., request limit cap, rules preventing too many requests from same endpoint, traffic flagged as suspicious, etc.)
  • In either case, the cause of your errors may be due to your target test application becoming overwhelmed with requests. If your objective is to test for maximal load by probing the breaking point of your application, then this would be considered a positive and desired endpoint for your load test.

Note that not all of these causes necessarily point to a problem with your test. Depending on your test objectives, encountering these errors can be an expected outcome. This is especially true if the objective of your test is to test the maximal load your target test application can support. In the event you are encountering limited local machine resources or local network bandwidth, cloud-based load testing providers can be advantageous in that nearly unlimited resources are available. Reading more about scaling your load test in the cloud may be useful in this case.

huangapple
  • 本文由 发表于 2023年7月17日 14:41:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76702031.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定