Do you use a Content Delivery Network (CDN)?
Last updated by Brady Stroud [SSW] 4 months ago.See historyIf your site takes too long to load, there is a high chance your users will not wait for it to finish loading and abandon viewing it. It is therefore important that we use techniques to make pages load as quickly as possible. One of these techniques is to use a Content Delivery Network (CDN) to reduce the network latency for delivering pages, images, javascript and CSS libraries to users. This results in faster page load times and a better experience for your users.
What is a CDN?
CDN is short for a Content Delivery Network. It is a system of distributed servers (network) that deliver pages and other Web content to a user, based on the geographic locations of the user, the origin of the webpage and the content delivery server.
Why use a CDN?
A website may be hosted in a particular region, but have the majority of its users coming from an entirely different region – for example, if your site is hosted in North America, GTmetrix(A free tool that analyzes your page's speed performance) might report fast speeds based on our default test location, but if a good chunk of your users come from China, their speed will not be as fast as you experience it to be. Using a CDN can improve your user’s experience in terms of speed, and as we know – speed matters! Ensuring a consistent experience for all your users is important. CDNs not only ensure a faster experience to your users, but they also help to prevent site crashes in the event of traffic surges – CDNs help to distribute bandwidth across multiple servers, instead of allowing one server to handle all traffic.
How to choose a CDN?
When selecting a Content Delivery Network (CDN) for your website, you face the challenge of ensuring robust edge-level redirects and effective caching to speed up your site. Unfortunately, not all CDNs provide these functionalities seamlessly, making it difficult to find one that meets these critical needs.
Front Door as Your CDN
Front Door is a good option, but it has some notable downsides regarding redirects and caching that you should be aware of:
✅ Pros:
- Easy Integration: Seamlessly integrates with other Azure services.
- Flexible Origin Handling: Better handling for origin groups on a route level (e.g., /people can be hosted on a different server).
❌ Cons:
- Limited Redirects: Front Door restricts bulk redirects with a limit of 800 resources per resource group.
- Time-Consuming Deployments: Deployments using Bicep can take a long time, sometimes up to hours.
- Lack of Flexibility: It doesn’t offer much flexibility for custom redirects, such as using regular expressions.
- Painful Cache Purging: Cache purging can be unreliable and can take up to 15 minutes.
- High Costs: It is quite expensive compared to other CDNs.
To overcome these issues, we can use Cloudflare.
Cloudflare
Cloudflare is known for its Distributed Denial-of-Service (DDoS) protection and Web Application Firewall (WAF), along with a host of other options.
✅ Pros:
- Easy Deployment: Simple deployment through Wrangler. (it takes a few seconds to deploy workers)
- Flexible Redirects: More flexible in handling bulk and customizable redirects using Cloudflare Workers.
- Enhanced Security: Provides better WAF protection and secure DDoS mitigation.
- Cost-Effective: Much cheaper than other CDNs.
- Efficient Caching: Better caching options.
- Instant Cache Purging: Offers an instant purging option for caches.
❌ Cons:
- No Azure Service integration Cloudflare cloudflare doesn't natively allow you to ingest logs into Azure
- Testing: Staging environments are only available as part of the enterprise plan, making it expensive to test changes to your CDN configuration
Which CDNs work well from China?
- https://cdnjs.cloudflare.com (recommended)
- http://www.staticfile.org/
- http://www.bootcdn.cn/
- https://intl.cloud.baidu.com/product/cdn.html
- http://lib.sinaapp.com/
- http://cdnjs.net/
- https://www.cloudflare.com/network/china/ (Cloudflare’s China Service)
- https://www.akamai.com