Limited Time Free!  Sign up for 1TB of data transfer and get free trials of WAF and Bot Management!
Get Started Now 
Tencent EdgeOne Blog
Tencent EdgeOne Blog
Tech

How to Connect to a CDN: 3 Types of CDN Scheduling Systems

EdgeOne - Product Team

what are cdn scheduling systems

What are CDN Scheduling Systems?

CDN Scheduling Systems are a set of algorithms and mechanisms that manage user requests within a Content Delivery Network (CDN). These systems play a crucial role in ensuring optimal performance, fast content delivery, and a high-quality user experience. They consider several factors when routing requests, such as the geographic location of the user, the server's current load, and the health status of the server. CDN scheduling systems also manage and balance network traffic, preventing a single server from becoming overloaded with too many requests, which could potentially slow down or disrupt service.

In addition to traffic control and quality control, CDN scheduling systems are responsible for cost control and fault handling. They can direct traffic in a way that minimizes bandwidth usage and reduces operational costs. Furthermore, these systems can handle fault tolerance by automatically rerouting requests to another healthy server, ensuring uninterrupted service when a server goes down or experiences issues. Overall, CDN scheduling systems are a critical component of Content Delivery Networks, contributing to efficient content delivery and seamless user experience.

How to Connect to a CDN?

Before explaining the scheduling principle, let's take a look at how customers access CDN, or how the customer's traffic input and switching to CDN. (Assuming the customer's domain name is: www.test.com, there are roughly the following ways.)

CNAME Method

The CNAME method is the most common access method, that is, the CDN manufacturer provides a scheduling domain name to the customer, and the customer sets the CNAME of their business domain name to this scheduling domain name, thereby realizing the request to be guided to the CDN.

Tencent Cloud provides customers with CDN as $domain.cdn.dnsv1.com, and the customer's domain name is www.test.com. If you need to switch the request to Tencent Cloud CDN, you only need to set the CNAME of www.test.com to www.test.cdn.dnsv1.com.

Behind the CNAME method, there are several modes:

  • The CDN manufacturer provides DNS-based scheduling, and the customer's domain name is finally resolved to the CDN node's IP through the CDN's scheduling domain name. Tencent Cloud CDN adopts this mode.
  • The CDN manufacturer provides 302-based scheduling, and the CNAME provided is not a real CDN node, but a scheduling cluster. The real CDN IP address is realized by responding to the request with a 302 redirect on the scheduling cluster. Tencent Cloud has provided this mode for some mobile phone manufacturers' download services.
  • Another one is Anycast CDN. From the perspective of the CDN layer, the CNAME provided by the CDN manufacturer has only one or two IP addresses fixed worldwide. Unlike mode 1, the IP resolution results in different regions are different. In this scenario, traffic scheduling is not based on DNS resolution but on Anycast BGP route adjustment. The traffic in various regions is adjusted to which machine room by adjusting the Anycast route.

Deep Customization of Scheduling Domain Names

This mode is mainly for some agent customers, that is, using Tencent Cloud CDN to accept customers and want to hide the CDN manufacturer they use at the DNS level. The general practice is for the customer to provide their domain name, such as gslb.mycdn.com, and Tencent Cloud also provides a neutral and unregistered platform scheduling domain name glsb.mycdn-platform.com. The real customer domain name www.test.com is CNAME to glsb.mycdn.com, and the latter is CNAME to Tencent Cloud's scheduling domain name glsb.mycdn-platform.com. In this way, the entire resolution cache has no trace of Tencent Cloud.

Domain Name Hosting Method

This mode is uncommon. Taking the domain name www.test.com as an example, if the customer needs to switch the request to CDN, they need to change the NS record of test.com to the NS authoritative server provided by the CDN manufacturer. At this time, the CDN manufacturer plays the role of both the DNS service provider and the CDN service provider.

Detailed Explanation of CDN Scheduling Methods

DNS Scheduling

DNS scheduling is based on the exit IP attribution and operator attributes of the requested local DNS.

302 Scheduling

302 redirect scheduling based on the client IP attribution and operator attributes.

Routing Scheduling

Data center traffic scheduling based on Anycast technology. (BGP routing).

DNS Scheduling

The scheduling server of the CDN is the NS authoritative server for the scheduling domain, and the TTL of the scheduling domain is deliberately set to be very short. (e.g., three minutes). This ensures that all requests frequently trigger the client's local DNS to resolve a new IP address from the CDN's scheduling server. At this point, the scheduling server relies on the exit address of the local DNS. The DNS scheduling process is as follows:

  1. The client's DNS TTL expires without first access and initiates a DNS query to the local DNS.
  2. The local DNS, in the process of recursive resolution, initiates a resolution request to the CDN scheduling server.
  3. The CDN scheduling server can see the exit IP of the local DNS. (Sometimes also the client IP is based on EDNS.)
  4. Through the IP library, obtain the geographical and operator attributes of the IP in the previous step, match the policy rules of the current scheduling domain, and combine other factors (such as quality monitoring, data center cost factors, etc.) to get the best set of IPs.

Scenario:

Access URL

http://p73.ping.dnsv1.com/a.php

Test machine exit IP

113.87.117.154

DNS server

202.96.134.133 / 202.96.128.166

DNS exit address

202.96.136.240

Target domain name resolution

The DNS resolution of p73.ping.dnsv1.com is as follows: p73.ping.dnsv1.com

  • p73.ping.dnsv1.com.cdn.dnsv1.com
  • 388957.p23.tc.cdntip.com
  • 113.96.154.108 and more than ten other IPs

DNS Scheduling Principle:

  1. The browser initiates the first request for the target URL. There is no p73.ping.dnsv1.com resolution record locally, so it sends a request to the DNS server (also known as local DNS) 202.96.134.133.
  2. If 202.96.134.133 (the actual server behind this IP) has no local cache, it initiates a recursive resolution, eventually resolving to 388957.p23.tc.cdntip.com. The resolution request is sent to the authoritative server ns-open3.qq.com for cdnip.com. Ns-open3.qq.com is not a physical server but a virtual IP on the network. To simplify the description, let's assume that the actual DNS authoritative server (or cluster) behind it has an IP of 10.1.1.1.
  3. The information currently available to 10.1.1.1 includes the domain name 388957.p23.tc.cdnip.com and the local DNS IP 202.96.136.240. If the local DNS supports EDNS, the client IP 113.87.117.154 can also be seen at this time. With these three pieces of information, the scheduling server can obtain the result through the algorithm.
  4. 202.96.134.133 returns the IP result to the client, and the browser initiates an HTTP request to one of the IPs according to its own policy.

Advantages and Disadvantages of DNS Scheduling:

 

Advantages

Simple and easy to use

Transparent to users

Good client compatibility

 

Disadvantages

Non-real-time scheduling policy implementation. (DNS is a tree-like distributed system and all nodes cache based on the domain name's TTL.)

Inaccurate scheduling. (A large number of local DNS servers do not support the EDNS protocol, so they cannot obtain the client's real IP address; most of the time, CDN can only make decisions based on the local DNS IP, which is sometimes unreliable.)

302 Scheduling

Now let's see what's different between the 302 mode and the previous DNS scheduling.

(http://p73.ping.dnsv1.com/a.php)

In the DNS resolution scheduling mode, when the browser accesses the above URL, under normal circumstances, it will receive a return code 200 and file content from the CDN node, which means the IP resolved by DNS will directly act as the file server responding to the browser request. It's similar to:

HTTP/1.1 200 OK

Server: NWS_S1

Connection: keep-alive

Date: Sun, 11 Dec 2018 19:44:02 GMT

Transfer-Encoding: chunked

Keep-Alive: timeout=120

X-Daa-Tunnel: hop_count=2

X-NWS-LOG-UUID:750246221628030518 0be2170ce2df3d9f634cd70470120401

\r\r\r\n File Content

However, in the 302 redirect mode, when accessing the above URL, the browser will receive a response with a status code of 302:

HTTP/1.1 302 Moved Temporarily

Server: stgw/1.3.6.2_1.13.5

Date: Sun, 16 Dec 2018 19:38:58 GMT

Content-Type: text/html

Content-Length: 168

Connection: keep-alive

Location: http://61.142.166.245/p73.ping.dnsv1.com/a.php

This means telling the browser that it needs to continue to request the actual file content from the URL in the Location. So the browser initiates the second request:

http://61.142.166.245/p73.ping.dnsv1.com/a.php

The IP address in this URL is the CDN node allocated by the CDN scheduling system. Let's see how this IP is obtained.

The process of domain name resolution in 302 redirect mode is the same as DNS-based scheduling, and a group of IPs will be obtained in the end. There are two possible situations for the target IP: 1) The target IP is not the actual edge node of the CDN, but the IP of the 302 scheduling cluster; 2) The IP is a common edge node IP of the CDN.

  1. The browser initiates an HTTP request to the first IP obtained.
  2. If this IP is actually an edge node of the CDN, it will read information from the local configuration file: 
    If the requested Host is not an IP, the URL form is: http://p73.ping.dnsv1.com/a.php, then the request will be forwarded to the backend scheduling cluster; 
    If the requested Host is an IP, the URL form is: http://61.142.166.245/p73.ping.dnsv1.com/a.php, then it will read from the cache to provide file services.
  3. At this point, the request has reached the scheduling cluster, and the client information we can get is the client's exit IP. (In most cases, they are the same.)
  4. The next algorithm and DNS-based scheduling can be the same, it's just that the judgment basis has changed from the local DNS exit IP to the client's exit IP. (After all, the scheduling cluster is not a CDN node and cannot provide the actual file content to the client, at this point it can only inform the client through a 302 message.)
  5. The browser receives the 302 response, follows the URL in the Location, and continues to initiate an HTTP request. The target IP of this request is the CDN edge node, and the Host is an IP. The CDN node will respond with the actual file content.

 

Advantages

Real-time scheduling (the final IP obtained each time is the result of real-time calculations, so the scheduling strategy takes effect in real time).

High accuracy (can obtain the exit IP of the request, which makes the client's location closer to the actual situation when not considering NAT or small ISP exit drift, and is not affected by the user's DNS configuration).

 

 

Disadvantages

Business compatibility (requires the client of the customer's business to support 302 redirects, such as mobile phone firmware or app downloads; if the download client does not recognize the HTTP 302 response code, the download will fail).

Not suitable for latency-sensitive businesses (each request will involve an additional HTTP interaction, causing the loading time to increase significantly, which is not suitable for web static small resources).

Therefore, 302 is only suitable for large file download services with good client compatibility.

At this point, you might wonder, what are the benefits of real-time scheduling? After consulting with technical experts from Tencent EdgeOne, it was found that real-time scheduling can:

  • Quickly isolate faulty devices
  • Precisely control the bandwidth and resource load of nodes and data centers
  • Rapidly respond to sudden business surges, especially suitable for large file loading scenarios, such as mobile phone firmware, game installation packages, and large-volume resource distribution

Routing Scheduling

Anycast routing technology allows physically distributed servers across the globe or different regions to have the same IP address. Client requests for this IP will be guided to the nearest physical server at the routing level.

Anycast BGP routing scheduling mode is similar in appearance to DNreal timeS scheduling:

  • The business domain name is resolved to the CDN scheduling domain name through CNAME
  • The IP resolved by the CDN scheduling domain name is the edge node IP, and the request will not undergo a 302 redirect

However, there are also unique features:

  • The number of global IP addresses in the resolution result is very small, usually only 1-2, or 1-2 for a continent or a large area
  • The TTL of DNS is usually very large, often configured to be 2 hours or even longer

Advantages and disadvantages of Anycast routing scheduling:

 

 

 

Advantages

Low DNS resolution performance requirements for CDN authoritative servers (few fixed IPs, long TTL).

More resistant to interference than DNS and has better compatibility than 302. (CDN nearby access is completed at the routing level.)

Fast route policy change implementation, is better than DNS scheduling.

When under a DDOS attack, you only need to adjust the route to guide the attack traffic to a high-bandwidth cleaning data center, without removing IPs from the network.

 

Disadvantages

Complex solution (complex network-wide networking, tedious BGP route optimization, prone to network disconnection, longer request latency).

The high cost (Anycast implementation requires a complete IPC segment and severe IP waste, and to achieve good results and withstand attacks, global data centers need to have sufficient bandwidth).

Conclusion

Tencent EdgeOne, as a next-generation CDN, not only provides acceleration but also offers advanced CDN and scheduling policies. These allow for a flexible and efficient way to manage network traffic, which ultimately contributes to a more reliable and faster user experience. Here's an extension of more CDN Scheduling services EdgeOne can provide combined with the provided information:

  1. Simple Management: With EdgeOne, all you need to do is select a domain name, add service providers, and add scheduling policies. This easy process ensures you focus more on your core business instead of worrying about CDN management.
  2. Quick Access: By adding the CNAME record assigned by EdgeOne at your DNS service provider, you can swiftly access your content whenever you want.
  3. Scheduling Modes: EdgeOne supports ratio-based and region-based scheduling. Ratio-based scheduling allows you to distribute your traffic based on certain set ratios for effective load balancing. At the same time, region-based scheduling enables you to direct users to the closest or best-performing server locations, effectively reducing latency.
  4. Multiple Scenarios: With EdgeOne, flexibility is key. You can use either the origin or services provided by other CDN vendors. This allows for a canary switch – a testing strategy where new versions of a software are gradually deployed for verifications and rollbacks in case of errors. On top of that, you can use services from different vendors at the same time. This feature provides you with the best value by sourcing services from multiple vendors simultaneously.
  5. Pre-requisites setup: EdgeOne makes it simple to kickstart your project. Purchase an EdgeOne Enterprise plan and connect your site to it in CNAME mode.

The above Traffic Scheduling Policies will make the overall CDN management and load balancing a breeze with EdgeOne, making it a truly next-generation provider of CDN services. EdgeOne ensures your content is both readily accessible and resonates with your audience, no matter where they are in the world. If you are interested in experiencing these benefits firsthand, feel free to contact us to learn more about Tencent EdgeOne and its features. You can also click here to get started free and experience its benefits firsthand.

Develop
EdgeOne
Web