JMeter:如何知道java.net.SocketTimeoutException 的原因?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24599298/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 13:21:40  来源:igfitidea点击:

JMeter: How to know the reason of java.net.SocketTimeoutException?

javatestingjmeterload-testingsocket-timeout-exception

提问by Mahmoud Saleh

i am making load test for my web application, and i set the connect timeout and response timeout to be 20 seconds, and sometimes i am getting exceptions like:

我正在为我的 Web 应用程序进行负载测试,并将连接超时和响应超时设置为 20 秒,有时我会遇到如下异常:

Non HTTP response code: java.net.SocketTimeoutException: Non HTTP response message: Read timed out

i get the above exception in JMeter test result, and there are no errors thrown in my application, and no stacktrace available to trace the exception.

我在 JMeter 测试结果中得到上述异常,并且我的应用程序中没有抛出错误,也没有可用的堆栈跟踪来跟踪异常。

i want to know what is the cause of the message: the app is waiting for something to process or Slow SQL or Hung thread or application is refusing connections because maxed out ?

我想知道消息的原因是什么:应用程序正在等待处理某些事情或慢 SQL 或挂起线程或应用程序拒绝连接,因为已达到极限?

please advise how can i know the reason for this exception and how to fix it.

请告知我如何知道此异常的原因以及如何修复它。

回答by eugene.polschikov

I would recommend you improve debugging activities (in jMeter) in the following way:

我建议您通过以下方式改进调试活动(在 jMeter 中):

  • try to add debug postprocessor to your http sampler
  • 尝试将调试后处理器添加到您的 http 采样器

debugPostProcessor

调试后处理器

  • launch log viewer (jMeter log viewer before any http sampler(-s)/script(-s) execution
  • 启动日志查看器(在任何 http 采样器(-s)/脚本(-s)执行之前的 jMeter 日志查看器)

log viewer

日志查看器

probably this could help you to figure out why you're facing socket timeout. Hope this helps you.

可能这可以帮助您弄清楚为什么您面临套接字超时。希望这对你有帮助。