首页 > 解决方案 > org.apache.http.NoHttpResponseException:服务器地址:80 未能响应 - JMeter

问题描述

我正在 Web 应用程序上使用 Jmeter 5.2 运行负载测试。当我运行线程组时,即使线程数超过 500,我也会做一些配置 jmeter:在 user.properties 中我设置了:httpclient4.retrycount=1

hc.parameters.file=hc.parameters

在 hc.parameters 我设置了:

http.connection.stalecheck$Boolean=true

并在 Http 请求中:客户端实现 > httpClient4

 org.apache.http.NoHttpResponseException: server-address:80 failed to respond
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
        at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
        at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
        at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
        at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
        at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:850)
        at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:561)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:67)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1282)
        at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1271)
        at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:627)
        at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:551)
        at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:490)
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
        at java.lang.Thread.run(Unknown Source)

知道如何解决这个问题!

标签: javatestingjmeter

解决方案


很可能您的应用程序过载,因此它无法处理 500 个并发连接,您需要检查以下内容:

  1. 您的应用程序服务器配置,即增加最大传入连接数
  2. 您在 CPU、RAM、可用网络套接字等方面的后端健康状况,可以使用JMeter PerfMon 插件来完成
  3. 您的应用程序配置(连接池、数据库配置等),因为它可能没有针对高负载进行适当调整

推荐阅读