Using Drupal CDN to Reduce Page Load Time

Free CDN For Joomla

It is always good for business to reduce page load times, especially if you want to come up in search rankings or you're looking to improve your site's usability. Luckily, there are various ways to do that with Drupal CDN because whenever you enter a URL in the browser, the first thing it does is a DNS lookup to find the IP address trying to correspond with that URL.

Unfortunately, the lookups always take more than half a second before sending the server the HTML page's request. Before the request reaches the server, it has to pass via the internet. When the request gets to the server, the server has to interpret it, process it, and send the response back via the internet.

Hence, in most cases, this entire round-trip will take more than 1.3s while the browser waits till then. During this gap period, the browser is often idle. The browser will only parse the HTML once it receives it and then proceeds to request JS, CSS, etc., from the server.

So, you end up wasting a lot of time because the requests need to go via a network, which incurs a full round-trip period. Minimizing each request's round-trip time is one of the best ways to reduce the page load time.

How Do You Reduce The Page Load Time with Drupal CDN?

Assume you have a server sitting in California, and a request comes from Vietnam; how can you reduce the time the request will take to reach California from Vietnam and then back? Well, the best answer is you should never let it get to California in the first place.

But then what if you place a server in Vietnam, identical to the one in California, and every request originating from Vietnam gets routed to this server rather than the one in California? Well, that will significantly reduce the page load time. However, what if you can't afford to have one server in each of these countries? That's where CDNs (content delivery networks) come in.

CDNs have many servers distributed throughout the globe routed to the nearest server depending on which country the request will come from. This helps reduce the round-trip time tremendously.

Drupal CDNs operate by caching content that the server outputs. So, when a user requests a URL from Vietnam, it will reach the CND server in Vietnam. When this happens, the CDN doesn't know what it is expected to respond with, and so it forwards the request to the actual server in California. Then your server responds with the HTML page.

The CDN server then proceeds to store the HTML in its own cache before forwarding the response back to the user in Vietnam. If ever another user requests the same page from Vietnam, the CDN will already know what to respond with. It works by getting the HTML page from the cache and returning it to the user.

This scheme has proven to work correctly with static assets like JS, CSS, and images because they don't change. However, this will depend on your website's homage. For instance, news sites tend to change every few minutes, and sometimes you can't afford to give your users stale content.

This is the same case for e-commerce sites. When products go out of stock, the users need to know that they are out of stock for them not to buy it. In such cases, some CDNs can help solve this problem by letting you purge a URL from memory if the content on that URL keeps changing.

Hence, if the content on your homepage keeps changing, you can inform the CDN that the homepage has changed and when a request comes from the homepage next time, the CDN will be able to forward the request to the server in California to serve the new HTML.

However, the CDNs that allow for such purging to occur are either very expensive like Akamai, lack configurability like Cloudflare, or take a long time to purge the URL such as AWS Cloudfront. This is where you should consider a CND that will let you purge in less than 125 ms like Fastly.

In Conclusion

Work towards finding CDNs that won't charge you extra for purging if you are looking to reduce drupal page load time. Also, ensure that you can configure the CDN to your will. There are also a lot more things you can do to reduce page load times even further other than adding a CDN. Explore your options and decide what is best for you.

CDN and DNS

Content Delivery Platform

Power-up your Content Delivery
30 Day Free Trial Cancel Anytime

Get A Free Trial!