[Traceability] What is CDN

Original link https://www.zhihu.com/question/36514327/answer/1604554133

CDN

The Content Delivery Network (CDN) is a distributed network that is established and covered on a bearer network and is composed of a cluster of edge node servers distributed in different regions.

CDN is widely used and supports content acceleration in multiple industries and multiple scenarios, such as: small image files, large file downloads, video and audio on-demand, live streaming media, site-wide acceleration, and security acceleration.

Borrow the example from the official website of Alibaba Cloud to briefly introduce the working principle of CDN.
Assuming that the domain name accelerated by CDN is www.a.com, after accessing the CDN network and starting to use the accelerated service, when the end user (Beijing) initiates an HTTP request, the processing flow is as follows:

  1. When an end user (Beijing) initiates a request to a specified resource under www.a.com, it first initiates a domain name resolution request to LDNS (local DNS).
  2. LDNS checks whether there is an IP address record of www.a.com in the cache. If there is, it will be directly returned to the end user; if not, it will be queried to the authorized DNS.
  3. When the authorized DNS resolves www.a.com, it returns the IP address corresponding to the domain name CNAME www.a.tbcdn.com.
  4. The domain name resolution request is sent to the Alibaba Cloud DNS scheduling system, and the best node IP address is assigned to the request.
  5. LDNS obtains the resolved IP address returned by DNS.
  6. The user obtains and resolves the IP address.
  7. The user initiates an access request to the resource to the obtained IP address.
  • If the node corresponding to the IP address has cached the resource, the data will be directly returned to the user. For example, in steps 7 and 8 in the figure, the request ends.
  • If the node corresponding to the IP address does not cache the resource, the node initiates a request for the resource to the source station. After the resource is obtained, the resource is cached to the node, for example, the Beijing node in the figure, combined with the user-defined caching strategy, and returned to the user, and the request ends.

You can learn from this example:

(1) CDN acceleration resources are bound to domain names.
(2) To access resources through the domain name, first find the IP of the CDN node (edge ​​server) closest to the user through DNS.
(3) When accessing the actual resource through IP, if there is no cached resource on the CDN, the request will be sent to the origin site The resources are cached on the CDN node, so that the CDN node will have a cache of the corresponding resources the next time the user visits.

Guess you like

Origin blog.csdn.net/weixin_43361722/article/details/114952242
cdn