Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the acceleration principle of CDN?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "what is the acceleration principle of CDN". In daily operation, I believe many people have doubts about what is the acceleration principle of CDN. Xiaobian consulted all kinds of materials and sorted out simple and easy operation methods. I hope to help you answer the question "what is the acceleration principle of CDN"! Next, please follow the small series to learn together!

1. What is CDN

The full name of CDN is Content Delivery Network, i.e. Content Delivery Network. Its purpose is to add a new CACHE layer in the existing Internet, and publish the content of the website to the node closest to the user's network "edge", so that the user can get the required content nearby and improve the response speed of the user's visit to the website. Technically, it comprehensively solves the problems of small network bandwidth, large user access and uneven distribution of network points, and improves the response speed of users visiting websites.

Simply put, the working principle of CDN is to cache the resources of your origin site to CDN nodes located all over the world. When users request resources, they return the resources cached on the nearest node instead of returning every user request to your origin site to avoid network congestion, relieve the pressure on the origin site, and ensure the speed and experience of users accessing resources.

CDN node

The optimization effect of CDN on the network is mainly reflected in the following aspects

Solving the server-side "first mile" problem

Mitigates or even eliminates bottlenecks in connectivity between different operators

Reduced export bandwidth pressure in provinces

Relieves pressure on backbone networks

Optimized distribution of hot content online

II. Working principle of CDN

traditional access process

traditional access process

As can be seen from the above figure, the process for users to visit websites that do not use CDN cache is as follows:

1. The user enters the domain name, and the operating system queries LocalDns for the IP address of the domain name.

2. LocalDns queries ROOT DNS for the authoritative server for the domain name (assuming LocalDns cache expires here)

3. ROOT DNS responds to LocalDns with domain name authorization dns records

4. LocalDns obtains the domain name authorization dns record, and continues to query the domain name authorization dns for the IP address of the domain name.

5. Domain name authorization dns queries domain name records and responds to LocalDns

6. LocalDns responds to the client with the domain name IP address

7. After the user gets the domain name ip address, visit the site server

8. The site server responds to the request and returns the content to the client.

CDN access process

CDN access process

From the above figure, we can understand that the visit process of the website after using CDN cache becomes:

1. The user enters the domain name, and the operating system queries LocalDns for the IP address of the domain name.

2. LocalDns queries ROOT DNS for the authoritative server for the domain name (assuming LocalDns cache expires here)

3. ROOT DNS responds to LocalDns with domain name authorization dns records

4. LocalDns obtains the domain name authorization dns record, and continues to query the domain name authorization dns for the IP address of the domain name.

5. Domain name authorization dns queries domain name records (usually CNAME) and responds to LocalDns

6. After LocalDns obtains the domain name record, it queries the IP address of the domain name from the intelligent scheduling DNS.

7. Intelligent scheduling DNS responds to LocalDns with the IP address of the most suitable CDN node according to certain algorithms and policies (such as static topology, capacity, etc.)

8. LocalDns responds to the client with the IP address of the domain name

9. After the user gets the domain name ip address, visit the site server

10. The CDN node server responds to the request and returns the content to the client. (The cache server stores the data locally for later use, and returns the acquired data to the client to complete the data service process.)

Through the above analysis, we can get that in order to realize transparent access to ordinary users (user clients do not need to make any settings after using cache), DNS(domain name resolution) needs to be used to guide users to access Cache servers to achieve transparent acceleration services. Because the first step of a user visiting a website is domain name resolution, it is the simplest and most effective way to guide users through modifying dns.

Elements of a CDN network

For the average Internet user, each CDN node is equivalent to a web server placed around it. By taking over dns, the user's requests are transparently directed to the node closest to him, where the CDN server responds to the user's requests just like the original server of the site. Because it is closer to the user, the response time is necessarily faster.

The block circled in phantom in the above diagram is the CDN layer, which is located between the client and the site server.

Intelligent Scheduling DNS(e.g. 3DNS for f5)

Intelligent scheduling DNS is a key system in CDN service. When a user visits a website that joins the CDN service, domain name resolution requests will ultimately be handled by "Intelligent Scheduling DNS." Through a set of predefined policies, it provides the address of the node closest to the user at that time to the user, so that the user can get fast service. At the same time, it needs to maintain communication with CDN nodes distributed in various places, track the health status, capacity and other information of each node, and ensure that user requests are distributed to the nearest available nodes.

cache function service

Load Balancer Equipment (e.g. BIG/IP for lvs,F5)

Content Cache Server (e.g. squid)

shared storage

III. Explanation of nouns

CNAME record

CNAME is alias ( Canonical Name ); can be used to resolve a domain name to another domain name, when the DNS system queries the name on the left of CNAME, it will turn to the name on the right of CNAME and then query, until the last PTR or A name is traced. The query will only respond after success, otherwise it will fail.

For example, if you have a server with a lot of data, and you use docs.example.com to access these resources, but you want to access them through documents.example.com, you can add a CNAME record to your DNS resolution server, pointing documents.example.com to docs.example.com. After adding this CNAME record, all requests to access documents.example.com will be forwarded to docs.example.com and get the same content.

CNAME domain name

When connecting to CDN, after adding accelerated domain names in the CDN provider console, you will get a CNAME domain name assigned to you by CDN. You need to add CNAME records in your DNS resolution service provider and point your accelerated domain name to this CNAME domain name. In this way, all requests for this domain name will be directed to CDN nodes to achieve acceleration effect.

DNS

DNS stands for Domain Name System, which is a domain name resolution service. Its role on the internet is to convert domain names into ip addresses that the network can identify. People are used to remembering domain names, but machines only recognize IP addresses from each other. Domain names and IP addresses correspond one to one. The conversion between them is called domain name resolution. Domain name resolution needs to be completed by a special domain name resolution server. The whole process is automatic. For example: www.baidu.com entered when surfing the Internet will automatically convert to 220.181.112.143.

Common DNS resolution service providers include: Alibaba Cloud Resolution, Wanwang Resolution, DNSPod, New Network Resolution, Route53(AWS), Dyn, Cloudflare, etc.

hosting source

Backsource host: determines the specific site on the source site to which the backsource request is directed.

Example 1: The source site is the domain name www.a.com, and the origin host is www.b.com. Then the actual origin is the IP resolved by the request to www.a.com, and the site on the corresponding host www.b.com

Example 2: If the source IP is 1.1.1.1, and the origin host is www.b.com, then the actual origin is www.b.com on the host corresponding to 1.1.1.1.

protocol return

The protocol used when referring back to the source is consistent with the protocol used when the client accesses the resource. That is, if the client requests the resource using HTTPS, the CDN node will use the same HTTPS method when the resource is not cached on the CDN node. Similarly, if the client requests using HTTP protocol, the CDN node will also use HTTP protocol when returning to the source.

At this point, the study of "what is the acceleration principle of CDN" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report