Help Center> Content Delivery Network> Troubleshooting> Why Is It Still Slow to Access a Domain Name That Has Been Added for CDN Acceleration?
Updated on 2024-06-06 GMT+08:00

Why Is It Still Slow to Access a Domain Name That Has Been Added for CDN Acceleration?

Symptom

After CDN acceleration is enabled, access to a web page or app resources is still slow.

Check Items

  • Whether CDN acceleration is enabled for the domain name
  • Whether the CDN cache is hit
  • Whether inter-carrier or cross-province access is involved
  • Whether cache rules are appropriate
  • Whether the content is prefetched
  • Whether the client network is faulty

Procedure

  1. Check whether CDN acceleration is enabled for the domain name.

    If you have just added an acceleration domain name on the CDN console and are testing the domain name before adding a CNAME record, skip this step and configure the domain name as instructed in Getting Started.

    Check whether the domain name is resolved to CDN. Take the Windows OS as an example. Open the Command Prompt and run the following command:

    nslookup -qt=cname Acceleration domain name

    If the command output contains .c.cdnhwc1.com, the CNAME record has taken effect.

    • If the command output does not contain .c.cdnhwc1.com, CDN acceleration has not taken effect for the added domain name. The CNAME record has not been added to your domain's DNS records. Contact your DNS service provider to configure the CNAME record as instructed in Configuring a CNAME Record.
    • If the CNAME record was correctly configured, check the TTL of the previous resolution record of the domain name on the same resolution line. The TTL specifies the cache duration of a resolution record on the local DNS server. The newly added CDN CNAME record takes effect only after the TTL of the previous record expires.
  2. Check whether the CDN cache is hit.
    On the Google Chrome browser, press F12 and click the Network tab. View the response headers of the URL of a specific resource and perform the following operations:
    • Check the value of the x-hcs-proxy-type header. The value 1 indicates that the cache is hit, and the value 0 indicates that the cache is not hit.
    • If the x-hcs-proxy-type header does not exist, check the value of the X-Cache-Lookup header. Value Hit From MemCache, Hit From Disktank, or Hit From Upstream indicates that the cache is hit, whereas other values indicate that the cache is not hit.
    • If neither the x-hcs-proxy-type nor X-Cache-Lookup header exists, check the value of the age header. Values greater than 0 indicate that the cache is hit, and the value 0 indicates that the cache is not hit.

    If no cache is hit, go to 4 to check the cache rule settings.

    If the cache is hit, proceed to the next step.

  3. Check whether inter-carrier or cross-province access is involved.

    Perform the following steps:

    1. Obtain the client IP address and local DNS.
    2. Check the client IP address and local DNS to see whether a proxy is used. If a proxy is used, inter-carrier and cross-province access may occur, affecting the access speed.

      Example 1: A user in the Hebei province uses the Broadcasting Network to access the acceleration domain name. The client IP address is assigned by Beijing Unicom but the local DNS is assigned by Shijiazhuang Telecom. The access speed is greatly affected by inter-carrier access.

      Example 2: A user in Beijing uses the Broadcasting Network to access the acceleration domain name. The client IP address is assigned by Beijing Unicom but the local DNS is assigned by Guangdong Telecom, so the CDN scheduling system assigns the nearest PoP in Guangdong to return resources based on the local DNS. As a result, the access is slow.

    3. Currently, Huawei Cloud CDN supports China Telecom, China Unicom, China Mobile, China Tietong, CERNET, and Dr. Peng.
  4. Check cache rules.
    • Check whether the configured TTL is 0 or a small value. If CDN does not cache content or the TTL is too short, CDN frequently pulls content from the origin server, and the origin pull cannot be accelerated.
    • Check the cache settings on the origin server. If no-cache, private, or no-store is set on the origin server and Origin Cache Control is enabled on the CDN console (this function is disabled by default), CDN cannot cache content. CDN needs to pull content from the origin server, and the origin pull cannot be accelerated.
    • Check the priority of cache rules. The greater the value, the higher the priority.
    • Check whether URL parameters are retained. If URL parameters are retained, when users request a file using URLs containing different parameters, CDN considers that each request is new, and pulls the file from the origin server for each request. For details, see Cache Rules.
    • For more cache settings, see Setting the Cache TTL.
  5. Check whether the content is prefetched.

    If the content has not been prefetched and is requested for the first time, CDN PoPs will pull it from the origin server. In this case, slow access to the content is normal.

    When enabling CDN for the first time, you can prefetch large files or videos.

  6. Check the client network.

    Ping the domain name to which access is still slow after CDN acceleration to check the network delay and packet loss. If the network delay is long or severe packet loss occurs, check the network connection of the client.

If the fault persists even after taking the previous steps, submit a service ticket.