CDN’s have become integral to delivering content across all channels. This blog post was delivered to you via a CDN! Whether you are on a desktop, mobile device, or any other web browser, it went through a CDN.
You can think of a CDN like a cache of your content distributed globally. There is going to be an origin server where your content is initially sent to or uploaded, but then that origin server does the work of distributing that content across its CDN network.
Why do you want your content on a CDN?
Because we want speed! We want our content to get to visitors as fast as possible. Here are some of the major benefits you’ll see when using a CDN:
1. Reduced Latency - Visitors get sent to the geographically closest server. This is the biggest reason for a CDN. Instead of a visitor's request having to travel across an ocean, content can be retrieved from a much closer CDN server. This could mean the difference between 500ms latency and 50ms, a 10x increase in site speed.
For example, if I am in San Diego, my browsing would be much faster if the content is published in San Francisco rather than the East-US or Europe. My request only needs to travel a few hundred miles up the coast rather than a few thousand across the globe.
2. Scalability - Having your content globally distributed means you can handle more users. The performance of your site will not degrade if you get a lot of traffic because you can handle those requests on a worldwide scale. No single server must manage every single request to your site.
3. Reliability - Because you have multiple servers worldwide, if one goes down, it does not mean the end of your app. A single CDN server can go down and traffic will re-route to the next closet server. There is not a single point of failure for delivering your content when using a CDN.
What a CDN is not?
A CDN is not a web host, but a CDN and traditional web hosting often work together.
The CDN is a cache on the edge. (You will sometimes hear people use edge and CDN interchangeably) It’s not meant to handle complex logic, it’s purpose is to deliver ready to go content, static content. So the CDN helps reduce the load on traditional web hosting by serving out the static ready to go assets to visitors. Your web hosting handles any of your dynamic content, things that cannot be stored on a CDN.
If you are familiar with Experience Edge for XM or Content Hub then you will have learned that the Preview API and Delivery API endpoints serve content from different locations. The Preview or development API endpoint does not use a CDN. It is meant for development and testing with all the data stored in a single origin server. Alternatively, the Delivery or production API endpoint does use CDNs to distribute the content worldwide. That is why the Delivery API endpoint is recommended for production.
So in the Experience Edge for Content Hub case, you work on your content within your content hub instance and then when it's ready you publish it out to CDN network. If you update the content, you again publish the updated content to replace the cache and be globally distributed.
Example CDN Networks
CDN’s are everywhere and really have become the backbone for serving content to visitors. The content you are reading now would not be possible without a CDN. YouTube wouldn’t be possible without a CDN distributing the load across the world for all the video content.
Let’s look at a few other CDN networks that you may be using:
Experience Edge for XM and Content Hub - Sitecore Experience Edge for XM and Content Hub distributes your content over a CDN. When your content is requested visitors are automatically routed to the closest CDN server to get the content for your app.
Vercel’s Edge Network - If you have a static site on Vercel or host any of your content with them you are using Vercel’s CDN network. They have over a dozen regions where content is distributed. Take a peek at all the regions of Vercel’s Edge Network. They are even doing some very cool things with Vercel’s Edge Functions that allow you to run bits of logic before your site responds to a users request. Learn more here with a recent video of mine: Getting Started with Vercel Edge functions in Next.js.
When using CDN’s like the examples above, the work is not on you to distribute the content. For Experience Edge, you publish your content and let Sitecore do the rest to distribute it. Same with Vercel, create a project to host your site with Vercel and then let them do the actual distribution work. Unless you work directly on a CDN product like Cloudflare or similar, you likely will not need to worry about ensuring content is distributed. That work is left up to someone else.
Photo by Rowan Freeman on Unsplash
So CDN’s are everywhere. If you want content to be served with the highest level of performance, you are going to want a CDN. Remember, they are not meant for running complex logic, but are great at serving ready to content to visitors across the globe.
Oldest comments (4)
A big discovery for us in the past year was G-core labs. Excellent value for money. They have excellent CDN. I bribed a list of clients, well, recommendations on Reddit of course. For now, we use CDN for the online store. The price is very affordable compared to competitors
Cloudflare doesn't have the best CDN, they stopped working with them that year. Maybe this applies only to Europe, in America they are doing great, but we found better options.
I also heard that they are not the best option for Europe
I'm interested. What option did you go with instead for Europe?