Whenever the browser requests a file from server, interaction takes place between the server and browser it creates a communication pattern which is keep alive.
Benefits of using Keep Alive
- Minimizes latency and overall increase in loading speed and performance.
- Better site performance will be an advantage in terms of SEO and ranking.
- Minimizes the usage of CPU and memory due to lesser number of generated HTTP request. This is an advantage to all hosting plan users (free hosting, shared hosting and VPS).
- It provides HTTP pipelining which means same TCP connection is used to deliver requests
- All modern browsers support Keep Alive
- Additional benefits will be added to you if your website use HTTPS and SSL certificate.
How to enable Keep Alive?
Firstly, you need to determine whether Keep Alive is enabled or disabled on your server. Analyze your website using a tool such as GTmetrix.
In case of Apache
You can choose one of the following ways:
- Open Apache configuration file on server and add.
Your server needs to be restarted after adding this.
- .htaccess file, add the below code
Header set Connection keep-alive
In case of NGINX
If Keep Alive is disabled in your config file, you will find the following in the file.
You can use below code to make changes in the settings:
To sum up, improved site speed and performance will eventually keep your visitors happy.