我在使用Jmeter运行负载测试时遇到java.net.SocketException:连接重置异常 [英] I m getting java.net.SocketException: Connection reset exception while running a load test using Jmeter

查看:738
本文介绍了我在使用Jmeter运行负载测试时遇到java.net.SocketException:连接重置异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在应用程序的登录页面上针对100个用户中的100个用户运行负载测试,20个用户正在传递其余80个用户,但我遇到以下异常,请帮助我解决问题

I m running a load test on login page of my application for 100 users out of 100 20 users are passing rest 80 users i m getting the below exception , Kindly help me with the fix

java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:166)
    at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:90)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:281)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:92)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:61)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
    at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:715)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:520)
    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:505)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:328)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1141)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1130)
    at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:431)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:258)
    at java.lang.Thread.run(Unknown Source)

推荐答案

我相信您正面临连接重置中描述的问题.从JMeter 2.10开始? JMeter Wiki页面.如果您完全确定,您的测试应用程序的行为是正确的,并且无需在后端进行任何调整或微调,则可以将JMeter配置为重试拒绝的连接并检查陈旧的连接:

I believe that you're facing the issue described in Connection Reset since JMeter 2.10 ? JMeter wiki page. If you're completely sure that the behavior of your application under test is correct and nothing needs to be tuned or tweaked on the backend side you can configure JMeter to retry refused connections and check for stale connections:

  1. 将所有HTTP请求采样器的实现"更改为HttpClient4.最简单的方法是使用 HTTP请求默认值配置元素.
  2. 在位于JMeter安装目录/bin文件夹下的 user.properties 文件中添加以下属性:

  1. Change "Implementation" of all your HTTP Request samplers to HttpClient4. The easiest way of doing it is using HTTP Request Defaults configuration element.
  2. Add the following properties in user.properties file which located under /bin folder of your JMeter installation:

httpclient4.retrycount=1
hc.parameters.file=hc.parameters

  • 将下一行添加到 hc.parameters 文件(相同位置,JMeter的/bin文件夹)

  • Add the next line to hc.parameters file (same location, JMeter's /bin folder)

    http.connection.stalecheck$Boolean=true
    

  • 重新启动JMeter.
  • 您的连接重置"问题应该消失了.

    Your "Connection reset" problem should go away.

    这篇关于我在使用Jmeter运行负载测试时遇到java.net.SocketException:连接重置异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