Home > Mobile >  Performance test with jmeter based on response field
Performance test with jmeter based on response field

Time:04-05

I am trying to run some performance tests on an ElasticSearch-backed JSON REST API, to try the impact of different filters on ElasticSearch.

I don't want to use the standard jmeter output, because there is too much clutter due to the over-the-wire time.

My API returns the time taken on ElasticSearch based on the took(tookInMillis in the java RestHighLevelClient we are using) property of the org.elasticsearch.action.search.SearchResponse. This is returned in a time_taken` property of the API response.

This is a sample response

{
    "page_size": 1,
    "current_page": 1,
    "number_of_pages": 2495,
    "total_results": 2495,
    "additional_results_exist": false,
    "time_taken": 55,
    "results": [
        {       
                // object here, we don't really care
        },
        {            
                // object here, we don't really care
        }
    ],
    "request_id": "06e8001c-caf2-46f4-bf16-08c8d1ceb079"
}

So, the use case would be:

  • send requests via the Loop Controller
  • extract the time_taken property from the responses
  • get avg, 90%, 95%, 99%, min, max stats based on the time_taken response property.

I have found several references, mentioning JSON extractor, RegEx extactor, beanshell, but I didn't manage to get anything to work.

So, I would really appreciate a minimal working setup.

The jmeter version I am using is 5.4.3

CodePudding user response:

We would really appreciate if you could provide the response from the ElasticSearch because we don't have any idea of how does it look like hence we cannot come up with a proper enter image description here

If you want to utilize JMeter listeners you can create a "fake" sampler using i.e. enter image description here

This way the "fake" sampler will have response time from the took ElasticSearch response JMeter will calculate the percentiles.

Demo:

enter image description here

  • Related