What is a CDN?
Last updated 2022-05-02
A content delivery network, or CDN, is a network of servers distributed all across the world that work together to make delivering content to your users faster and more efficient.
Before you begin
We recommend reading the What is caching? essentials guide to understand some of the key concepts and terms we’ll be using in this guide.
How CDNs work
If you have a website or application, you want to give your users the best experience possible. Part of that great experience is delivering the content your users request quickly. Where your users exist in relation to your content is an important variable that determines how quickly data is delivered and, as a result, how quickly your website or application loads for them.
In our What is caching? guide, we learned that when a user accesses your website, multiple simultaneous requests and responses are sent between the browser and wherever you're hosting your website's data. Depending on how you choose to host your content, the assets users request may exist on your servers in a data center (or hosting facility) or in applications running on cloud services on someone else's servers. It may even exist on a combination of those two. These source servers (frequently referred to as origins, backends, or hosts interchangeably) exist in a specific geographic location and so does your user. However, those two locations aren't always close to each other.
The greater the physical distance between your user and your origin servers, the more time the user will spend waiting for the content - this is called latency. The closer the destination (your user) is to the origin (your content), the lower the latency and the faster your website loads.
A CDN helps you lower latency by temporarily storing copies of your content in cache locations close to your user. CDN services have caches all over the globe, so when a user requests your content, the CDN can intelligently deliver the content from a cache located close to the user. This reduces the time to deliver content, thereby making your website load much faster.
Along with caching content, CDNs can help you update content quickly using a process known as purging. You might use purging to remove incorrect or older content from the cache and replace it with the most up-to-date information. You can learn more about purging in our guide to purging.
Benefits of using a CDN service
Besides helping you lower latency and deliver content faster, a CDN provides several other benefits: availability, scalability, and security.
When you use a CDN, you can still serve requests for content even if your origin servers are unavailable. This is because CDNs can serve cached content even if your service is interrupted. Additionally, serving more requests from the CDN instead of your origin means you can lower your egress costs, which is the cost hosting providers charge to move content out of storage.
A CDN can also help you lower infrastructure costs by automatically scaling to handle the vast majority of your traffic. You don’t want your website to buckle when traffic volumes increase, but you also don’t want to spend money on unused servers when traffic isn’t at its peak. By using a CDN, you can provision fewer servers and let the CDN automatically scale for high demand.
Not all demand is good, however. A DDoS attack is a common method used by cybercriminals to send a flood of unwanted traffic to your site in an attempt to render it unusable. By using a CDN, you can protect your origin from being hit with that traffic. The CDN can handle the load by helping you block the attack and continuing to route valid traffic throughout the network, ensuring your site stays online.
Unpredictable traffic spikes, security events, and a long list of other factors can make your content slow to render or, worse yet, entirely unavailable. By relying on a CDN instead of a single origin, you can mitigate those risks and save money in the process.
Fastly’s CDN service functions much like a traditional CDN but with added benefits.
Event-driven content, on the other hand, is harder to cache because it changes at unpredictable intervals. Event-driven content includes things like sports scores, weather forecasts, breaking news, and current store item inventory. Having to serve event-driven content from your origin is taxing on your server and costly. However, with Fastly’s architecture and purging capabilities, you can cache event-driven content for a period of time and, when it changes, programmatically purge it. (Typically this can be done as quickly as 150 milliseconds on average!)
Being able to cache both static and event-driven content allows you to deliver a faster user experience and reduce the demand on your origin, which gives you the dual benefits of stability and cost savings.
Fastly can also cache video content. Video content includes live video streams and video on demand (VOD) content libraries.
Part of what enables Fastly to cache static and event-driven content is where we deliver our service from. Fastly delivers its CDN service from key access points to the internet called points of presence (POPs). Each POP has a cluster of Fastly cache servers that receive and process requests for your content. Compared to the typical CDN service, Fastly chooses to employ fewer, more powerful POPs in strategic locations enabling you to serve more from cache than origin. Another unique option available to help reduce load on your origin is shielding. When you enable shielding, the shield POP you select will pull content from your origin and distribute it to other cache servers. Requests that can't be served from a POP's cache are directed to the shield POP instead of your origin.
Fastly, like all CDNs, relies on a combination of open source and proprietary software to make our technology work. Fastly uses Varnish as an underlying technology because of its fast speed and because of the flexibility offered by its configuration language, Varnish Configuration Language (VCL). We extend the flexibility of VCL to you by allowing you to customize VCL to generate and compile changes to your Fastly services. These changes can be loaded, activated, and distributed to all Fastly caches worldwide without requiring maintenance windows or service downtime.
We recommend reading our guide on purging before getting started with Fastly. Getting started with Fastly is as simple as creating an account, connecting your origin server, and adding your domain name. You can do this completely through the web interface or you can use the Fastly API.
Do not use this form to send sensitive information. If you need assistance, contact support.