在 Apache JMeter 中配置响应超时 [英] Configuring response timeout in Apache JMeter

查看:57
本文介绍了在 Apache JMeter 中配置响应超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试检查特定 HTTP 请求的响应时间是否超过 30 秒,如果超过,则将其标记为失败并停止线程.有时我会看到响应时间接近 80 秒,没有浏览器在等待来自服务器的响应那么长时间.

我发现了以下三种在 JMeter 中设置超时值的方法,但是这让我很困惑,因为有多种选择,我不知道该使用哪一种,或者它们之间是否有任何区别.

以下是我发现的与响应超时相关的选项:

  1. 在采样器中设置响应超时值
  2. 添加持续时间断言


3. 在jmeter.properties 配置文件中设置超时.我在这里找到的选项:

  1. os_sampler.poll_for_timeout=x
  2. http.socket.timeout=x
  3. httpclient.timeout=x

所以,问题是我不知道从列出的选项中设置响应超时的位置.这些选项之间有什么区别吗?所以我希望看到的结果是:如果特定 HTTP 请求需要超过 30 秒才能从服务器获得响应,请停止等待响应并将其标记为失败请求.

解决方案

根据您的需要,断言不是正确的解决方案,因为它只会将请求标记为失败但会等待.

正确的选项是响应超时.

关于第三点

  1. os_sampler.poll_for_timeout=x => 不适用于 http,请参阅:

    • 如果您想正确学习 jmeter,这本书籍 会帮助你.

      I am trying to check if a particular HTTP request's response time is over 30 seconds, and if it is, then mark it as failed and stop the thread. Sometimes I can see response times close to 80 seconds, an no browser is waiting that long for a response from the server.

      I found the following three ways to set a timeout value in JMeter, however this confuses me, because there is multiple options and I don't know which one to use, or if there is any difference at all between them.

      So here are the options I found that are related to response timeout:

      1. Setting Response timeout value in the sampler
      2. Add a Duration assertion


      3. Setting timeout in jmeter.properties configuration file. Options I found here:

      1. os_sampler.poll_for_timeout=x
      2. http.socket.timeout=x
      3. httpclient.timeout=x

      So, the problem is that I don't know where to set the response timeout from the listed options. Is there any difference at all between these options? So what I would like to see as a result: If a particular HTTP request takes more than 30 seconds to get a response from the server, stop waiting for a response and mark it as a failed request.

      解决方案

      For your need, an assertion is not the right solution as it will only mark the request as failed but it will wait.

      The right option is a response timeout.

      Regarding the 3rd point

      1. os_sampler.poll_for_timeout=x => not for http, see:

      2. http.socket.timeout=x => applies to all requests using HttpClient4 or 3, see:

      3. httpclient.timeout=x => Same, see:

      I think the best option is to use 1. , if you want those values to apply to all requests, just use Http Request Defaults element:

      If you're looking to learn jmeter correctly, this book will help you.

      这篇关于在 Apache JMeter 中配置响应超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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