CDN

The term CDN may come across a lot of articles, or when you need an experienced person to advise on how to save server bandwidth and speed up your website, you will hear advice about using CDN. So what exactly is the CDN, how many CDNs are there, and is your website suitable for using the CDN, this article will provide you with the necessary information.
CDN

What is CDN?

CDN stands for Content Delivery Network and it is best not to try to translate it into Vietnamese but to understand it in English to avoid deviation, or if you understand, you should translate it into " content distribution network " ok than. This means that it is a global server system (depending on the number of service providers) that saves the copy of static content within the website, then disperses it to many other servers ( This is called PoP - Points of Presence ) and from those PoPs it will be sent to users when they visit the website.
First, we look at the different model between a website that does not use CDN and a website that uses CDN.

Do not use CDN

When a user views a file without a CDN, they have sent a direct request to the server containing the website to access the file.

Use CDN

When a file is distributed by the CDN, the user accesses it, the closest PoP distribution compared to the user will return the content to the user.

Some forms of CDN

When using some CDN services (excluding CloudFlare or similar CDN proxy services), you will find that they support some types of CDN use including:

Pull HTTP / Static

This means that you declare the domain name of the website that needs to use the CDN or server IP. After that, the PoP CDN will automatically access the website by that domain name and save a copy of the entire static content inside the website (images, CSS files, Javascript files, Flash, Video, ...). . And then you can access a file on the website with the CDN link they provide or use a separate domain name for CDN.

POST / PUSH / PUT / Storage CDN ...

This can be called with many different names. But it has one thing in common: instead of the PoP CDN will collect content on the website itself, you will upload content directly distributed via CDN to their server via popular protocols such as FTP or HTTP. Usually they support FTP the most.
And with this distribution method, you will be able to save storage space on the server because there is no saving there.

Streaming CDN

Although the above CDN types support video files, it does not support streaming live video playback. So this method will help CDN distribute content streaming from the server and then redistribute it to users to save bandwidth from the original streaming server. Or you can choose to upload streaming content directly to CDN server like Push CDN.

Advantages when using CDN

So after you understand how CDN works, you will realize that it has the following advantages:

Save bandwidth for the original server

The bandwidth from the original server's network only takes one processing, which is to accept the request from the PoP CDN, then the visits from the users will only access the content on the CDN so the original server will not cost more. . Only when you proceed to delete copies of the content stored on the CDN will the PoP CDN proceed to retrieve the content again for additional cost.

Speed ​​up hits

Due to the nature of the PoP CDN stretching across continents, it will help your website access faster for users away from the website's server. For example, thachpham.com places servers in the US but if it is accessed directly to see a 300KB image in Vietnam it will take about 0.5 seconds (500ms). But if thachpham.com uses CDN for the static content that supports PoP in Vietnam, the user only takes 0.01 seconds (10ms) to view a file, even faster.
Similar to users in other countries, the more CDN you have, the more PoP in different countries, the more beneficial it is to speed up the global website.

Save space

If you use the Push CDN method, it will save storage space for the server because everything has been uploaded directly to the CDN server. However, to be safe you should save the content somewhere in case the CDN service has problems.

Cost savings

Cost savings here are bandwidth costs. Assuming your host or host package only supports a certain amount of bandwidth per month, then you will need to buy more or upgrade the bandwidth. The price of bandwidth is not so cheap, the average bandwidth price on some host providers is about 20,000 VND per GB, equivalent to $ 0.88 already. But today's CDN services will most likely cost about $ 0.05 or less, and in some Asian PoPs, if it is more expensive, it's about $ 0.1 per GB of bandwidth. So instead of buying more bandwidth at the host, use CDN will be much more economical.

When should I use CDN?

CDN has many benefits to use and it is one of the requirements that many websites have to use. But not all websites are necessary to use, but CDN is only useful when:
  • The server of the website is located far away from the user.
  • Large hits cost a lot of bandwidth.
  • There are many visits in many different countries.
  • When using Load Balancing FailOver technique.

When is it not necessary to use CDN?

As I said above, in many cases you do not need to use CDN because not only does it help the website faster but also slower. And one of the most common reasons is that the website server is located near the user. For example, if you have a server in Vietnam and serve users in Vietnam, but you use CDN but if that CDN does not have PoP in Vietnam, your website will be slower because then your users will access it at Other PoPs are farther away than the current root server so they become slower.
Similar to the CDN proxy service like CloudFlare, the website located on the server in Vietnam that uses it, the users in Vietnam will enter later than usual.

Notes when choosing CDN service

When you proceed to find a good and suitable CDN service for long-term use, you should pay attention to their PoP system. It's best to prioritize the PoN-supported CDN services in the country where you have the most users. For example, if you choose CDN for Vietnam website, you should prioritize CDN services with PoP in Vietnam such as CDNSun, CDN.Net, ... Each provider has the Network section so you can see their PoP system should be noted Please see carefully before using.
In addition, the second important thing is the price and form of payment. CDN services now support two types of payments: using how much you pay (Pay-as-You-Go) or paying a fixed fee each month for package use. If your website costs a lot of bandwidth, you should choose the payment method as pay-as-you-go, which will be more economical because you buy it when you don't use it all.
The final note is speed, this you can verify using the service and ping the CDN address using the App Synthetic Monitor CA service  to see if it is really optimized. Or you can refer to the online CDN reviews.

Some free CDN resources

CloudFlare

This is a popular proxy service that supports free CDN. If your website hosts in the US or Europe, this service will help you optimize the website speed very much for visits in Vietnam.
It is not the same as the simple CDN service that I mentioned above, you cannot use a separate domain for CDN and cannot upload content to their CDN server but it will work using a central proxy class. Time for domain names. When users visit your website, they will go through a proxy class and there it has CDN available to distribute the content in the page, the website's URL is not changed.

Photon

This is a special service for WordPress users who have installed the JetPack plugin. It will manually upload image files on the Photon CDN server and distribute it to users to save bandwidth and page loading time.

jsDelivr

This is a CDN service for Javascript libraries. For example, instead of hosting the jquery.js file of the jQuery library, you can use the jsDelivr CDN link. Currently it supports more than 1650 different libraries, almost every popular Javascript library is there. The simple usage is to embed a Javascript file to their link instead of a self-host.
If you are a WordPress user, you can install this plugin so that it can change the Javascript libraries currently used in the website to link the CDN.

Google Hosted Library

Like jsDelivr, you can use Javascript library links on Google's CDN server to save bandwidth.

Some popular CDN services

  • Amazon CloudFront
  • MaxCDN
  • CDN77
  • Akamai CDN
  • CacheFly
  • CDN.Net
  • CDNSun (with PoP support in Vietnam)
  • KeyCDN
  • CDN.Com.Vn (only PoP in Vietnam)
  • EdgeCast
  • CDNlion
  • SoftLayer
  • WPPronto
Source: Thạch Phạm Blog .

Disqus Comments