Home > OS >  Same API Get diffrent response time
Same API Get diffrent response time

Time:09-29

I run the same API 4 times in the same JMeter script. in the 1st running API get the high time and after that same API get low times.

  1. User Create API - 2067 ms
  2. User Create API 1- 948 ms
  3. User Create API 2- 869 ms
  4. User Create API 3- 902 ms
  5. User Create API 4- 993 ms

why this kind of scenario does in the JMeter??

CodePudding user response:

Jmeter tries to initialize TCP connections and handles SSL handshakes for the first request. For next requests it uses its config parameters httpclient4.time_to_live and httpclient.reset_state_on_thread_group_iteration.

You can refer to Jmeter's properties reference for more information

CodePudding user response:

JMeter only sends requests, waits for responses, measures time in-between and writes down the performance metrics and KPIs.

If first request takes longer than the following ones the reasons could be in:

  1. Your application under test uses lazy initialization pattern
  2. Your application under test needs to warm up its caches
  3. First request takes longer due to the process of establishing the connection and subsequent requests are simply re-using the connection if you're sending Keep-Alive header
  4. Your API endpoint response is cached on database or in-memory level
  5. etc. the reasons could be numerous, you need to monitor everything you can on both JMeter and the system under test sides to understand this.
  • Related