Diagnosing CDN: A Comprehensive Guide to Troubleshooting Website Accessibility Issues

EdgeOne-Product Team
Aug 13, 2024

What is CDN?

Content Delivery Network (CDN) is a new layer of network architecture added to the existing Internet, consisting of high-performance acceleration nodes distributed globally. These high-performance nodes store business content according to a certain caching strategy. When a user requests specific content, the request is routed to the nearest service node, which directly responds quickly, effectively reducing user access latency and improving availability.

What is the acceleration principle of CDN?

Assuming the business acceleration domain is www.test.com, after the domain is connected to the CDN and starts using acceleration services, the actual processing flow when a user initiates an HTTP request is as shown in the following diagram:

Detailed explanation is as follows:

  1. When a user requests a certain image resource (e.g., 1.jpg) from www.test.com, the request first goes to the Local DNS for domain name resolution.
  2. When Local DNS resolves www.test.com, it finds that it is configured with CNAME www.test.com.cdn.dnsv1.com, and the resolution request is sent to the DNS (GSLB) for load balancing, which allocates the best node IP for the request.
  3. Local DNS receives the resolved IP from Tencent DNS.
  4. The user obtains the resolved IP.
  5. The user sends a request to the obtained IP for the resource 1.jpg.
  6. If the node corresponding to that IP has 1.jpg cached, it directly returns the data to the user (step 10), and the request is completed. If the node does not have 1.jpg cached, the node requests 1.jpg from the origin server (steps 6, 7, 8), caches the resource at the node based on user-defined caching policies (step 9), and returns it to the user (step 10), completing the request.

What scenarios are suitable for using CDN?

  • Website Acceleration

For business scenarios like portal websites, e-commerce, UGC communities, etc., CDN offers robust capabilities for accelerating the distribution of static content (such as webpage styles, images, small files), significantly enhancing the user experience of web pages.

  • Download Acceleration

For business scenarios like game installation package retrieval, mobile ROM upgrades, application package downloads, etc., CDN provides stable, high-quality download acceleration. With a massive reserve of elastic bandwidth and the ability to handle bursts of extremely large traffic, businesses can provide users with a lightning-fast download experience.

  • Audio and Video Acceleration

In scenarios involving online audio and video playback, CDN can offer a stable, smooth, and rich viewing experience.

What problem does CDN solve?

  1. Solves the issue of limited network bandwidth leading to slow resource access for users. CDN reduces bandwidth costs and enhances user access experience.
  2. Addresses high server disk read/write pressure caused by large user traffic. CDN reduces server costs.
  3. Mitigates the issue of limited geographical distribution in self-built data centers, resulting in long network transmission times for users far away. Using CDN with proximity algorithms to quickly respond to requests, enhancing the user access experience. 

Why can not access to CDN?

After understanding the acceleration principle, accessing a CDN request first requires DNS resolution to determine the nearest node IP address to the user. Then, the request is sent to the CDN node to check for cached resources. If not found, it goes back to the origin server. This is the overall process.
Therefore, when encountering issues with accessing a CDN, troubleshooting typically involves examining the mentioned stages. Broadly speaking, the main categories are origin server issues and CDN issues.

1. Origin Server Issues

If the origin server is abnormal, services cannot be provided externally or if the origin server has security policies in place, such as firewall restrictions on source IPs.

2. CDN Issues

  • CDN CNAME configuration exception

For CDN website acceleration, CNAME resolution needs to be configured for the domain to be accelerated. Incorrect configuration can lead to inaccessibility.

  • CDN acceleration configuration exception

Issues with cache configuration, origin fetching configuration, and access control configuration.

  • CDN node exception

CDN node malfunction, unable to respond to user requests or responding with errors.

What troubleshooting methods are available for the above situation?

1. Confirm if the origin server is abnormal

Assuming the business acceleration domain is www.test.com and the origin domain is www.origin.com, with HTTP access for both. If the accelerated domain URL http://www.test.com/1.jpg is replaced with http://www.origin.com/1.jpg and the origin URL cannot be accessed normally, it indicates an issue with the origin server.

2. Troubleshooting Methods for CDN Issues

The following troubleshooting approaches are all based on Tencent EdgeOne as an example.

2.1 Troubleshooting EdgeOne CNAME Configuration

Add a new acceleration domain, configure DNS resolution with the domain service provider. As shown in the figure below, on the domain resolution of xxx-proxy.qcdntest.com.cn, configure a CNAME record pointing to xxx-proxy.qcdntest.com.cn.eo.dnse5.com.

Using the MAC terminal, you can confirm the DNS resolution of a domain name using the dig command. In the figure below, the CNAME resolution has been correctly configured. The action of configuring a CNAME record is referred to as "traffic switching" in CDN terminology.

2.2 Troubleshooting EdgeOne Acceleration Configuration

Check cache configurations such as .php;.asp;.aspx;.jsp; and other suffixes. Dynamic resources like those with .php endings cannot be statically accelerated. If dynamic resources like URLs ending in .php have .php suffix caching enabled, it may lead to the website not opening properly.

For instance, if the origin server only supports HTTP access, configuring EdgeOne origin fetch as HTTPS will result in access anomalies.

Check the EdgeOne configuration to see if access control is configured. If access control is configured, ensure that the corresponding access policies are met.

By connecting your domain to Tencent Cloud EdgeOne, you can also use self-diagnostic tools to assist with anomaly diagnosis. Input url such as https://xxx-proxy.qcdntest.com.cn/example.html, to generate a diagnostic link.

Best Practices

Use separate domain names for different resources (dynamic, static) to configure different acceleration types for each resource, maximizing benefits.

Conclusion

In summation, this article bridges the theoretical and practical aspects of CDNs, offering insights into their effective use and troubleshooting. By understanding why CDNs are crucial for modern web infrastructure, how to adeptly manage them, and efficiently problem-solve potential impediments, web administrators can ensure their websites remain accessible to users worldwide, thereby ensuring uninterrupted service and optimal performance.

Tencent EdgeOne is a comprehensive edge computing platform. It integrates various services such as content delivery network (CDN), security, and edge computing to provide a unified solution for accelerating and securing web applications and content. By leveraging Tencent's extensive global network infrastructure, EdgeOne aims to enhance the performance, reliability, and security of online services, ensuring a seamless user experience across different regions and devices.

We have now launched a free trial, welcome to Contact Us for more information.