在使用 jmeter 进行压力测试期间 Apache httpd 连接被拒绝

Apache httpd connection refused during stress test using jmeter

现在,我在windows(jmeter.bat)中使用jemter进行压力测试。

Number of Threads = 100
Ramp-up period = 0 
Loop count = 1000

但是在 20~30 秒后在 jmeter 中引发连接被拒绝错误。 我在 /usr/local/apache/logs/error.log 或 /usr/local/apache/logs/access.log 中找不到连接被拒绝的错误。

测试是 HTTP GET,index.html("It's works") Apache MPM 正在运行,设置如下:

<IfModule mpm_worker_module>
StartServers            8
MinSpareThreads         64
MaxSpareThreads        1024 
ThreadsPerChild         64
MaxRequestWorkers       512
MaxConnectionsPerChild   0

jmeter问题?任何 apache 设置问题?

jmeter 异常如下:

org.apache.http.conn.HttpHostConnectException: Connection to https://checkout.teledit.com refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:190)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.open(MeasuringConnectionManager.java:107)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:643)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:517)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:331)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:434)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
at java.lang.Thread.run(Unknown Source)

Caused by: java.net.ConnectException: Connection timed out: 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 sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:414)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
... 14 more

这不是 jmeter 问题:

  • 检查 jmeter 和 apache 之间的组件(防火墙、负载均衡器、ddos 保护...)

  • 检查 apache 设置,慢慢检查这个 rampup,看看你从哪个负载开始得到这些错误。