在使用ApacheJMeter进行压力测试期间,随机连接拒绝响应

在使用ApacheJMeter进行压力测试期间,随机连接拒绝响应,jmeter,Jmeter,我的pc上有ApacheJ Meter工具,我正试图强调我的应用程序部署在GKE上 同时或按顺序发送一些请求,我注意到有线性能 例如,如果我在其中一个端点发出100个请求,而大多数请求都是成功的,那么来自100的3或4个请求可能会返回以下消息: org.apache.http.conn.HttpHostConnectException: Connect to 35.246.108.130:31225 [/35.246.108.130] failed: Connection refused: co

我的pc上有ApacheJ Meter工具,我正试图强调我的应用程序部署在GKE上

同时或按顺序发送一些请求,我注意到有线性能

例如,如果我在其中一个端点发出100个请求,而大多数请求都是成功的,那么来自100的3或4个请求可能会返回以下消息:

org.apache.http.conn.HttpHostConnectException: Connect to 35.246.108.130:31225 [/35.246.108.130] failed: Connection refused: connect
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$JMeterDefaultHttpClientConnectionOperator.connect(HTTPHC4Impl.java:404)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    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:935)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:646)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285)
    at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638)
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
    ... 19 more
此外,如果测试由不同的主机执行,返回错误的请求数可能不同(更小或更大)


您知道是什么导致了这个问题吗?

知道您正在执行压力测试,一个可能的解释可能是您的应用程序在该特定实例上崩溃并重新启动<代码>连接被拒绝当没有应用程序侦听传入请求时,通常会引发错误

有关stackoverflow线程的更多详细信息


请检查是否有任何APM软件正在运行以获取应用程序日志。您将得到更多关于此时发生的事情的提示。

您不应该使用JMeter GUI执行压力测试,请使用clip。非常感谢您的回答!问题是,依次运行100个请求时,apache服务器会回答大部分请求,并选择使用随机preferencd拒绝其中的3或4个请求。如果服务器不可用,我想它永远不会应答。而且,如果我快速增加请求的并发性,它似乎无法成功地响应任何请求。它可能需要更多的资源吗?apache服务器(或任何其他web服务器)在崩溃时自动重启,因此具有弹性。增加并发请求表示资源不足以满足传入请求。但这可能不是原因。您可能会遇到“内存不足”异常,这可能是代码问题。在测试期间检查系统内存使用模式,并检查cpu。这些都是关于服务器上真正发生的事情的好提示是的,我已经做过了。看来这并不能解决任何资源短缺的问题。此外,apache k8s pod似乎还没有重新启动。