背景:公司模型框架是Nginx+uwsgi+Django+nginx,一开始使用Jmeter进行高并发请求测试,发现成功率只有50%,换用postman,成功率100%,代码进行高并发一样不会报错。

问题:

Jmeter进行高并发,第一个接口成功,第二个失败,第三个又成功,第四个失败。。。依次类推,保持50%的失败率,失败报错如下:

org.apache.http.NoHttpResponseException: **.**.**.***:***** failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:)
at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:)
at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:)
at org.apache.jmeter.protocol.http.sampler.hc.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:)
at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.receiveResponseHeader(MeasuringConnectionManager.java:)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:)
at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:)
at java.lang.Thread.run(Thread.java:)

因为模型接口是用python写的,报错代码显示java,所以一开始认为是Jmeter的问题,换了一个工具,postman,进行并发测试,果然没有抛错,但是学无止境,作为一个优秀的测试工具,不应该有这个问题啊,所以继续挖掘解决方案。

解决方案:

取消勾选Use Keep-alive,这样连接就不会复用,也就不存在空闲超时,被服务端干掉的情况了。

但带来的是性能的开销,因为tcp每次都要关闭然后重建。

参考:

https://blog.csdn.net/z_erduo/article/details/81084003

[Jmeter并发报错解决方案]org.apache.http.NoHttpResponseException: 10.0.4.147:8000 failed to respond的更多相关文章

  1. 【异常(待解决)】org.apache.http.NoHttpResponseException: api.weixin.qq.com:443 failed to respond

    一.记录下异常堆栈信息 -- ::-exec-] ERROR weixin.popular.client.LocalHttpClient - execute error org.apache.http ...

  2. org.apache.http.NoHttpResponseException: XX.XX.XX.XX:80 failed to respond

    解决: Finally I fix the issue and it is caused by buffer size. By default, buffer size of httpclient i ...

  3. Jmeter启动报错解决方案

    安装好jmeter之后在启动Jmeter的过程中出现了如下的报错信息(大部分的原因是配置不对): /usr/local/Cellar/jmeter/5.1.1/libexec/bin/jmeter: ...

  4. pip安装selenium时,报错“You are using pip version 10.0.1, however version 18.0 is available.”的问题

    pip安装selenium,pip install selenium 类型这样错误 1  原因可能不是以管理员身份运行cmd安装selenium 2  解决方式 也是要管理员身份运行 重点在最后一句 ...

  5. 解决Python3.7安装pygame报错You are using pip version 10.0.1, however version 19.1 is available.

    背景: 学习python开发中,需要用到pygame插件,因此按照参考书<Python编程实践,从入门到实践>指引安装Pygame包. 但是利用pip 命令安装 .whl 文件时,报错(如 ...

  6. nginx报错[error] CreateFile() "D:\Java-windows\nginx-1.16.0/logs/nginx.pid" failed (2: The system cannot find the file specified)

    无论是nginx -s stop还是nginx -s reload命令,都会出现这个错误. 解决方法:使用命令创建/logs/nginx.pid文件,命令如下所示: nginx -c conf/ngi ...

  7. JMeter 报告监听器导入.jtl结果文件报错解决方案

    JMeter 报告监听器导入.jtl结果文件报错解决方案   by:授客 QQ:1033553122   1. 问题描述 把jmeter压测时生成的 .jtl结果文件导入监听器报告中,弹出如下错误提示 ...

  8. 转: CentOS上安装LAMP之第一步:Apache环境及安装过程报错解决方案(纯净系统环境)

    传送门:http://blog.csdn.net/zhangatle/article/details/77416996  小心坑!填完就懂怎么安装了 Note:要从零开始搭建,就不要嫌中间遇到各种问题 ...

  9. 性能测试分享:Jmeter的api监控工具解决方案

    性能测试分享:Jmeter的api监控工具解决方案 poptest是国内唯一一家培养测试开发工程师的培训机构,以学员能胜任自动化测试,性能测试,测试工具开发等工作为目标.如果对课程感兴趣,请大家咨询q ...

随机推荐

  1. 为网页元素增加resize事件

    默认只有window支持resize事件,但有时我们需要为div等元素添加resize事件 代码见下面,原理是在元素内添加一个内嵌html,然后监听这个内嵌html的resize事件 import { ...

  2. std::vector的内存释放

    先上一段代码 using namespace std; class A{ public: ~A(){ cout << "deconstruct"; }; }; #inc ...

  3. js 对象数组删除和查找的方法

    deleteItem: function (array,item) { const index = this.array.findIndex(text => text.name === item ...

  4. HDU 5724 Chess(SG函数)

    Chess Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submi ...

  5. 自动下单tomcat版本问题

    \xalan\xalan,jar找不到是因为spring boot 中使用的是tomcat8.5,从platform依赖进来的运行时环境是tomcat8,导致覆盖原来的依赖,在platform中移除S ...

  6. 两个List中的补集

    /** * 获取两个List的不同元素 * @param list1 * @param list2 * @return */ private static List getDiffrent(List ...

  7. BZOJ 4028: [HEOI2015]公约数数列 【分块 + 前缀GCD】

    任意门:https://www.lydsy.com/JudgeOnline/problem.php?id=4028 4028: [HEOI2015]公约数数列 Time Limit: 10 Sec   ...

  8. Msql数据库连接写一个共有的连接工具

    为了避免在每一个DAO中都需要自行连接connection,有多个DAO里都需要获取数据库的连接,并且在很多项目中都是一样的数据库连接. 所以就可以把获取数据库连接的代码重构到一个类里. 这样做的好处 ...

  9. P1018 乘积最大(高精度加/乘)

    P1018 乘积最大 一道dp题目.比较好像的dp题目. 然而他需要高精度计算. 所以,他从我开始学oi,到现在.一直是60分的状态. 今天正打算复习模板.也就有借口解决了这道题目. #include ...

  10. Subclass UICollectionViewFlowLayout,自定义流布局

    需求:为实现第一行显示一个,第二行以后显示两个 方案1:用系统自带的流布局,实现的效果是,若第二行只有一个,则系统默认会居中显示,不是左对齐(如下图),不符合项目要求. 方案2:自定义系统的UICol ...