'Use Keep Alive option issue

What is the use of keep alive option in Jmeter and ow its working ?

I did a performance test using Jmeter 3.0 In my recorded script Keep alive option is checked. So i use keep alive option checked in my real test script If i use keep alive option i got error with in 75 concurrent VU's Error message : XXX.XXXX.XXXX:XXX server refused to respond if i un check keep alive option i can able to go up to 500 VU's without error. In this case do we need to use Keep alive option or not ?



Solution 1:[1]

Keep-alive is an HTTP feature to keep a persistent connection between round trips, so that it does not initiate a new one on every single request. This feature has many benefits, but one of the trade-offs is that it holds resources on the server side and that can be an issue under heavy load.

In your case, I guess that you've simply consumed all resources on the server with 75 opened connections and that it can't serve further requests. This error does not necessarily mean your server can't serve more than 75 connections, because it all depends on your HTTP server config.

Example of an Apache config:

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 100

Keep alive on wikipedia

Solution 2:[2]

Ugh! Just ran into this. According to JMeter's documentation:

http://svn.apache.org/repos/asf/jmeter/tags/v5_1_RC2/docs/usermanual/component_reference.html

JMeter sets the Connection: keep-alive header. This does not work properly with the default HTTP implementation, as connection re-use is not under user-control. It does work with the Apache HttpComponents HttpClient implementations.

In other words, JMeter will send the header, but with the default implementation it will not re-use connections.

Solution 3:[3]

To use KeepAlive effectively, you need to select 'HttpClient4' from Implementation dropdown on Advanced tab. HttpClients Implementation

HTTP keep-alive i.e. HTTP persistent connection, is an instruction that allows a single TCP connection to remain open for multiple HTTP requests/responses.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Carlos Rendon
Solution 3 user2964934