Exclude Response Time of JMeter Sampler

Problem:

  • How to exclude the response time of a sampler from a transaction response time?
    OR
  • How to eliminate a sampler from the listener in JMeter?

Explanation:

In JMeter, some of the samplers like JSR223 or BeanShell samplers contain an operational logic code. Such a sampler takes time to process the logic and gives the output. Ideally, the processing time of JSR223 or BeanShell sampler should not be included in the transaction response time because it impacts the response time metric. Hence we need to exclude the response time of these samplers from the result.

Reason:

The processing time of JSR223 or BeanShell samplers increases the transaction response time or overall response time which may lead to breach the response time NFR of the transaction.

Solution:

Follow the below steps to exclude the response time of a sampler:

  1. Add a ‘JSR223 PostProcessor’ under that sampler whose processing time needs to be excluded
  2. Write the code ‘prev.setIgnore()’ in JSR223 PostProcessor
How to Exclude Sampler Response Time in JMeter
Figure 01: Exclude Sampler Response Time

How does it work?

The method setIgnore() belongs to SampleResult class of JMeter which instructs JMeter not to calculate the response time of the sampler. Hence the sampler is out from the listener’s list.


Leave a Reply

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