Closed Alterant-zz closed 4 months ago
Probably it's a server-side issue with max requests on the same connection (Tomcat's maxKeepAliveRequests) which is 100 by default. Will investigate this.
It was definitely a server issue. Setting maxKeepAliveRequests on Tomcat fixed the problem. Everything is working as expected.
Just for the info: "Same user on each iteration" option takes precedence over "httpclient.reset_state_on_thread_group_iteration". When it is checked "httpclient.reset_state_on_thread_group_iteration" is ignored. When it is unchecked "httpclient.reset_state_on_thread_group_iteration" is used.
Expected behavior
Connections are reused.
Actual behavior
A lot of connections opened and hangs in the TIME_WAIT state.
Steps to reproduce the problem
In the process of testing of web-application, I encountered the problem of running out of ports (java.net.BindException). So I decided to enable connection reuse.
Enabled the "Use KeepAlive" option in the Http Sampler.
Tried adding "httpclient.reset_state_on_thread_group_iteration=false" to the user.properties file. Also tried to enable the "Same user on each iteration" option in the Thread Group.
Even after these actions, I see a large number of connections in the TIME_WAIT state.
After one minute of single thread test:
With the help of wiremock I can see that keep-alive header is sent: "headers": { "Connection": "keep-alive", "User-Agent": "Apache-HttpClient/4.5.14 (Java/21.0.3)" }
And web-app is also responds appropriately: Keep-Alive: timeout=60 Connection: keep-alive
Web-app is running in docker container.
Http sampler is using HttpClient4 and sending a POST request with json payload.
JMeter Version
5.6.3
Java Version
openjdk version "21.0.3" 2024-04-16 LTS
OS Version
Microsoft Windows [Version 10.0.19045.2846]