JMeter – Sample Timeout

JMeter - Sample Timeout

Let’s consider, you are running a load test and hitting the server with the max of its capacity. The server responding to the request with its strength but most of the request are piled-up and the server takes a long time to respond. What will happen at the JMeter end in this situation? 

Definitely, JMeter waits to fire the next request until the response of the previous request comes. This will impact the test TPS/RPS and you can not achieve the desired throughput. 

To overcome this situation, ‘Sample Timeout’ preprocessor is added under those samples where threads may get stuck. 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. 

JMeter - Sample Timeout
Figure 01

One point to be noted here, the timeout should be set sufficiently long so that it is not triggered in normal tests, but short enough that it interrupts samples that are stuck. Also, it is recommended not to use sample timeout for all the samplers. You can use this preprocessor for those pages where DB queries are executed, long calculative logics are written in the code etc.

Sample Timeout preprocessor can be used with AJP, BeanShell, FTP, HTTP, Soap, AccessLog, MailReader, JMS Subscriber, TCPSampler, TestAction, JavaSampler.

How to add ‘Sample Timeout’ preprocessor?

You can follow the below steps:

  1. Select the ‘Sampler’ element where you want to add the preprocessor
  2. Right-click on the node
  3. Hover the mouse on ‘Add’
  4. Hover the mouse on ‘Pre Processors’
  5. Click ‘Sample Timeout’

What are the input fields of ‘Sample Timeout’?

‘Sample Timeout’ has the following input fields of sample timeout:

  1. Name: To provide the name of the preprocessor
  2. Comments: To provide arbitrary comments (if any)
  3. Sample Timeout (in milliseconds): To input the timeout value in milliseconds. 

Leave a Reply

Your email address will not be published. Required fields are marked *