Industries such as e-commerce, online gaming, and on-demand audio and video streaming require high access speed and quality. To improve the experience of end users, you can use Global Accelerator (GA) together with Alibaba Cloud CDN (CDN). GA uses high-bandwidth BGP lines and the global transmission network of Alibaba Cloud to accelerate content delivery. You can connect CDN to GA to accelerate the delivery of dynamic content on a global scale.
Scenarios
The example in this topic is based on the following scenario. A web service is deployed on Alibaba Cloud in the US (Silicon Valley) region. The domain name of the service is www.<YOURDOMAIN>.fun
. The forwarding port is HTTP port 80. Most clients are located in China (Hong Kong). When clients in China (Hong Kong) access the web service in US (Silicon Valley), issues such as high network latency, network jitter, and packet loss frequently occur due to unstable cross-border Internet connections.
You can deploy CDN to accelerate content delivery from your web service. CDN caches frequently requested content on CDN edge nodes to improve user experience. GA uses high-bandwidth BGP lines and the global transmission network of Alibaba Cloud to accelerate content delivery. You can connect CDN to GA to accelerate the delivery of dynamic content on a global scale.
Prerequisites
Applications are deployed on the origin server.
In this example, the Alibaba Cloud Linux 3 operating system is used. NGINX and Netcat are used to build a web page that includes dynamic time display and static images to simulate the server.
An A record is created that maps the service domain name
www.<YOURDOMAIN>.fun
to the public IP address of the origin server.This topic uses Alibaba Cloud DNS as an example to describe how to configure DNS records. For more information about how to configure DNS records, see Add DNS records. If you use a third-party DNS service, refer to the user guide provided by the service provider.
Procedure
Step 1: Configure a GA instance
In this example, a pay-as-you-go standard GA instance is used.
On the GA console, click Create Standard Pay-as-you-go Instance.
page of theIn the Basic Instance Configuration step, configure the basic information and click Next.
In the Configure Acceleration Area step, add an acceleration region, allocate bandwidth to the region, and then click Next.
In this example, the China (Hong Kong) region is used. The Acceleration Area parameter is set to China (Hong Kong) and the ISP Line Type parameter is set to BGP (Multi-ISP). You can use the default values for other parameters or modify the parameters based on your business requirements. For more information, see Add and manage acceleration areas.
ImportantIf you specify a small value for the maximum bandwidth, throttling may occur and packets may be dropped. Specify a maximum bandwidth based on your business requirements.
In the Configure listeners step, configure the forwarding protocol and the port, and then click Next.
In this example, the Protocol parameter is set to HTTP and the Port parameter is set to 80. You can use the default values for other parameters or modify the parameters based on your business requirements. For more information about how to configure a listener, see Add and manage intelligent routing listeners.
In the Configure an endpoint group step, configure the endpoint and click Next.
In this example, Region to US (Silicon Valley), Backend Service Type is set to ECS, and Backend Service is set to the ECS instance where the service is deployed. Read and select Compliance Commitments Regarding Cross-border Data Transfers. For more information about how to configure an endpoint group, see Add and manage intelligent routing listeners.
In the Configuration Review step, confirm the configurations and click Submit.
On the Instances page, find the created GA instance and obtain the CNAME assigned to the GA instance in the CNAME column.
Step 2: Configure CDN
On the Domain Names page of the CDN console, click Add Domain Name.
In the Specify Domain Name Information step, configure Business Information and Origin Servers.
Configure Business Information.
In the Business Information section, Region is set to Global (Excluding the Chinese Mainland) and Domain Name to Accelerate is set to
www.<YOURDOMAIN>.fun
. You can use the default values for other parameters or modify other parameters based on your business requirements. For more information, see Add a domain name.Configure Origin Servers.
In the Origin Servers section, click Add Origin Server. In the Add Origin Server dialog box, select the type of the origin server, enter the address, and then click OK.
In this example, Origin Info is set to Site Domain. Enter the CNAME of GA and set Weight to 100. You can use the default values for other parameters or modify other parameters based on your business requirements. For more information about how to configure an origin server, see Add a domain name.
Select Compliance Warranty Regarding Cross-border Data Transfers and click Next.
In the Recommended Features step, you can configure features such as cache expiration, bandwidth cap, and page optimization for the domain name. You can configure the parameters and click Configure or click Skip based on your business requirements.
In this example, find the default cache rule in the Cache Expiration section, click Modify in the Actions column, set Object to /dynamic, and set Expire In to 0 seconds. For more information about the recommended configurations, see (Optional) Configure system-recommended features.
On the Domain Names page, find the added domain name and obtain the CNAME assigned by CDN in the CNAME column.
Step 3: Configure DNS records
After the domain name is added, you must create a DNS record of the domain name to the CNAME assigned by CDN. Then, requests that are sent to the domain name can be forwarded to CDN for acceleration.
To avoid conflicts between the existing A record and the CNAME record, you can set different DNS request sources or resolution lines for the records. In this example, you can add a CNAME record for the China (Hong Kong) region to perform a test. If the test is successful, you can gradually apply the CNAME record to other regions or switch to the default line.
On the Authoritative DNS Resolution page, find the domain name that you want to use and click DNS Settings in the Actions column.
NoteFor a domain name that is not registered with Alibaba Cloud, you must add the domain name to the Alibaba Cloud DNS console before you can configure DNS records.
On the DNS Settings page, click Add DNS Record, configure a CNAME record, and then click OK.
In this example, the Record Type parameter is set to CNAME, the Hostname parameter is set to www, the DNS Request Source parameter is set to Asia_Hong Kong, and the Record Value parameter is set to the CDN CNAME. You can use the default values for other parameters or modify other parameters based on your business requirements. For more information, see Add DNS records.
Step 4: Verify the acceleration performance
On a computer in the acceleration region, use the developer tool of a browser to visit www.<YOURDOMAIN>.fun
. Check the loading time of each resource on the current web page.
Check the network latency after GA and CDN are configured.
Check the network latency when only CDN is configured.
You can change the origin site of CDN from the CNAME of GA to the public IP address of the origin server, delete the endpoint group from GA, and then perform a test.
Check the network latency when GA and CDN are not configured.
You can disable the accelerated domain name in CDN, disable the CNAME record in DNS, and then perform a test.
Compare the results.
The test data shows that after CDN is used, the access latency of static content (
test.png
) is reduced. After CDN and GA are used, the access latency of dynamic content (dynamic
) is reduced.Scenario
Static content
test.png
Time consumed (in milliseconds)
Dynamic content
dynamic
Time consumed (in milliseconds)
Comparison
Scenario 1: Use GA and CDN
5
228
Compared with Scenario 2, the access speed of dynamic content is 50.5% faster.
Scenario 2: Use CDN only
5
461
Compared with Scenario 3, the access speed of static content is 98.1% faster.
Scenario 3: GA and CDN are not used
261
474
/
The acceleration performance varies based on the actual workload.
References
Pay-as-you go GA fees include GA instance fees, capacity unit (CU) fees, and data transfer fees. For more information, see Billing of pay-as-you-go GA instances.
When you use GA and CDN to accelerate content delivery, CDN data transfer or bandwidth fees are incurred. For more information, see Billing overview.