November 21, 2020•250 words
Tweaks for JMeter
This post highlights a few tips that may be necessary to identify the maximum concurrent throughput of one or more application servers with JMeter. They include TCP / IP tuning, load balancer tuning, and garbage collection tuning.
TCP / IP (Red Hat Enterprise Linux / RHEL)
When an HTTP request is made, an ephemeral port is allocated for the TCP / IP connection. The ephemeral port range is 32678 – 61000. After the client closes the connection, the connection is placed in the TIME-WAIT state for 60 seconds.
If JMeter (HttpClient) is sending thousands of HTTP requests per second and creating new TCP / IP connections, the system will run out of available ephemeral ports for allocation.
When JMeter is run, the following message may appear in the jmeter-server.log file if the JMeter server is unable to allocate a port to create a connection to the JMeter client to return the samples.
java.net.NoRouteToHostException: Cannot assign requested address
Otherwise, the following messages may appear in the JMeter JTL files:
Non HTTP response code: java.net.BindException Non HTTP response message: Address already in use
The solution is to enable fast recycling and reuse TIME_WAIT sockets.
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
Other options include TCPFINTIMEOUT to reduce how long a connection is placed in the TIMEWAIT state and TCPTWREUSE to allow the system to reuse connections placed in the TIMEWAIT state. See this article for more information.