Your website, online shop or blog is getting more and more attention and visitors from all over the world? Great, that means you've already been doing plenty of things right! What if you find out in Google Analytics that your biggest fans and visitors are in New Zealand while your office is in London? This is where a content delivery network (CDN) comes into play.
In the vast ocean of digital "trends", winning over customers and standing out from the competition isn’t easy. As any business-minded person knows, customer loyalty is the key to your success. And the key to customer loyalty? A good user experience.
A study by Google comes to the following conclusion: "[...] a one-second delay in mobile load times can impact conversion rates by up to 20%". Another Google study, which tested over 900,000 mobile websites of varying sizes, shows an average load time of 22 seconds on mobile devices. That's a hell of a long time to keep your users waiting.
So the first step is to optimize your website and content. If you're not sure how to optimize your WordPress , first check out our article on the top 10 performance optimization tweaks.
Your site is now optimized down to the very last line of code and your performance is still not up to scratch? Latency is the most likely culprit.
Latency is the measure of how long it takes for data to be sent from point A to point B. Suppose we send our website to a user in the same city. In this case, the latency will be pretty small because the distance the data has to travel is short.
But if we increase this distance, the time needed to send the data from point A to point B is also much longer.
So how can we make sure our website loads faster for our visitors? One popular method is to use a content delivery network (CDN). First things first, let's look at what a CDN is and how you can benefit from using one.
What is a CDN?
Firstly, we need to break the term “content delivery network” down into its three parts:
- Content: The data you provide to your website visitors (web page, video, image, etc.)
- Delivery: How this data is retrieved by the user
- Network: The places where your data is stored at any given time.
Content delivery network is basically an umbrella term for a collection of servers at different locations, known as PoPs (points of presence). These are typically located in different countries around the globe. The locations are strategically positioned to be closer to a broader user base. In large countries such as Russia and Brazil, there are even regional and national (R/N) CDNs due to the sheer size of the countries.
The servers placed around the globe are called proxy servers or edge servers and store your data. This can be optimized to cache only the most requested content if your database is very large.
When users connect to your website, they are redirected to the nearest server with the cached data. If the user requests data that is not yet cached, the proxy server will request your origin server and pull the requested data to it.
You can control how the CDN caches your data by setting caching rules. Depending on which CDN service you use, there are different ways to implement this.
The result is a massive benefit for the end user. These benefits include increased uptime and, above all, the speed at which content can be loaded due to lower data latency. This is because the number of users connecting to a single server is now distributed regionally.
Do I even need a content delivery network?
The main advantage of using a CDN is being able to make your data available to the user faster and more reliably. But you need to take your target audience and customer base into account as well. Let's look at two different examples:
Example #1: Flower shop
It's highly likely a florist is going to have a local customer base. Unless the store gets a shoutout from a Kardashian, we can assume the network traffic, i.e. the number of people viewing the site at any given time, is fairly low. Perhaps there could also be the occasional overseas website visitor who's planning to buy flowers on vacation.
This type of website wouldn’t see a massive improvement by using a CDN - local load times are pretty fast anyway. Unless, of course, your hosting server is on the other side of the planet. We can probably also assume that the romantic vacationer from overseas would tolerate the extra few hundred milliseconds of extra loading time.
Example #2: Video streaming service
A video streaming service, on the other hand, is going to have the following:
- Users in multiple countries
- A large user base
- Most likely large files that are streamed
- Dozens of competing platforms - so user experience is going to be particularly important for customer retention
This type of service would benefit greatly from using a CDN because all the factors above can affect the hosting server’s ability to send data to the user. Here’s why:
- Users who are farther away from the host server have longer wait times, simply because the data has to travel a greater distance.
- If more and more people try to access your content, the server may end up running out of resources (processing power) to send this data back to your users. This is also called a “bottleneck”.
- The continuous requests of the streaming service to the server can lead to a crash, also known as “downtime”.
So how would a CDN help your servers run better?
Speed - How a CDN can improve loading time
First, your chosen CDN would have servers in different regions so your visitors can access the server closest to them. This would help with your loading speeds.
Depending on the configuration of your CDN, you may want to cache only the most frequently requested files. This is very useful if your site is especially large; it will cut down on data center costs.
Distribution - How a CDN improves uptime
Now you have a large number of servers around the globe, your website visitors will be connecting to the server closest to them.
This means that instead of 10 million visitors in 10 countries all trying to connect to a datacenter, you now have 10 servers that can handle, say, a million visitors each. These servers are called edge servers (the proxy versions of your host server), and this solution is called "load balancing".
Security - How a CDN improves security
Websites (usually larger, popular websites) can fall victim to a Distributed Denial of Service ( DDOS) attack. This occurs when your server is overloaded with network traffic that prevents other users from contacting your website.
While CDNs can help with some aspects of a DDOS attack, they’re no miracle cure:
- The CDN can redirect a large amount of network traffic by distributing it to different PoPs. The origin server is not overloaded and shouldn’t cause an outage.
- CDNs are only cached versions of your origin server. As a result, if your origin server falls victim to a DDOS attack, you might not be able to access the data not yet cached on your CDN.
- In some sophisticated DDOS attacks, the attacker will actually use the CDN to cause the origin server to fail. This is done by causing the CDN to place multiple requests to the origin server, bringing it to its knees.
In this case, it's good to remember that a CDN is a "content delivery network" and not a network defense.
How do I get a CDN for my website?
Okay, now you're convinced you need a CDN. But does that mean you now have to host your data in multiple locations and pay a fortune for it?
CDNs have been around for a long time - since the 1990s to be precise. But like most new technologies, the initial costs were pretty high. Luckily, times have changed, and the options for implementing CDNs are now fairly affordable.
There are several providers specializing in CDNs. The integration is usually done via nameserver entries (which we also recommend) or sometimes also via WordPress plugins. Among the most popular providers are:
If you want to use these solutions, you still have to make some configurations to define the caching rules of the CDN. In many cases, your host can support you with appropriate documentation and advice - or the CDN is already integrated into the hosting offer.
Content delivery networks are a tool in the internet ecosystem that have the power to deliver our content to the end user faster and more reliably. Some sites will benefit from CDNs and others won’t. It’s important to remember that a CDN should only be used in conjunction with good optimization and security measures to deliver the best for your website visitors.