I have 500 threads in my test plan and duration is set to 20 minutes. 500 users have been created 37000 samples with 37000 TCP connections. Jmeter creating a new connection for every new request it sends.We need 500 users creating 500 TCP connections and those 500 connections should be maintained for entire run. PLease suggest how can I achieve this in JMeter?
2 Answers
The easiest option is going for HTTP Raw Request sampler, it has Keep connection open
checkbox so you will be able to re-use the same connection for the virtual user for the series of the TCP requests.
You can install HTTP Raw Request sampler using JMeter Plugins Manager
Check TCP Sampler >> "Re-use Connection" option.
If " Re-use connection " is selected, connections are shared between Samplers in the same thread, provided that the exact same host name string and port are used. Different hosts/port combinations will use different connections, as will different threads. If both of " Re-use connection " and " Close connection " are selected, the socket will be closed after running the sampler. On the next sampler, another socket will be created. You may want to close a socket at the end of each thread loop. If an error is detected - or " Re-use connection " is not selected - the socket is closed. Another socket will be reopened on the next sample