1, noun explanation

Origin Server Source Station: Do the real Server of the client before the CDN. A: What do you mean by a User? B: That’s right. Last Mile: The Last Mile is the path between the user and the CDN server he or she visits. CNAME record: This is an alias record (Canonical Name); When the DNS system queries the name on the left side of the CNAME, it will turn to the name on the right side of the CNAME and then search until the final PTR or A name. After successful query, it will respond, otherwise it fails. CNAME domain name: The domain name acceleration of CDN needs to use the CNAME record. After the CDN acceleration is completed in Aliyun console configuration, you will get an accelerated domain name, called the CNAME domain name (the domain name must be.kunlun.com). Users need to point their domain name as CNAME to this domain name. The work of domain name resolution is officially transferred to Ali Cloud, and all the requests of this domain name will be transferred to the nodes of Ali Cloud CDN. DNS: DNS stands for Domain Name System (DNS). Its role on the Internet is to convert domain names into IP addresses that the network can recognize. People are used to remembering domain names, but machines only recognize each other’s IP addresses. The conversion between them is called DNS. DNS need to be completed by special DNS servers, and the whole process is automatic. For example, when entering www.baidu.com on the Internet, it will be automatically converted into 220.181.112.143 edge node, also known as CDN node, Cache node, etc. Relative to the complex structure of the network, it is a concept that refers to the network node with fewer intermediate links away from the end user and has better response ability and connection speed for the end user. Its function is to save the content and objects of the webpage with large traffic in the special cache device at the front end of the server, so as to improve the speed and quality of the website visit. A special memory subsystem in which frequently used data is duplicated for quick access. The cache of memory stores the contents of frequently accessed RAM locations and the storage addresses of these data items. When the processor references an address in memory, the cache checks to see if the address exists. If the address exists, the data is returned to the processor; If the address is not saved, regular memory access is performed. Because buffer memory is always faster than main RAM memory, it is often used when RAM access is slower than the microprocessor’s speed. Whole site acceleration: Set up CDN acceleration for the whole site,

What is CDN and how to use it?

The full name of CDN is Content Delivery Network, or Content Delivery Network.

It basically provides two things,

Dynamic allocation of the nearest node for users can shorten the time for users to access resources and other requirements, so as to speed up the access to some dynamic resources, such as game acceleration, video streaming, file download, etc. Based on the first point, it also provides caching services for static resources, which can be used in two ways to speed up the user’s next access.

Resources provided by other web sites (referred to as the source station), such as some open source CDN, direct links to modify the code resource, < script SRC = “https://cdn.bootcdn.net/ajax/libs/vue/3.0.2/vue.cjs.js” > < / script >, The resource is provided by its own server. In this case, the principle of accessing CDN is to forward the user’s access request to my website to the server of CDN in a certain DNS parsing stage. It is necessary to know some knowledge of DNS parsing. Why do we need a CDN?

A simple example, suppose that we ignore the loss of network transmission, equipment, time delay, network transmission speed close to the speed of light, is 300000 kilometers per second, from Tokyo to the United States silicon valley the distance is about 10000 kilometers, that is, if your server is in Tokyo, you posted a picture of a small, American users access to at least 60 milliseconds. Moreover, this is only theoretical data, in the real world, the network environment is very complex, cross-region, cross-operator, network congestion, jitter and other issues, will add up to a mickle, resulting in delays multiplied, and access failure is possible, ultimately affecting the access experience.

The emergence of CDN is just to solve this problem. We distribute this picture and cache it on the CDN node in the United States, so that American users don’t need to get the data from Tokyo, but directly get the picture from the nearby local CDN node in the United States, which greatly saves the transmission time and improves the access efficiency. CDN nodes are usually spread all over the world, and the files of the source sites are cached around the world, so that global users can achieve fast access.

