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.
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:
- Select the ‘Sampler’ element where you want to add the preprocessor
- Right-click on the node
- Hover the mouse on ‘Add’
- Hover the mouse on ‘Pre Processors’
- Click ‘Sample Timeout’
What are the input fields of ‘Sample Timeout’?
‘Sample Timeout’ has the following input fields of sample timeout:
- Name: To provide the name of the preprocessor
- Comments: To provide arbitrary comments (if any)
- Sample Timeout (in milliseconds): To input the timeout value in milliseconds.
You may be interested:
- Performance Testing Tutorial
- Performance Engineering Tutorial
- Micro Focus LoadRunner Tutorial
- NeoLoad Tutorial