最近我正在研究测试第三方服务的性能脚本。
测试非常简单,每个线程都需要POST一个请求。 线程数 - 100, 加速 - 680秒
执行最大活动线程数为12。 我使用的是Jmeter 3.2版本,但也试过2.1。
不幸的是,我获得了java.net.SocketException
:20-30%请求的连接重置错误。帖子结尾处的完整错误。
我已经在这里更改了许多类似主题中提到的属性(例如:I m getting java.net.SocketException: Connection reset exception while running a load test using Jmeter)。
我已添加:
httpclient4.retrycount=1
hc.parameters.file=hc.parameters
用户属性中的
http.socket.timeout$Integer=120000 (such big value is set just for test reasons ;) )
http.connection.stalecheck$Boolean=true in hc.parameters
httpclient.timeout=1200000
httpclient4.idletimeout=1200000 (same as previous) in jmeter.properties
我还在“高级”标签中将HTTP请求采样器默认值更改为:
HTTPClient4
并将两次超时设置为120000
。
注意:如此大的测试超时与某些请求在服务端(甚至10分钟)的时间有关。
不幸的是,在所有这些变化之后,我仍然得到这个错误并且负责该服务的人在分析后回答说他们没有任何帮助。
完整错误:
java.net.SocketException: Connection reset;
at java.net.SocketInputStream.read(Unknown Source);
at java.net.SocketInputStream.read(Unknown Source);
at sun.security.ssl.InputRecord.readFully(Unknown Source);
at sun.security.ssl.InputRecord.read(Unknown Source);
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source);
at sun.security.ssl.SSLSocketImpl.readDataRecord(Unknown Source);
at sun.security.ssl.AppInputStream.read(Unknown Source);
at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:158);
at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:82;
at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:271);
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138);
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.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281);
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:257);
at org.apache.jmeter.protocol.http.sampler.hc.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:199);
at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.receiveResponseHeader(MeasuringConnectionManager.java:212);
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.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:684);
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:486);
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835);
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83);
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:654);
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:413);
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74);
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1189);
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1178);
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:491);
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:425);
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254);
at java.lang.Thread.run(Unknown Source);
答案 0 :(得分:0)
首先使用JMeter 3.2版本。
然后首先手动尝试网站,它是否正常工作?
如果是,请运行带有1个线程的JMeter并检查,如果发生连接重置,那么您很可能不会以相同的方式再现浏览器的功能。在这种情况下,请记录并重试。
如果只有许多用户才会这样做,那么由于问题或配置错误,您的服务器会拒绝连接。