我试图通过JMeter对我的应用程序进行性能测试。当我增加线程(用户)的数量超过100时,我得到这些错误。请帮助我解决这个问题。
NB: This was working fine until i increased the no: of threads to 25000.
Docker container is up and accepting connections(working fine with Postman)
[enter image description here][1]
[enter image description here][2]
[enter image description here][3]
org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:8080 [/127.0.0.1] failed: Connection refused (Connection refused)
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(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:607)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
... 19 more
[1]: https://i.stack.imgur.com/Z6b1h.png
[2]: https://i.stack.imgur.com/JDWYa.png
[3]: https://i.stack.imgur.com/4Qtrx.png
2条答案
按热度按时间g6ll5ycj1#
我认为您的“性能测试”没有多大意义,因为:
1.您在同一台机器上运行JMeter和被测系统,这两者都可能非常耗费资源,而且由于race conditions的原因,结果也不可靠
1.您在GUI模式下运行测试,用于测试开发和调试,当涉及到测试执行时,您应该是running your JMeter tests in command-line non-GUI mode
1.您正在未连接电源的笔记本电脑上运行测试,因此省电模式很可能会导致CPU节流
1.您启用了许多监听器,这些监听器不会增加任何价值,而只是消耗资源
回到你的问题,我可以想到两个可能的原因:
1.您已超过目标Web服务器上的最大打开连接数,请查看后端HTTP服务器文档以确定如何增加打开连接数
1.您已超出操作系统级别的maximum number of open connections限制,请检查当前限制,并根据您的测试方案进行修改。
vsnjm48y2#
看起来您基本上是在对自己的服务器进行DoS攻击。
1.检查服务器配置的并发性(例如Tomcat有“maxThreads”。Apache可能启用了MPM)
1.检查您的JMeter测试是否产生合理的负载。1个线程是否代表1个用户?如果是,这些用户是否在请求之间暂停?(在JMeter中使用随机等待)