Currently, various scheduling mechanisms are applied to the GSLB system of CDN, among which the most common one is GSLB based on DNS resolution. There are also GSLBs based on application layer protocol redirection and GSLBs based on routing protocol. In this article, we will mainly introduce GSLB based on DNS resolution.
The Internet, which connects hosts in the network, needs its own set of rules. The position of a host on the Internet is identified by an IP address, and each host needs to have a unique IP address. Different hosts are identified through this unique IP.
However, we rarely access websites by entering IP addresses in real life because they are hard to remember. For instance, to visit Tencent's homepage, you would enter edgeone.ai instead of an IP like 1.1.1.1. Therefore, host name identifiers, such as edgeone.ai, were introduced.
While machines prefer simple numerical IPs, people use host names, and the conversion between the two is the mapping relationship between host names and IP addresses.
To implement this function, each host stores the conversion table from host identifiers to IP addresses in a database file called hosts. Nearly all modern operating systems still have this host file, but its content has become less (as most of its functions have been replaced by DNS servers).
We can still query our host file today. However, as the network scale continues to expand and the number of access hosts continues to increase, the feasibility of this centralized management of host names and IP address mapping relationships gradually decreases.
To facilitate maintenance and management, timely update, and synchronization of mapping relationships across the network, the DNS specification was proposed, which eventually evolved into the DNS system we talk about today.
GSLB stands for Global Server Load Balancing. It is a technique used to distribute traffic across multiple servers or data centers located in different geographical locations. The primary goal of GSLB is to ensure high availability, reliability, and optimal performance of web applications or services by efficiently routing user requests to the best-performing server or data center based on factors such as server load, user location, and network latency. This helps minimize response times, reducing the risk of server overloading, and providing a seamless user experience.
DNS-based GSLB solutions involve deploying load-balancing devices within the DNS system. When users initiate any application connection requests, they must first obtain the server's IP address through the DNS system. DNS-based GSLB makes intelligent decisions during the DNS response process, returning the best server IP address to the user. From the user's perspective, the entire application flow does not change with or without GSLB involvement.
There are various methods to implement GSLB based on DNS resolution, with the following three being the most common:
CNAME is an alias for a domain name. When a server obtains a CNAME record, it replaces the searched domain name with the alias in the record and then queries the A record of the alias to obtain the corresponding IP address.
The process involves defining the GSLB hostname as the alias for the authoritative DNS server of the queried domain name and adding multiple A records to the GSLB hostname, each corresponding to the IP address of a different server.
This way, the local server returns multiple IP addresses as the domain query result to the client and polls these IPs. For example, if the DNS returns two IPs, 5.5.5.5 (A) and 6.6.6.6 (B), the client will first attempt to access the Shenzhen IP, and if the request fails, it will initiate a request to the (B) IP. When the next user requests the same domain name resolution, the authoritative domain name server will put the (B) IP first in the response information. The client will then first attempt to initiate a request to (B), achieving load balancing between the two servers.
This method involves using the load balancer as the authoritative DNS server for a domain namespace. In this way, the load balancer accepts all DNS requests for the domain (the load balancer replaces the authoritative DNS server for resolution, and all DNS requests are sent to the load balancer regardless of whether the website the user visits requires domain resolution). Thus, load balancing can be achieved through domain resolution based on preset policies.
This method involves registering the load balancer as the authoritative DNS server for a domain namespace, with the actual authoritative domain name server deployed behind the load balancer. All DNS requests first arrive at the load balancer, which forwards them to the real authoritative DNS server. The load balancer then modifies the response information returned by the authoritative DNS server to achieve load balancing.
To better understand the differences between accessing content through a CDN and traditional network access, consider the following two questions:
The reason for setting a CNAME in CDN business scenarios is usually due to intelligent resolution, where IPs resolved in different regions are different. Imagine that when using a CDN service, the provider gives you an IP. If the provider changes the IP address one day, the domain name corresponding to the IP must also be modified. If you use a CNAME, you only need to resolve it again. Therefore, if IPs change frequently, it is recommended to use CNAME alias resolution. If IPs do not change frequently, you can use A records to resolve directly to the IP.
This is not possible because the domain name after CNAME is used to find the IP and cannot be accessed directly. If you try to access the CNAME domain directly, you may encounter a 504 page.
Many people believe that after CNAME-ing a domain (sub.domain1.com) to another domain (domain2.com), you can access sub.domain1.com to get the content of domain2.com. This confuses the difference between resolution and binding and conflates CNAME with redirection. CNAME can only ensure that the resolution of sub.domain1.com is synchronized with domain2.com. If it is a shared IP host, you still cannot access the website content without binding.
Tencent EdgeOne's traffic scheduling management tool implements intelligent parsing and scheduling across multiple CDNs, supporting custom traffic scheduling strategies between origin servers and multiple service providers. This ensures smooth gray-scale migration and flexible allocation of traffic, guaranteeing high service availability. It has the following advantages:
We have now launched a free trial, click here or contact us for more information.