In this article, you will learn:
A majority of today’s content on the internet is served from a physical location (server or data center), so the web content must travel to the user from these distinct locations to their computer through the internet. If this user is hundreds of kilometers away from your server, it is possible that your website will load slowly to them just because of the latency caused by this distance. So theoretically if you need to serve your content to every continent and close to your users, you will need a copy of your content on multiple servers. This idea is great, but it could be very expensive and very complicated to manage.
What is a Content Delivery Network?
It's a service used to accelerate the whole site delivery and it’s static and dynamic content, large file downloads, and video streaming from your server. With a CDN this kind of content can be cached (saved for some time) in multiple locations at once, on servers all over the world. These locations are known as PoPs (Points of Presence), sometimes also as edge locations and they are strategically located in populated areas with the most demand.
When a user requests content from a website served through a CDN server, they are automatically routed to the PoP, which is the closest to them and if it is possible, this content is served to them from these caches. If not, it is served from other PoPs closest to the user or the origin server and then it can be cached for the next user. So the CDN serves the cached content instead of the origin servers doing it over again.
If the content is served through a CDN, your users also benefit from higher availability and reliability, because a copy of your content is saved on servers around the world. It’s also possible that the majority of all requests will be served by the PoPs and your servers can benefit from less network traffic which improves their overall performance. This was a basic Content Delivery Network definition. But in today’s world, a CDN provides much more functionality like DDoS protection, an additional layer of security to your servers, traffic management, and more.
The advantages of a CDN and why should you use it
The main reason why businesses should consider a CDN is that the content will be distributed to their users from the nearest location possible, which in the end will lower the latency. And why is this so important? People will always look for ways to be somewhere faster, to avoid traffic jams or waiting in line, even if they gain only a couple of extra seconds of time. If you have a choice, you will choose the fastest route possible. And how much does speed actually matter in terms of website loading?
One in four people will leave a webpage that takes more than 4 seconds to load.
One in two people will leave a mobile site that takes longer than 10 seconds to load.
Three in five won’t return to that site.
46% of users won’t return to a poorly performing website.
It is key to have a fast and responsive site if you want to be successful in SEO optimization. Search engines like Google and others will give your site a score, also based on the performance of the website.
The second reason and advantage of a Content Delivery Network to take into consideration is that it will lower your cost for data transfer from your origin server because the most desired content will be cached in PoPs and your origin server doesn’t have to serve as many requests as it would normally do.
Cases when it may make less sense to implement a CDN
Your website or application gets low traffic: If you have a few users or customers, caching won’t really work. When you don’t have enough visitors, your content will not be cached, because it looks like that nobody needs it.
Your customers or users are always from the same geographic location: If you are running a website or application for a local user or a customer, you don’t need to cache your files all over the world.
What are the pros and cons of a CDN?
It’s useful to know a couple of pros and cons of a Content Delivery Network.
General CDN benefits:
Reliability, high availability, and better performance: This is one of the main benefits of CDN usage. Data that should be accessible to your users at any time are replicated on multiple servers, so if your origin is unavailable, PoPs can easily manage that for you. You can also redirect users to other origin servers if one of them is not responding.
Scalable service: Protects your origin server from traffic spikes and it is easily and automatically scalable to your needs.
Security: Adds another layer of security to your origin and you are easily able to withstand DDoS attacks with specific functions. Protect not only your content but also your infrastructure behind it.
CDN advantages for specific use cases:
Websites and applications: Leverage low latency, high availability, and security.
Gaming: Responsiveness, low latency, and reliability are what gamers look for. This is something that can be achieved by using a CDN.
E-commerce: A CDN helps to deliver the content of your e-commerce site faster and more efficiently.
Video streaming: A CDN minimizes buffering and delays and it’s the most reliable way to get your content in front of numerous viewers anywhere in the world.
Possible cons and disadvantages to using a CDN:
Implementing a CDN comes with a lot of benefits and advantages to businesses, from improved performance to better security. But the CDN market is competitive and as in any other business, here is also important to choose a reliable partner for your project. A CDN provider with a proven track record for your use case, solid infrastructure, and accessible support. If stability and reliability are what you are after, it is best to avoid free CDN services, since any potential saving benefits will be outweighed by considerable disadvantages.
Some of those to look out for are:
Location of edge servers: If most of your users are located in a country where the CDN has no servers, the data on your website may have to travel further than without using any CDN. It’s best to do some research to find out where all the servers of the CDN provider are located and if your users are close to their servers.
Support availability: The question of the quality of the technical support arises when you have someone else responsible for running the CDN service. In case of a technical issue, even if rare, you should know how long it takes for the specialist to fix the problem and if there is enough capacity from their side to check the issue immediately or in very little time.
Network filters and block access: It is not uncommon for some countries or organizations to block entire domains or IP addresses of popular free CDN services. Often these types of regulations are connected to geographical, political, and commercial boundaries in the real world. It’s always good to look for CDN Services which have enough resources and can watch for such regulations.
Wanna find out how can a CDN help your particular project?
Amazon CloudFront CDN
Amazon is offering its own CDN service called CloudFront. Businesses can leverage multiple benefits of using a CDN from Amazon. It speeds up the distribution of static and dynamic content and it has some unique functionality for video streaming. It offers a lot of features and it can be easily managed via the AWS management console. CloudFront is tightly integrated with other AWS services, like Elastic Load Balancer, EC2, S3, etc.
Every modern website is often built using static and dynamic content. Static content includes text, images, style sheets, and other objects. Dynamic content includes components of the website that are personalized to each viewer. CloudFront is designed for both.
To deliver content to users, CloudFront leverages a distributed network of PoPs around the world. These PoPs or Edge locations consist of data centers specifically built to deliver content to your users. In addition to these Edge locations, Amazon has built bigger Regional CloudFront caches. These can save much more content than normal Edge caches. At this time there are more than 225 edge locations and more than 12 regional caches strategically located around the world.
Security of a CloudFront distribution is associated with its ability to connect to multiple AWS services such as AWS Shield, AWS Web Application Firewall (WAF), and Amazon Route 53 and to run smoothly with them to create multiple layers of security to withstand DDoS attacks and other possible threats. With Amazon CloudFront as an entry point to your network, you move possible attacks to its level and protect your underlying IT infrastructure.
You can also easily set up SSL and TLS for delivery of your content via HTTPS and use integrated services such as AWS Certificate Manager (ACM) to handle your certificates, or you can use your own.
Amazon CloudFront will also provide you with some specific functions to restrict access to your website. For example geo-restriction, so you can choose from which countries people connect to your website.
If you need to be compliant with standards like PCI-DSS Level 1, HIPAA, and ISO 9001, ISO 27001, SOC (1, 2, and 3), because you handle sensitive data, CloudFront has got you covered.
By using Amazon CloudFront’s extensive network of PoPs around the world your content can be saved in caches and distributed to your users during traffic spikes. This lowers the load on the origin servers and they are only used in times when really needed. This brings a higher availability to your users.
With CloudFront you can set up multiple origin servers for your content distribution and also an automatic failover, should your main server go offline.
Amazon CloudFront always finds the fastest way to deliver your content by constantly measuring the speed of transfer through multiple routes to ensure that each request reaches your server as quickly as possible. For communication with other AWS services, Amazon CloudFront uses AWS Backbone network (Amazon’s custom-built network with the highest standards), which enables the effective transfer of data between Edge Locations and services like EC2, S3, etc.
Pricing and cost-effectivity
Like with any other service from AWS, you only pay for what you use with pay-as-you-go pricing. There is no commitment and no minimum fee. There is also the Free-Tier for 12 months with 50 GB of Data Transfer Out and 2 000 000 free requests via HTTP or HTTPS each month. In general, you do not pay for transfers between AWS services and Amazon CloudFront. The overall cost depends on multiple factors such as Data Transfer Out, Number of HTTP/HTTPS requests, Invalidation, Field Level Encryption, or Log requests.
Read more about CloudFront pricing in our article.