Search code examples
performancejmeterload-testing

How to calculate total response time with specific number of records created in jmeter after expensive calculation logic


I've got one question where I want to check total time it takes for my application to create 100 records. First I have to call endpoint which will trigger message for 100 records calculation with relevant payload. After that my system will perform expensive background calculation which will create those record after some (unknown) time. I was thinking about the approach that looks something like this:

--simple controller                                                                                       
 -- http request for triggering message for 100 records creation
 -- beanshell assertion (set total number of items created as 0)
  --while controller(number of total items is smaller than 100 records)
    -- http request to check number of items created so far
    -- JSON Extractor to extract total number of items
    -- beanshell assertion (set total number of items)

I want to measure total time taken for 100 records to be created. I'd also like to mention that sometimes my app may crash and 100 records will never be created (another thing to check so I don't get into infinite while loop). What is the best way of achieving it?


Solution

  • Your approach is good and valid. However I would replace:

    1. Simple Controller with the Transaction Controller, this way you will get the total processing time without having to calculate it manually
    2. Beanshell Assertion with the JSR223 Assertion as it's recommended to use JSR223 Test Elements and Groovy language for scripting.
    3. In the While Controller you can add another condition to limit the maximum number of iterations or total processing time so in case of backend problems JMeter test won't last forever.