在Apache JMeter中配置响应超时 [英] Configuring response timeout in Apache JMeter
问题描述
我正在尝试检查特定HTTP请求的响应时间是否超过30秒,如果超过30秒,则将其标记为失败并停止线程.因为现在有时候我什至可以看到响应时间接近80秒,所以没有浏览器正在等待这么长时间才能得到答复.
我发现了以下三种在JMeter中设置超时值的方法,但是这使我感到困惑,因为存在多个选项,我不知道要使用哪个选项,或者它们之间是否有任何区别. /p>
这是我发现的与响应超时有关的选项:
- 在采样器中设置响应超时值
- 添加持续时间断言
3.在 jmeter.properties 配置文件中设置超时.我在这里找到的选项:
- os_sampler.poll_for_timeout = x
- http.socket.timeout = x
- httpclient.timeout = x
因此,问题是我不知道从列出的选项在哪里设置响应超时.这些选项之间有什么区别吗? 因此,我希望看到的结果是:如果特定的HTTP请求需要30秒钟以上才能回复,请停止等待响应并将其标记为失败的请求.
断言不是正确的解决方案,因为它只会将请求标记为失败,但会等待.
正确的选项是响应超时.
关于第三点
-
os_sampler.poll_for_timeout = x =>不适用于http,请参见:
-
http.socket.timeout = x =>适用于使用HttpClient4或3的所有请求,请参见:
-
httpclient.timeout = x =>相同,请参见:
我认为最好的选择是使用1.,如果要将这些值应用于所有请求,只需使用Http Request Defaults元素:
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. Because now sometimes I can even see response times close to 80seconds, an no browser is waiting that long for a reply.
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:
- Setting Response timeout value in the sampler
- Add a Duration assertion
3. Setting timeout in jmeter.properties configuration file. Options I found here:
- os_sampler.poll_for_timeout=x
- http.socket.timeout=x
- 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 reply, 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
os_sampler.poll_for_timeout=x => not for http, see:
http.socket.timeout=x => applies to all requests using HttpClient4 or 3, see:
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:
这篇关于在Apache JMeter中配置响应超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!