It’s a bit like warehousing logistics points distributed in all over the world, and many brands will advance in the warehousing logistics reserve some hot style products (static files use the CDN cache), when a user from electric business platform when the order for the goods (user initiated request), platform based on the user’s harvest address matching to the nearest point to the nearest warehousing logistics and directly to send the goods (distribution) to the nearest Let the user get the express package (the content of the distribution) as fast as possible. We can use our actual life experience to make a comparison. If the goods are sent from Jiangsu, Zhejiang and Shanghai to customers in Hangzhou, they usually arrive in the next day. If the goods are sent from Beijing and Shenzhen, it usually takes 2-3 days!

What is DNS?

The purpose of DNS (short for Domain Name System) is very simple. It is to find the IP address by the Domain Name. Think of it as a giant phone book.

For example, if you want to access the domain name Math.StackExchange.com, you first need to find out through DNS that its IP address is 151.101.129.69.

Some of the terms in DNS,

A: Address, return the IP Address that the domain name points to. In order to be safe and reliable, there will be multiple A records, namely one domain name, corresponding to multiple A records MX: Mail Exchange, return the Address of the server that receives the E-mail. NS: Name Server record, which returns the address of the Server that holds the next level of domain information. This record can only be set as a domain name, not an IP address. CNAME: Canonical Name, which returns another domain Name, that is, the current query is A jump to another domain Name. Since A CNAME record is A replacement, once A domain Name is set, no other records (such as A and MX records) can be set. This is to prevent conflicts. For example, foo.com points to bar.com, and the two domains each have their own MX records, which can cause problems if they don’t match. Since a top-level domain is usually set with an MX record, users are generally not allowed to set a CNAME record for a top-level domain. Five, the general DNS resolution process?

In fact, a full Web address has a dot after it, such as test.baidu.com, but the browser omits it for user convenience. Test.baidu.com. For example, how to resolve the IP address. It can be described as, from right to left. ->.com-> baidu.com. -> test.baidu.com

Process:

“Local DNS”, also called Local DNS, abbreviated as LDNS. This is usually the DNS in your computer’s IPv4 or IPv6 Settings when surfing the Internet. This may be manually specified or automatically assigned by DHCP. If your computer is directly connected to a carrier network, the default setting for DNS is the server address assigned to the carrier by DHCP. If you have a wireless or wired route between your computer and your carrier, there’s a good chance that the router itself has a built-in DNS repeater, which forwards all DNS requests to the upper DNS. Since the router itself is also taking over the DHCP service of the underlying computer, the DNS address assigned to the underlying computer is itself, so you can see that the DNS assigned to the underlying computer is probably 192.168.1.1. This is actually the router itself, and the router’s DNS forwarder forwards the request to the DNS of the upper ISP. So if the DNS is LAN or carrier, if the LDNS doesn’t cache records, it will make a request to the next server step by step, and then aggregate all the data and give it to the final customer, which is called recursion. In the recursion process, there is a term called authority server, which is a special DNS server, and the authority is specific to the domain name. So it is generally said that who is the authority of the domain name DNS, can not simply throw away the domain name to ask who is the authority DNS. Is the domain name business in management, in charge of purchase the authority of the domain name resolution in his resolution, in general, is refers to buy domain name, such as new, nets (ali) is here you can configure your domain name, is pointing to an IP (A record), or address the CDN (CNAME) after six, access the CDN DNS process?

According to the above DNS process, when resolving the CNAME (cdn.com) domain name, it will return the NS record and go to the DNS resolution server of the CDN service provider. Name-name matching to this cdn.com suffix will go to the DNS server of the CDN service provider for parsing. Then, after calculation by the load balancing system inside the CDN, If there is a resource, it will return to the browser and cache the resource. If there is no resource, it will request to the next level cache server (namely cache hit ratio).

References:

Ultra clear guide to DNS principles! What is a CNAME in a very simple way? The principles, terminology, and application scenarios for CDN are the global accelerated solution for OSS object storage