Help Center> Content Delivery Network> Best Practices> Accelerating ECS Resources
Updated on 2023-12-13 GMT+08:00

Accelerating ECS Resources

Prerequisites

Background

An ECS is a basic computing component that consists of CPUs, memory, OS, and Elastic Volume Service (EVS) disks. You can configure ECSs based on service requirements, saving a large amount of hardware costs. If ECSs are deployed in different regions, cross-region access may cause network latency, affecting user experience.

Huawei Cloud CDN can effectively accelerate websites to deliver a better user experience. If you use CDN to accelerate ECS resources, you can improve user experience at low costs. When a user initiates an access request, CDN checks whether the content requested by the user is cached on the CDN PoP with the fastest response speed. If the CDN PoP has cached the content, the CDN PoP directly returns the content to the user. If the CDN PoP does not cache the content, the CDN PoP retrieves the content from the origin server, returns the content to the user, and caches the content.

Solution Advantages

  • Users access website content through CDN, reducing the pressure on the origin server.
  • The unit price of CDN traffic is lower than that of the traffic generated when ECSs directly access the Internet, saving 50% to 57% of the bandwidth cost.
  • Users can obtain content from the nearest CDN PoP, which shortens the network transmission distance and ensures the quality of static content.

Procedure

  1. Add a domain name on CDN.
    1. Log in to the Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network.

      The CDN console is displayed.

    2. In the navigation pane, choose Domains.
    3. On the Domains page, click Add Domain Name.
    4. In the Add Domain Name dialog box, specify the parameters. For details, see Adding a Domain Name.
      • Domain Name: download.game-apk1.com is used as an example.
      • Service Area: Select the service area based on your service requirements.
      • Service Type: Select a service type based on the application scenario.
      • Type: Select IP address or Domain name.

    5. Click OK and use recommended configurations as required.

      The configuration takes 5 to 10 minutes to take effect. When Status of the domain name becomes Enabled, the domain name has been added.

  2. Test your domain name before adding a CNAME record to the domain's DNS records to ensure that your domain configurations are correct. For details, see (Optional) Testing the Domain Name.
  3. Configure a CNAME record on DNS.

    After the domain name is added, CDN automatically generates a CNAME record for the domain name. The CNAME record cannot be accessed directly. You must add the CNAME record to your domain's DNS records. Then requests for your domain name will be redirected to CDN PoPs for acceleration. In this example, the automatically generated CNAME record is download.game-apk1.com.c.cdnhwc1.com. The CNAME configuration method varies depending on the DNS provider. In this document, DNS provided by Huawei Cloud is used as an example. For details about how to configure CNAME records on other DNS service providers, see Configuring a CNAME Record.

    1. Log in to the Huawei Cloud console. Choose Service List > Networking > Domain Name Service.

      The DNS console is displayed.

    2. In the navigation pane, choose Public Zones. The public zone list is displayed.
    3. Click the domain name you want to add a record set to. In this example, the domain name is game-apk1.com.
    4. Click game-apk1.com. On the displayed page, click Add Record Set in the upper right corner. The Add Record Set dialog box is displayed.

    5. Set the parameters as prompted. Use the default values for the parameters that are not listed in the following table.

      Parameter

      Description

      Example

      Name

      Domain name prefix

      download

      Type

      Type of the record set

      CNAME – Map one domain to another

      Line

      Resolution line. The DNS server will return the IP address of the specified line based on the source of visitors.

      You must add a Default line to ensure that the website is accessible to users of all carriers.

      Default

      TTL (s)

      Cache duration of the record set on a local DNS server. If your service address changes frequently, set TTL to a smaller value.

      The default value is 300, which is, 5 minutes.

      Value

      Domain name alias

      If CDN acceleration is not enabled, the value is the ECS domain name. If CDN acceleration is enabled, the value is the CNAME record generated by CDN.

      download.game-apk1.com.c.cdnhwc1.com

    6. Click OK.
    7. Verify that the CNAME record has taken effect.

      Open the Windows command line interface and run the following command:

      nslookup -qt=cname Acceleration domain name

      In this example, the acceleration domain name is download.game-apk1.com. If the CNAME record generated by CDN is displayed, the CNAME configuration has taken effect.