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.
- User Create API - 2067 ms
- User Create API 1- 948 ms
- User Create API 2- 869 ms
- User Create API 3- 902 ms
- 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:
- Your application under test uses lazy initialization pattern
- Your application under test needs to warm up its caches
- 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
- Your API endpoint response is cached on database or in-memory level
- 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.