A CDN (Content Delivery Network) is a website service that allows users to fetch static content (especially images, video, audio, CSS, and JavaScript) from the closest servers around, spread across the world as much as possible. A CDN network, to put it bluntly, is a bunch of proxy servers that automatically cache. So, what are the benefits of using a CDN? First, it can reduce the delay. My server is in the United States, and a round-trip communication from Beijing to the United States takes about 300ms. When I use a CDN (with a Chinese server), a round-trip communication takes less than 10ms. In addition, CDN can also effectively reduce the download time, because some countries will control the export bandwidth of network traffic, when the server in the mainland is used, the speed can be significantly improved.

How CDNs Work

Usually, you don’t need to upload files to the CDN, you just need to resolve the domain name to the corresponding server. When a user visits your website, it is equivalent to visiting this server. This server will check whether there is a cache, and if so, it will return it directly to you from the cache; if not, it will download it from the original server and return it to the user. After that, when users (again at this location) access, they will be downloaded directly from the files cached on the CDN, and the speed will be greatly improved. The more users visiting your site, the more noticeable this speed increase will be. If most of the requests are not cached, there is little speed gain. Other than that, it’s best to put the CDN’s domain name under a cookie-free root domain. The recommendation about CDN has been summarized in new article

CDN service recommendation

KeyCDN

KeyCDN is also very convenient to use, the nodes cover the world, the price is extremely low, and you pay on demand. It also has real-time logs. At the same time, it supports binding custom domain names, free custom SSL services, and provides free SSL certificates (Let’s Encrypt). KeyCDN only supports acceleration of static resources,

CloudFlare

In order to use CloudFlare, you need to change your domain’s NS resolution provider, that’s all, no other settings are required. CloudFlare defaults to dynamic resource acceleration. At the same time, a free SSL certificate (Comodo Positive SSL Wildcard) is provided, and CloudFlare has a free version.