KeepAlive Directive is used to enables the HTTP Persistence connections.
This is the persistance connection features of HTTP/1.1 which provides the long lived HTTP session which can be sent over same TCP connection.
Using KeepAlive is closely related to the MaxClients setting.
Note: In some cases 50% improvement in latency time for HTML document with more images.
Note: A Keep-Alive connection with HTTP/1.0 can only be used if length of the content known in advance.
Basically KeepAlive keeps each HTTP connection open for short time to receive the follow up request from the same connection. This is because we can consider that client will try to make a several connection to our web server as a follow up request. So we can enable the KeepAlive Directive to restrict client to make different connection for every request.
So if you have a lots of traffic on your website then in some cases it will create a problen by enabling the KeepAlive. This is becuase we will have lots of unused open connection to our web server.
So how to overcome from this problem?
Here is the solution for this. We can set the KeepAliveTimeout for the cache HTTP connection. So let’s see how to set the KeepAliveTimeout.
Now webserver will cache that HTTP connection for just 2 secs so we will not have unrequired open connections.
Here we can set the how many number of requests to act as a Persistance Connection. MaxKeepAliveRequests is used for this.
If this value is set to 0 then it will be considered as a unlimited numbers of requests.
Note: It is recommended to set the higher value of this Directive for higher performance.
It is recommended to enable the KeepAlive Directory but with some amount of KeepAliveTimeout.
Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.
View all posts by: Avinash