0
votes

I'm using jmeter for some load testing. I'm interested in both metrics:

  • The total response time.
  • The db query time.

As usual, my request does the following: hit the server, makes some computation, query the database, makes more computation, and then return a response. I'm interested on measuring the time it takes to resolve the query and visualize it on JMeter.

To do this, I'm using the Server Timing Response API, that is, I'm setting a header on my responses to annotate that time. Something like this:

Server-Timing: miss, db;dur=53, app;dur=47.2

For more information, checkout the official documentation. Now, my problem is that I do not if that is even possible with JMeter. I thought that maybe on a JSR223 listener I can do that, but I'm not sure. Any idea how to take those values and represent them in some way?

1

1 Answers

1
votes
  1. You can extract it using a suitable Post-Processor like Regular Expression Extractor configured like:

    enter image description here

    it will extract value 53 from the response and store it into dbdur JMeter Variable

  2. The next step is declaring this dbdur as the Sample Variable, it can be done by i.e. adding the next line to user.properties file:

    sample_variables=dbdur
    

    More information: Apache JMeter Properties Customization Guide

  3. And finally you can plot the variable value as a custom chart in the HTML Reporting Dashboard like it's described in Generating customs graphs over time chapter, just change example ts-hit sample variable value to your dbdur and amend axis/chart titles accordingly.