Normally the server closes the HTTP connection after completion of each request. With Keep-Alive function you can use the same TCP connection for all the HTTP requests. Benefit of Keep-Alive functionality is that you don’t have to open new connection for every request.

Is it good to enable Keep-Alive on server ?

As already discussed the Keep-Alive allows handling multiple HTTP request at the same time which may reduces the loading time. If you need to run your website faster then, its good option to enable Keep-Alive. After enabling it there is no need to open and close connection repeatedly.

NOTE : If you are an end user managing VPS or dedicated server, then it’s good to enable Keep-Alive parameter. As it will speed-up your processing on server.
But if you are a shared hosting provider then it may slow down your server. So, you can disable it because it consumes a lot of resources on server.

How to enable Keep-Alive on server ?

You can enable Keep-Alive option by using HTTP header in your apache (httpd.config) file. By default Keep-Alive is automatically enabled on Apache server, but if it is not enabled then you have to make some changes on httpd.conf file. You have to enter following code in apache configuration file :

Code:
KeepAlive On
If you need to disable it then you can use following code :

Code:
KeepAlive Off
If your website is hosted on shared server, then you won’t have any access to Apache configuration (httpd.conf) file. In that case you have to contact your hosting provider to enable the Keep-Alive connections. If your hosting provider disabled it then you won’t able to access it after making any changes in .htaccess file. So it’s better to contact your hosting provider, if you are on shared server.
Author
bhawanisingh
Views
3,006
First release
Last update
Rating
0.00 star(s) 0 ratings
Top