How to Choose the Right CDN For Your Website
Fundamentally, all content delivery networks (CDNs) operate in the same way. Content is served to visitors speedily from various locations, depending on their proximity.
However, to the webmaster, CDNs vary massively.
Types of CDNs
There are two different types of CDNs: push and original pull (or simply ‘pull‘). Each has its own advantages and disadvantages.
Some sites work best with push CDNs, and some work better with pull CDNs.
Here’s a quick breakdown of the differences.
Generally speaking, a push CDN works very much like secondary server. The user uploads content directly to the CDN (automatically or manually) and links to it.
Some push CDNs support FTP. Others, like Amazon Cloudfront, support REST, SOAP and other protocols.
The idea is that the user, or the primary server, takes responsibility for providing content to the CDN, pushing it to the network. This is flexible: users can specify the content that is uploaded, when it expires and when is is updated.
This method is also the most efficient in terms of how the traffic is used. Content is uploaded only when it is new or changed, thus keeping traffic to a minimum.
Origin Pull CDNs
An origin pull CDN works very differently from a push CDN. Instead of the user taking responsibility for putting files onto the CDN, the CDN does it for them.
With a pull CDN, the site owner leaves the content on their server and and rewrites their URLs to point to the CDN. When asked for a specific file, the CDN will first go to the the original server, pull the file and serve it.
The CDN will then cache that file until it expires.
Pull CDNs are easy to set up, and this method also minimises storage space. However, it’s less flexible can create redundant traffic as files are re-queried before they have been changed.
This method of content delivery is can also be slower. People who are trying to access the file for the first time, or accessing it after it has expired, may notice a small difference in speed. Setting the expiration correctly can help to minimise this problem, but it can involve trial and error.
Choosing the Correct CDN
- Sites that receive a great deal of traffic work best with pull CDNs. Content remains relatively stable and the traffic is spread out fairly evenly, so it makes sense to limit unneeded content pulls by allowing the webmaster to set a higher expiration. This ensures that the vast majority of visitors get served content cached on the CDN.
- Sites with minimal amounts of traffic will fare better with the push system; the content is put onto the CDN once and left up, rather than re-pulled at regular intervals.
If this is confusing think about a podcast: most of the episodes are older and rarely accessed, but also never updated. The podcast is likely best served over a push CDN.
However, a high-traffic image hosting site would be best with a pull CDN because the traffic will be evenly spread.
Choosing the Right CDN
If you’re not sure what to choose, don’t panic. Either system can work. You may just need to spend more time tweaking the settings to get the most benefit.
Remember: using a decent CDN is better than not using one at all, even if it’s not the ‘right’ type. CNDs mean better performance, happier users and improved search engine rankings.