Do Jmeter threads have a single connection or each thread has a single connection?

Viewed 24

I recently installed Jmeter on my local machine to stress test an API route of an application that is running on k8s as 2 replicas. I sent a request with 60 threads(users) and I am able to see the requests received to only 1 of the replicas in the logs. This raises the question that does Jmeter send requests with a single connection or each time it send a request it creates a new connetion?

1 Answers

It depends on what do you choose in the HTTP Request sampler

enter image description here

  • If you tick Use KeepAlive JMeter will send Connection header with the value of keep-alive so subsequent requests will reuse the connection which will remain open
  • If you untick the box JMeter will send Connection header with the value of close and each subsequent request will open a new connection.

In k8s context it might be the case JMeter will hit only one node behind the load balancer due to caching of DNS requests on JVM level so you might want to disable the DNS Caching or to add DNS Cache Manager to your test plan

Related