Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring response timeout in Apache 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 Method 1
  2. Add a Duration assertion

Method 2
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.

like image 754
Dominik Antal Avatar asked Aug 08 '14 16:08

Dominik Antal


People also ask

How do I set timeout in JMeter?

In this 'HTTP Request Default', there is an option – Connect in 'Timeouts (milliseconds)' Specify your connection timeout value in this field and it will be applied to all child samplers. If this 'HTTP Request Default' is added at Test Plan level, then it will be applied to all samplers and all thread groups.

What is sample timeout in JMeter?

Sample Timeout sets a maximum timeout for a particular sampler and executes when the response time exceeds the given timeout value and instruct JMeter to fire the next request.


2 Answers

Socket/Connect and Read/Response timeouts can be set from Http Request Defaults section at jmeter GUI. See sample:

Connect timeout: 3 seconds
Response timeout: 20 seconds.

enter image description here

like image 97
Devrim Avatar answered Sep 20 '22 00:09

Devrim


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:

    • https://github.com/apache/jmeter/blob/master/bin/jmeter.properties
  2. http.socket.timeout=x => applies to all requests using HttpClient4 or 3, see:

    • https://github.com/apache/jmeter/blob/master/bin/hc.parameters
  3. httpclient.timeout=x => Same, see:

    • https://github.com/apache/jmeter/blob/master/bin/jmeter.properties

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:

  • https://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request_Defaults

HTTP Request Defaults

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

like image 21
UBIK LOAD PACK Avatar answered Sep 21 '22 00:09

UBIK LOAD PACK