Most highload apps and websites need a content delivery network. If there isn't one, content will be loading too slowly and the interface will take time to react to user actions. That's never good.
Everyone wants their content to be delivered rapidly and reliably, but not everyone is ready to experience all the joy of integrating a CDN on their own. Luckily, Contentful, being a content platform, comes with a properly set up CDN, meaning: if you use Contentful for content management, you get reliable and fast delivery by default. No technical maintenance and setup efforts would be required from your side.
The rest of this post will show the setup behind Contentful CDN in a bit more detail.
For those who just joined: CDN, a content delivery network, is a number of servers, typically distributed across the planet. The purpose of using a CDN is to have content delivered to users faster. For a small personal website or a blog one virtual private server is enough, but for a website with 25k hits per second it just does not work.
When a CDN is in place, every incoming request will be routed to the closest server – the one with the best latency – to maximize the delivery speed: a visitor from Germany gets content from a server in Frankfurt, and a user from San Francisco is greeted by a machine somewhere in California.
A CDN also takes care of caching – keeping copies of earlier requested documents, and making them available for future requests. Caching greatly speeds up content delivery.
Contentful setup is based on two CDNs: one for JSON documents, and another for media assets and binary files. That way each one is optimized to perform its particular job well.
Fastly is a modern CDN with strong geographical presence used by some renowned companies such as Vimeo, Twitter, GitHub and many others. Contentful relies on Fastly to rapidly respond to every API request with a JSON document.
Going a bit deeper, we've selected Fastly because of some features not offered by its competitors. Apart from being present in a billion locations (almost), it also enables purging the cache after every content update within minutes, globally.
CloudFront is another industry standard – a CDN provided by Amazon as a part of its AWS cloud products. Used for delivering media assets and binary files in Contentful, it's notable for great location coverage. Our setup includes long expiration time to maximize caching, and also generates URL for new assets on every update, so they feel instant.
This setup ensures rapid and reliable content delivery, both in theory and in practice: you might want to take a look at the (rather reassuring) latest performance metrics. This comes with a huge benefit of having exactly zero work to do: we've set up everything, and you can simply enjoy the 99,99% uptime.
In case you'd like to know more about the entire setup behind Contentful as a content platform, take a look at our previous post: API and beyond: a content platform, not just a CMS.