Accelerating Access to Websites Built on ECSs
Background
An ECS is a basic computing component that consists of CPUs, memory, OS, and Elastic Volume Service (EVS) disks. Flexible ECS configuration helps save a large amount of hardware costs. Assume that a customer deployed a forum website accessible through a domain name on Huawei Cloud ECS. The initial service volume was small, and user access was smooth. As the services grew, the access traffic increased sharply. Users complained about problems such as slow access. To improve the access speed and user experience, the customer decided to use Huawei Cloud CDN.
Solution Overview
Using Huawei Cloud CDN to accelerate content delivery for websites built on ECSs can reduce costs and improve user experience.
Service process: 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 a CDN PoP has cached the content, it directly returns the content to the user. If the CDN PoP does not cache the content, it pulls 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
- Set up a forum website on an ECS. For details, see Setting Up a Discuz Forum.
- The IP address of the server is 192.168.1.1.
- The domain name of the website is discuztest.com.
- Enable CDN.
-
Log in to Huawei Cloud console. Choose .
The CDN console is displayed.
- Click Enable Now.
- Select a billing option, read and agree to the service agreement, and click Enable Now.
-
- Add a domain name on CDN.
- In the navigation pane of the CDN console, choose .
- On the Domains page, click Add Domain Names and configure the acceleration domain name and origin server information.
- Domain Names: Enter discuztest.com.
- Service Area: Select Chinese mainland.
- Service Type: Select Website.
- Origin Server Settings
- Origin Protocol: Select HTTP.
- Type: Select IP address.
- Address: Enter 192.168.1.1.
- Priority: Select Primary origin server.
- Host Header: By default, the acceleration domain name is used.
- 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.
- 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.
- Configure CNAME resolution. CDN automatically generates a CNAME after you add a domain name. The CNAME cannot be accessed directly. You must add it to your domain's DNS records. Then requests for your domain name will be redirected to CDN PoPs for acceleration.
In this practice, the generated CNAME is discuztest.com.c.cdnhwc1.com.
- In the upper left corner of Huawei Cloud console, choose .
The DNS console is displayed.
-
In the navigation pane, choose Public Zones.
The public zone list is displayed.
- Click the domain name you want to add a record set to. In this practice, the domain name is discuztest.com.
- Click discuztest.com. On the displayed page, click Add Record Set in the upper right corner. The Add Record Set dialog box is displayed.
- 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.
www
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.
5 min
Value
Domain name to be pointed to.
If CDN acceleration is not enabled, the value is the ECS domain name. If CDN acceleration is enabled, the value is the CNAME generated by CDN.
discuztest.com.c.cdnhwc1.com
- Click OK.
- In the upper left corner of Huawei Cloud console, choose .
- Check whether 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 practice, the acceleration domain name is discuztest.com. If the CNAME generated by CDN is displayed, the CNAME configuration has taken effect.
- Check whether the configuration is successful.
Log in to the forum website and browse web pages. If the website can be visited, the acceleration configuration is successful.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot