Tag Archives: org. apache. http://www.qlyque.com conn.HttpHostConnectException:xxxx failed:

Execute the Jmeter Script Error: .org.apache.http.conn.httphostconnectexception: XXXX failed: unable to specify the solution of the requested address (Connect failed)

Problem Description: While executing a single transaction load script, I found that running the script locally, the exception rate was 0%, and when the same script was executed on the hair press, there were large error reports.

Reason: Linux allocate to the client connection port exhausted, can not establish a socket connection caused by, although the socket closed, but the port default wait for 60s to be released, so as long as we give more available ports will be fine.

Solution steps.

1. Check the range of client connection ports supported by Linux: cat /proc/sys/net/ipv4/ip_local_port_range

2. Tune down the waiting time after port release, the default is 60s, modify it to 15~30s: echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout

3. Modify the tcp/ip protocol configuration by configuring /proc/sys/net/ipv4/tcp_tw_reuse, the default is 0, modify it to 1 to release the TIME_WAIT port for new connections: echo 1 > /proc/sys/net/ipv4/tcp_tw_resue

4. Modify the tcp/ip protocol configuration to quickly recycle socket resources, the default is 0, modify it to 1: echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle

After the modification, execute the single transaction load script on the issuing press again, and the exception rate is normal.