apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.19k stars 2.07k forks source link

First HTTP request in Thread Group has twice latency than other HTTP request #6288

Open saubhagya23 opened 2 months ago

saubhagya23 commented 2 months ago

Expected behavior

We created a thread group for testing APIs. The configurations we used are as follows: Number of Threads: 50 Ramp-up Period: 0 Loop Count: 1 Startup delay: 0

We generated Aggregate Report but the first request always has double the response time and latency time as that of the other http request whereas on browser it is similar to other api requests. (Please refer the screenshot)

image

Even when we interchange the order of apis in JMeter, the first request always takes double the response time and latency time. (Please refer the screenshot)

image

We have also added HTTP Cache Manager to clear cache if any but are still getting the same results.

Expected behaviour: The latency and response time should be similar to that of the web application.

Please help us resolve this issue at the earliest.

Actual behavior

The latency and response time for the first HTTP request is almost double the rest of the HTTP requests and not at all similar that of the web application.

Steps to reproduce the problem

JMeter Version

5.6.3

Java Version

openjdk version"11" 2018-09-25

OS Version

No response

saubhagya23 commented 2 months ago

Please provide us with a solution to this as we couldn't find a solution to this.

KingRabbid commented 1 month ago

Just an idea: the 1st request is the one that opens a connection to the server and the connection pool is setup, the URL is cached, etc (I assume you use HTTPClient4 implementation). The rest of the connections might be re-used from the pool next, that's why you don't see a penalty anymore. You should be able to see the connection times in JTL provided you selected in the Listener of choice to also 'Save Connect time'; you can also see this info in the 'View Results in Table' Listener.

linvaux commented 1 week ago

try to run as Non-Gui mode