[wd_asp id=1]

Improving Page Speed with Keep-Alive Optimisation

How to Use Keep-Alive to Improve Pagespeed

Keep-Alive serves as a valuable feature in improving page speed, enabling the transmission of multiple HTTP requests over a single TCP connection. Instead of establishing new connections for each request, Keep-Alive allows the sending and receiving of multiple requests through the same connection. This approach effectively reduces latency and minimizes the overhead associated with establishing new connections.

To better understand this concept, imagine yourself as a waiter responsible for delivering food and drinks to customers. If you were to individually request the chef to prepare each item in the kitchen, it would considerably extend the time taken compared to requesting all the necessary items at once and having them prepared together.

In a similar manner, Keep-Alive facilitates the transmission of multiple HTTP requests over a single connection, significantly reducing the time required to retrieve all the essential resources for a web page.

Most modern web servers and browsers have Keep-Alive enabled by default. However, you can verify whether Keep-Alive is enabled on your website by using tools like GTmetrix or Pingdom. (See: 8 Awesome Page Speed Testing Tools)

If Keep-Alive is not enabled, you should be able to enable it by adding a line of code to your website’s .htaccess file or your web server’s configuration file.

Here’s an example of what that code might look like for Apache web servers:

<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>

By implementing this code, you instruct the server to utilize Keep-Alive for HTTP requests. This practice contributes to improved page speed and reduced overhead associated with establishing new connections.

Important Note: Keep-Alive may not be suitable for all websites, especially those with high traffic or complex resources. Therefore, it is advisable to consult a Page Speed Specialist to determine the best approach for your specific website and business requirements.

Using Keep-Alive With WordPress

To enable Keep-Alive in WordPress, you can add these lines of code to your .htaccess file or your web server’s configuration file. Consider this example for Apache web servers:

<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>

Once you have included this code, you can employ tools like GTmetrix or Pingdom (see: Page Speed Testing Tools) to check if Keep-Alive is enabled on your WordPress website. If it is not enabled, you may need to configure your web server or hosting environment to support Keep-Alive.

For additional resources on improving page speed, explore 35 WordPress Tools and Resources to Enhance Page Speed.

Enabling Keep-Alive might not be suitable for all WordPress websites, especially those with high traffic or complex resources. In such cases, it is recommended to consult a WordPress Page Speed Agency to determine the most effective approach for your website and business needs.

You may need to consult a WordPress Page Speed Agency to determine the best approach for your specific website and business needs.

There are no specific WordPress plugins that solely support Keep-Alive as it’s typically enabled by default on most modern web servers and browsers

Using Keep-Alive With Magento 2

To enable Keep-Alive in Magento 2, you can add these lines of code to your .htaccess file or your web server’s configuration file.

To enable Keep-Alive on Apache Servers, you can utilize the following code:

<IfModule mod_headers.c>
Header set Connection keep-alive
</IfModule>

For Nginx Servers, follow these steps to enable Keep-Alive:

http {
keepalive_timeout 65;
keepalive_requests 100;

}

These lines of code configure Nginx to keep the connection alive for 65 seconds and allow up to 100 requests to be made over the same connection.

Related:

Enabling Keep-Alive on Microsoft IIS Servers

To enable Keep-Alive on Microsoft IIS servers, follow these steps:

  1. Open the IIS Manager and select the desired website.
  2. Under the “IIS” section, click on “HTTP Response Headers.”
  3. Click the “Add…” button to create a new custom header.
  4. Enter “Connection” as the header name and “Keep-Alive” as the header value.
  5. Save the changes by clicking “OK.”

After adding the code, you can verify whether Keep-Alive is enabled on your Magento 2 website using tools like GTmetrix or Pingdom (see: Page Speed Testing Tools). If Keep-Alive is not enabled, you may need to configure your web server or hosting environment accordingly.

Enabling Keep-Alive might not be suitable for all Magento 2 websites, especially those with high traffic or complex resources. It is recommended to consult a Magento Page Speed Specialist to determine the most appropriate approach for your website and business requirements.

Using Keep-Alive With Shopify

Shopify, being a fully hosted e-commerce platform, already has Keep-Alive enabled by default on its servers. As a Shopify store owner, you do not need to take any specific actions to enable Keep-Alive on your website since Shopify handles it automatically.

For additional Shopify tools and resources to improve page speed, consider the following: 17 Shopify Tools and Resources to Improve Page Speed

This post is part of: Page Speed Optimisation: A Complete Guide — created by our Page Speed Optimisation Specialists.

In this series:

Leave a Reply

Your email address will not be published. Required fields are marked *

Share this article

Effective management of your product listings in Google Merchant Centre is crucial for optimising your eCommerce advertising strategy. Whether you...
When it comes to digital marketing, harnessing the power of Facebook ads is essential. Understanding how to create high-converting Facebook...
When it comes to running a successful e-commerce business, one of the key strategies is to convert browsers into buyers....