问题:记一次性能测试中遇到的问题

请求:POST https://xxx.com/xx/xx

某次并发测试,在单次请求或者少量并发时正常,但在并发量大的时候却出现了问题

响应:Response code: Non HTTP response code: javax.net.ssl.SSLHandshakeException

Response message: Non HTTP response message: Remote host closed connection during handshake

后来由IT调整环境解决,具体怎么解决未说清楚(尝试了很多方法,最终it也不能确认是怎么解决的...)

响应:Response code: Non HTTP response code: java.net.SocketException

Response message: Non HTTP response message: Connection reset

响应:Response code: Non HTTP response code: java.net.SocketException

Response message: Non HTTP response message: Socket closed

服务端断开连接,但并没有通知客户端,导致下次请求该服务时httpclient继续使用该连接导致报错。

在JMeter下,发送http 请求时,默认选择了use keepAlive(Keep-Alive通俗地讲,就是所谓的持久连接,对于http这种大量的短连接的服务来说,开启持久连接的好处可节省大量的TCP连接过程的开销,据apache的官方文档称对包含大量图片的HTML文档造成的延时起到50%的加速作用),这个是连接协议,JMeter坑就在这里,默认勾选了这个(如果不勾选的话,也不会保存),但其配置JMeter.properties中的时间设置默认却是注销的,不会等待,一旦连接空闲,则立即断开了,导致压测中出现了事务失败的情形。

解决:修改httpclient4.idletimeout=<time in ms> 设置成自己觉得合理的时间,一般可设置成10-60s(表示连接空闲10s后才会断开),注意这边单位是ms。修改完成后再次压测,错误不再有了。

响应:Response code: 504

Response message: Gateway Time-out

(Nginx的nginx.conf中参数配置问题)

响应:Response code: Non HTTP response code: org.apache.http.NoHttpResponseException

Response message: Non HTTP response message: img.xxx.com:443 failed to respond

官网解释

org.apache.commons.httpclient.NoHttpResponseException:

In some circumstances, usually when under heavy load, the web server may be able to receive requests but unable to process them.A lack of sufficient resources like worker threads is a good example. This may cause the server to drop the connection to the client without giving any response. HttpClient throws NoHttpResponseException when it encounters such a condition. In most cases it is safe to retry a method that failed with NoHttpResponseException.

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乐乐Gold

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值