1. What is CDN?

2. What is the principle of CDN acceleration?

3. Why use CDN?

With these questions in mind, look for answers in the text

Introduction to the

The full name of CDN is Content Delivery Network. Its purpose is to add a new layer of CACHE(CACHE) layer in the existing Internet, the content of the website will be published to the nearest user’s network “edge” node, users can get the content needed nearby, improve the response speed of users to visit the website. From the technical comprehensive solution because of the network bandwidth is small, the user visit is large, the network distribution is not equal, improve the response speed of the user to visit the website, reduce the bandwidth budget allocation, improve the content availability, enhance the website security

In simple terms, the working principle of CDN is the resource cache will stand you source into a world of CDN node, when the user requests resources, returned to the nearest node cache resources, without the need for each user’s request to return to your source all stand for, to avoid network congestion, reduce the pressure on the source station, speed and experience to ensure users to access resources.

CDN content distribution network is the same as e-commerce warehousing (Tmall Supermarket) in front warehouse: goods are sent from the place of origin to Tmall supermarket and then unified delivery

CDN is also a way for the nearest server to send you the data you want,

If the nearest server does not cache the data, it will request the superior to cache the data to the nearest CDN server

Traditional web site request response process

1. Enter the website domain name

2. The browser requests the local DNS server to resolve the domain name

3. If the resolution result of the domain name is cached on the local DNS server, the local DNS server directly responds to the resolution request.

4. If the local DNS server does not cache the resolution result of the domain name, it iteratively sends a resolution request to the entire DNS system (corresponding DNS server) and sends the response to the browser

5. The browser obtains the domain name resolution result, which is the IP address of the service device corresponding to the domain name

6. After obtaining the IP address, the browser establishes a TCP connection through the standard TCP handshake process.

7. The browser sends an HTTP request to the server.

8. The server sends the requested content to the browser.

9. Disconnect the TCP connection after the standard TCP wave off process.

User access experience after the introduction of CDN

  • When a user clicks a URL on a website, the URL is resolved by the local DNS system. If the local DNS server does not have the corresponding domain name in cache, the local DNS system grants the domain name resolution right to the CDN dedicated DNS server pointed to by the CNAME.
  • The DNS server of the CDN returns the GLOBAL load balancing device IP address of the CDN to the user.
  • The user sends a URL access request to the global load balancing device of the CDN.
  • CDN The global LOAD balancing device selects a regional load balancing device of the region to which the user belongs based on the USER IP address and URL requested by the user and forwards the request to the device.

(THE CDN global load balancing device will select a server that is close to the user and has fast access to the user.)

  • Based on the comprehensive analysis of the following conditions, the LLB selects an optimal cache server node, obtains the IP address of the cache server from the cache server node, and returns the obtained IP address to the global load balancer:
    • Determine which edge node is closest to the user based on the user IP address.
    • According to the content name carried in the URL requested by the user, judge which edge node has the content required by the user;
    • Query the current load of each edge node to determine which edge node has service capability.
  • The global load balancer returns the IP address of the server to the user.
  • The user sends a request to the cache server. The cache server responds to the request and sends the content required by the user to the user terminal. If the cache server does not have the content the user wants, and the zone balancer still allocates it to the user, the server requests the content from its upper-level cache server until the source server that traces it back to the web site pulls it locally.

The CDN global load balancing device will select a server that has the content required by the user’s request, is relatively close to the user, and has fast access to the user

Of CDN

Content distribution network (CDN) is similar to cainiao’s warehouse distribution system. CDN is composed of multiple nodes. Generally speaking, CDN mainly consists of central nodes and edge nodes

Center node

The central node includes the CDN network management center and the global load balancing DNS redirection resolution system, which distributes and manages the entire CDN

Edge node

CDN edge node mainly refers to the remote distribution node, which is composed of load balancing device and cache server.

The load balancing device balances the load of each Cache on each node to ensure the working efficiency of the node. In addition, it collects information about nodes and the surrounding environment and communicates with the GLOBAL DNS to implement load balancing of the entire system.

A Cache is responsible for storing a large amount of information about a customer’s website, acting as a website server close to the user in response to local users’ requests for access. Through the control of global load balancing DNS, users’ requests are transparently directed to the nearest node, and the Cache server in the node responds to the end users’ requests just like the original server of the site. Its response time is faster because it is closer to the user.

CDN related technology

CDN related technology and cainiao’s warehouse matches

Warehouse distribution technology:

1. Send the goods from the main warehouse to each city warehouse

2. How to store goods in the local warehouse

3. According to the user’s address, the system intelligently assigns which warehouse to deliver goods from first

4. Manage and monitor the warehouse

Content distribution

It uses indexing, caching, stream splitting, Multicast and other technologies to publish or deliver content to the nearest remote service point (POP).

Content store

For CDN system, two aspects of content storage need to be considered. One is the storage of the content source and the other is the storage of the content in the Cache node.

Content routing

It is a holistic network load balancing technology that balances user requests over multiple remote pops through the redirection (DNS) mechanism in the content router so that the user requests a response from the nearest content source.

Content management

Through internal and external monitoring systems, it obtains the health information of network components and measures the end-to-end performance of content publishing (such as packet loss, delay, average bandwidth, startup time, frame rate, etc.) to ensure the optimal running state of the network.

DNS

1, DNS is a domain name system, is on the World Wide Web as bai domain name and IP address mapping of a distributed database, enabling users to more convenient access to the Internet, without having to remember the number of IP can be directly read by the machine.

2. Meaning: The process of obtaining the IP address corresponding to the host name is called domain name resolution (or hostname resolution). When resolving a domain name, you can first use static domain name resolution. If static domain name resolution fails, you can use dynamic domain name resolution. A domain name is an identity on the Internet and a unique resource that cannot be repeated. The globalization of the Internet makes domain name become a national strategic resource to mark the sovereignty of a country.

3. The resource records of a zone are manually or automatically updated to a single master DNS server (called the master DNS server). The master DNS server can be the authoritative name server for one or more zones.

reference

Juejin. Cn/post / 684490…