When you tackle the issue of speeding up a website, the concept of a CDN will come up.  Since this is obviously not a push to host your server in Canada, it begs the question, what is a CDN?

So, what is a CDN?

The letters are short for content delivery network, and it is an important concept to understand for performance tuning.  At its simplest, a CDN is a network of servers that help bring content to users from as close to them as possible.  Think of the Postal Service as a form of CDN.  You can go to the nearest office to you to pick up your mail.  It even goes a step further, and you have a mailbox close to where you live.  Thus, you are minutes away from your mail.

In a CDN the big difference is that data is replicated to every server in the network.  In the mailbox example, think of having the option to go to any mailbox to get your mail, not just the one at your home.

How Does it Work?

I want to avoid getting too technical.  Thus, I will keep the “how” of this general.  A CDN copies data from your server out to all of the servers in the network.  I am simplifying so not every CDN copies data to all servers.  The solution tends to be more complex than that.  The key point is that the data is copied from your server to locations that may be closer to visitors.

For example, your server may be in Boston, and the CDN has a server in San Francisco.  California customers will be served data from San Francisco instead of traveling across the country.  This, of course, only works with static data, but that is a large part of the content delivered by most sites.  Images, marketing content, and even source like javascript and CSS can all be handled by a CDN to speed up response times.

That Sounds Expensive

Yes, that does look like an enterprise feature.  Bobby, the blogger, can not possibly afford to use a CDN.  Good news that is not correct.  There are some low-cost options like Max CDN (about $10/month).  Better yet, there are highly affordable (free) options like Amazon’s S3 and CloudFlare.  I use both the Amazon and Cloudflare option for some sites and have found them to be easy to use.

We have covered some S3 plugins in the past, so I want to focus on CloudFlare this time.  Cloudflare is specifically a CDN.  Thus, they have some tools and add-ons to make your site run smoothly and reliably.  The free tier requires an email address, and then they help you map your domain name servers to use the CDN.  That is the hardest step.  Just copy the server addresses they provide to the DNS records they list.  The free tier includes limited DDOS attack protection, a shared SSL cert, global CDN, and a few access rules.

Once you configure CloudFlare, it will take care of caching your data across the network.  This may take a little time, but I usually see improvements in under an hour.  The console will let you know when they have the data they need for your site.  At that point, it is worth exploring the add-ons they provide to both free and paid accounts.  If you are patient, then you can check back here in the next few weeks as we will go deeper into their offering.

 

Rob Broadhead

Rob is a founder of, and frequent contributor to, Develpreneur. This includes the Building Better Developers podcast. He is also a lifetime learner as a developer, designer, and manager of software solutions. Rob is the founder of RB Consulting and has managed to author a book about his family experiences and a few about becoming a better developer. In his free time, he stays busy raising five children (although they have grown into adults). When he has a chance to breathe, he is on the ice playing hockey to relax or working on his ballroom dance skills.

Leave a Reply