Content Delivery Networks

In this day and age we have little patience for slow loading websites.  You may look back with great nostalgia to the times when pages took minutes to load, but I assure you that you would be in the minority.  At present, we generally want to see pages load in 3 seconds or less.  Longer load times will quickly start to negatively impact bounce rate. This is the rate at which visitors land on your page, and then leave, without any type of engagement.

There are a number of different ways that we can improve load times on our sites.  Recently I wrote a post about image optimization.  Bloated image files can make a huge impact on your load times.  Another highly effective way of improving load speed is to use a content deliver network, (CDN for short).

Why Use a CDN

To best understand why we would want to use a CDN, we need to understand how a web browser displays (or renders) a page.  When you type a web address into your browser, it first goes to a DNS server (domain name system) which is a service that tells the browser at which IP address it can find the page you requested.  Once your browser gets the correct address, it downloads the HTML file from the server.

The HTML file is a list of rendering instructions.  It doesn’t contain all of the resources needed to render the page, but in stead contains the URL (universal resource locater) of each file that is needed to fully assemble the page.  The files needed can come from one server, or from hundreds.  This is where the CDN comes in; it finds the most efficient way to get the resources needed to render the page to the visitor’s browser.

Put another way; if I were building a house, and I got the plans from an architect that was 100 miles away, it would be silly for me to source all the building materials from the same place, when there might be a lumber yard a few blocks from where the house will be built.  There may be other building supply companies which can deliver large quantities of lumber or drywall very quickly.  In the end, I am going to get the hardware and supplies in the most efficient manner that I can in order to build the house quickly and affordably.

How does a Content Delivery Network Work?

Content Deliver Network

Put in simple terms, a CDN alters the DNS for your site, pointing the visitor’s browsers to its own servers.  It then takes copies of all of the resources that your webpages need to render, and distributes them on a network of servers located around the world.  If my site is based in the US, and I get a visitor in Japan, the data may be transferred from a server in Singapore, rather than in the US. Also, data can come from multiple servers concurrently, so overall load time is improved.

In addition, The CDN may perform other services.  The CDN may automatically optimize images, and compress resources such as style sheets and scripts.  The CDN can act as a firewall, keeping bots and hackers from reaching your site.

What’s the catch?

While a CDN can be a great tool in improving your website, there are a few extra things to consider.

Cost

While there are free CDN options available, there are usually tiered plans with premium plans offering more features at a higher price.  An enterprise level CDN can cost hundreds of dollars per month.  If you’re running a small website, you may be able to take advantage of a free offering.  Also be aware that there are some features which may be offered on a pay-per-use basis.

Making Changes

Because the CDN serves resources from its servers, rather than yours, there may be times when a change has been made on your site, and the CDN servers still serve the old version.  The CDN will offer a development mode feature which will disable the caching function for a limited time. Just keep in mind that it is one more thing to remember to do when making changes on your site.

Incorrect Rendering

There may be features that the CDN offers which, on occasion, may break features or layouts on your site.  You will need to do some extra testing when you activate the CDN to make sure that user experience is not negatively impacted.

Sign Me Up!

You’ve decided you want to use a CDN, what now?  First you’ll need to sign up for an account with a CDN.  There are several popular options.  I use cloud flare, since their free account has a lot of really great features.  Once I sign up for an account they will give me instructions on how to connect my site to the network.    The changeover involves logging into your domain registrar account, and changing the name servers of your domain.  If that freaks you out, you might need some technical assistance from your domain registrar.

Once the change has been made,  your site will (eventually) begin to use the CDN.  The changeover (besides the performance improvements) will be seamless, but you should expect to wait anywhere up to 24 hours for everything to change over completely; that’s just an unfortunate aspect of how DNS works.

If you want to give it a try, I would suggest paying a visit to www.cloudflare.com and signing up for a free account.