Introduction to Content Delivery Networks

Introduction to Content Delivery Networks

Unless you are Warren Buffet, you will most likely need a fancy website with images, videos, and unique styles to capture the attention of your audience. But usually all of this can sum up to a lot of data. Images and videos are heavy. CSS and JS code combined for even a regular website can be a significant amount.

To reduce the load of all of these things that you can put in public and ensure fast delivery to the people who are viewing your website, you can use a CDN (Content Delivery Network). A CDN is designed to deliver all static assets of a website like images and videos to end users at a fast speed.

CDNs are a globally distributed set of servers that cache your static assets whenever any user visits your website for the first time. All the subsequent requests from that user and other users will be a lot faster because they will be receiving a cached copy of the asset. CDNs are geographically located in a higher number of locations, and that ensures that your user will receive the cached as quickly as possible. The load times for images, videos, and styles will be reduced, and your users will have a better experience.

Unless you are deploying your applications on the edge, most application servers are present in only one or just a couple of locations. Even if you're deploying on the edge, using a CDN to serve static assets is a better choice as it reduces the number of requests on your servers and reduces the load on your application servers.

A couple of widely used CDNs are Cloudflare, Amazon CloudFront, and Akamai CDN.

I like to use Cloudflare because it's free and has a great onboarding experience. I use it for a number of my projects. I connect Cloudflare to a public bucket on BackBlaze and then when once the cache gets built, Cloudflare serves assets at fast speeds.

This is a great article on how to connect a BackBlaze bucket to Cloudflare to cache assets for your website: https://help.backblaze.com/hc/en-us/articles/217666928-Using-Backblaze-B2-with-the-Cloudflare-CDN