You can configure Global Accelerator (GA) to accelerate access to backend services for a specific domain name, improving access speed and user experience.
Use case
This topic uses the following scenario. A company headquartered in the US (Silicon Valley) deploys a web service on a self-managed server. The web service is accessible through the domain name www.example.com on port 80. Due to unstable cross-border networks, employees in the China (Shenzhen) office frequently experience issues such as high latency, jitter, and packet loss when accessing the web service on the US server.
You can use Global Accelerator to route traffic from your China (Shenzhen) office to the US (Silicon Valley) server. Requests enter Alibaba Cloud's network through a nearby access point and are forwarded to the endpoint by using intelligent routing. This configuration improves access speed and user experience.
Prerequisites
You have added an A record in Alibaba Cloud DNS to map the domain name www.example.com to the public IP address of the backend server.
This topic uses a pay-as-you-go standard Global Accelerator instance as an example to show you how to configure the Global Accelerator service to accelerate access to the backend service at a specified domain name. Before you create a pay-as-you-go standard Global Accelerator instance, understand the following information:
-
Pay-as-you-go GA instances use Pay-By-Data-Transfer for bandwidth billing. You do not need to associate a bandwidth package. Cloud Data Transfer (CDT) handles traffic billing.
-
The first time you use a pay-as-you-go GA instance, you must Activate the Service.
Step 1: Configure basic information about an instance
Log on to the GA console.
On the Instances page, click Create Standard Pay-as-you-go Instance.
In the Basic Instance Configuration step, configure the parameters based on the following table and click Next.
Parameter
Description
GA Instance Name
Enter a name for the GA instance.
Instance Billing Method
Pay-As-You-Go is selected by default.
You are charged instance fees, Capacity Unit (CU) fees, and data transfer fees for pay-as-you-go standard Global Accelerator instances.
For more information about instance fees and CU fees, see Pay-as-you-go Global Accelerator instance billing.
For more information about data transfer fees, see Data transfer billing.
Resource Group
Select the resource group to which the standard Global Accelerator instance belongs.
The resource group must be created by the current Alibaba Cloud account in Resource Management. For more information, see Create a resource group.
Step 2: Configure acceleration areas
Configure acceleration areas for the Global Accelerator instance by specifying the regions where your users are located and assigning bandwidth for acceleration.
On the Configure Acceleration Area wizard page, configure the acceleration areas and click Next.
|
Parameter |
Description |
|
Acceleration Area |
From the drop-down list, select one or more regions that you want to accelerate, and then click Add. In this example, the China (Shenzhen) region is selected. Note
If an acceleration area is in the Chinese mainland and your service uses HTTP(S), you must apply for an ICP filing for the domain name. For more information, see Domain name management. |
|
Assign Bandwidth |
|
|
Maximum Bandwidth |
Specify the maximum bandwidth for the acceleration region. Each acceleration region supports a bandwidth range of 2 to 10,000 Mbit/s. The maximum bandwidth is used for bandwidth throttling. The data transfer fees are managed by CDT. In this example, the default value 200 Mbit/s is used. Important If 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. |
|
IP Protocol |
Select the IP protocol that is used to access the Global Accelerator service. In this example, IPv4 is selected. |
|
ISP Line Type |
Select the ISP line type for accessing the Global Accelerator service. In this example, BGP (Multi-ISP) is selected. |
Step 3: Configure a listener
A listener listens for connection requests and distributes the requests to endpoints based on the port and the protocol that you specify. Each listener is associated with an endpoint group. You can associate an endpoint group with a listener by specifying the region to which you want to distribute network traffic. After you associate an endpoint group with a listener, network traffic is distributed to the optimal endpoint in the endpoint group.
On the Configure Listeners wizard page, configure the listener, and then click Next.
This section describes only the parameters that are relevant to this scenario. You can keep the default values for other parameters or modify them based on your business requirements. For more information, see Other listener parameters.
|
Parameter |
Description |
|
Listener Name |
Enter a name for the listener. |
|
Routing Type |
Select a routing type. In this example, Intelligent Routing is selected. |
|
Protocol |
Select a protocol for the listener. In this example, HTTP is selected. |
|
Port |
Specify the listener port to receive requests and forward them to endpoints. The port number must be in the range of 1 to 65499. In this example, 80 is entered. |
Step 4: Configure an endpoint group and endpoints
-
On the Configure an Endpoint Group wizard page, configure the endpoint group and endpoints.
This section describes only the parameters that are relevant to this scenario. You can keep the default values for other parameters or modify them based on your business requirements. For more information, see Other endpoint group parameters.
Parameter
Description
Region
Select the region of the endpoint group.
In this example, US (Silicon Valley) is selected.
Endpoint Configuration
An endpoint is the destination for client requests. Configure the endpoint based on the following information:
-
Backend Service Type: Select Custom Domain Name.
-
Backend Service: Enter the domain name of the backend service that you want to accelerate. In this example, enter
.www.example.com -
Weight: Enter a weight for the endpoint. The weight can be an integer from 0 to 255. Global Accelerator routes traffic to endpoints in proportion to the weights that you specify. In this example, the default value of 255 is used.
WarningIf the weight of an endpoint is set to 0, Global Accelerator stops distributing traffic to that endpoint. Proceed with caution.
-
-
Read the Compliance Commitments Regarding Cross-border Data Transfers, select Agree to the Preceding Compliance Agreement, and then click Next.
This scenario involves acceleration from China (Shenzhen) to US (Silicon Valley). You must agree to the Compliance Commitments Regarding Cross-border Data Transfers to use cross-border traffic.
After the instance is created, the Transmission Network Type is set to premium bandwidth for cross-domain acceleration by default. No additional configurations are required. This enables network acceleration between the Chinese mainland and regions outside the Chinese mainland, such as China (Hong Kong), China (Macao), and China (Taiwan), or other countries and regions. For more information, see Data transfer billing.
-
On the Configuration Review page, review the settings and click Submit.
NoteCreating a GA instance takes about 3 to 5 minutes.
-
Optional: After the instance is created, click Go to Instance Details below the task list. On the instance details page, you can click the Instance Information, Listeners, or Acceleration Areas tab to view the instance configuration.
Step 5: Configure a CNAME record
To enable acceleration, point your domain name to the CNAME address of the Global Accelerator instance. To do this, perform the following steps:
-
Modify the default DNS resolution line of the existing A record to a region-specific DNS resolution line. In this example, you change the line to handle requests from North America and the United States.
-
Add a CNAME record. In this example, a CNAME record maps the domain name
www.example.comto the CNAME address that is assigned to the Global Accelerator instance.
By default, the Free Edition of Alibaba Cloud DNS is used. You must upgrade Alibaba Cloud DNS to the Enterprise Ultimate Edition or Enterprise Standard Edition to return intelligent DNS query results to end users in different regions. For more information about how to upgrade, see Renewal.
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 Configure page, modify the existing A record as follows, and then click OK.
-
Find the target A record and click Modify.
-
In the Edit Record panel, select Abroad, North America, and United States in sequence from the DNS Request Source list.
-
-
On the Configure page, click Add Record, add a CNAME record with the following parameters, and then click OK.
Parameter
Description
Record Type
Select CNAME.
Hostname
Enter the prefix of the accelerated domain name.
In this example, enter www.
DNS Request Source
Use the default value.
TTL
The time-to-live (TTL) is the duration that a DNS record is cached on a DNS server. A smaller value indicates that modifications to the record take effect faster in different regions.
In this example, the default value of 10 minutes is used.
Record Value
Enter the CNAME that is assigned to the Global Accelerator instance.
You can view the CNAME of the Global Accelerator instance on the Instances page.
Step 6: Test the acceleration performance
This topic uses Alibaba Cloud Linux 3 as an example. Test commands vary based on the operating system. For specific commands, see the user guide for your operating system.
If you specify UDP as the protocol when you add a listener to Global Accelerator, you can verify the acceleration performance of Global Accelerator by using UDPing. For more information, see Verify the acceleration performance of a UDP listener.
-
Open the command-line window on a computer in the acceleration area. In this example, the acceleration area is China (Shenzhen).
-
Run the following command to verify that the CNAME configuration has taken effect.
ping <accelerated domain name>If the resolved CNAME matches the CNAME of your Global Accelerator instance, the configuration is active. After you run the command, if the resolved CNAME address contains the
ga-bpprefix, the acceleration service is working.[root@iZ xxx ~]# ping www.xxx PING ga-bp xxx 3.com (120.xxx.219) 56(84) bytes of data. 64 bytes from 120.xxx.219 (120.xxx.219): icmp_seq=1 ttl=95 time=3.17 ms 64 bytes from 120.xxx.219 (120.xxx.219): icmp_seq=2 ttl=95 time=3.20 ms 64 bytes from 120.xxx.219 (120.xxx.219): icmp_seq=3 ttl=95 time=3.22 ms ^C --- ga-bp1 xxx .com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 3.170/3.198/3.224/0.022 ms -
Run the following command to check the access latency.
curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "http[s]://<accelerated domain name>"Take note of the following parameters:
time_connect: The period of time that is required to establish a TCP connection. Unit: seconds.
time_starttransfer: The start time of data transfer. The start time refers to the amount of time from when the client sends a request to the backend server to when the first byte is sent to the client. Unit: seconds.
time_total: The total connection time. The total connection time refers to the period of time from the time when the client sends a request to the time when the client receives the last byte from the backend server. Unit: seconds.
The test results show that Global Accelerator significantly decreases the connection time. This indicates reduced latency for clients in the China (Shenzhen) office when accessing the web service in US (Silicon Valley).
Figure 1. Access latency before acceleration
[root@iZwxxx ~]# curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "http://www.xxx" time_connect: 0.175399 time_starttransfer: 0.351232 time_total: 0.351269Figure 2. Access latency after acceleration
[root@iZxxx ~]# curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "http://www.xxx" time_connect: 0.003695 time_starttransfer: 0.184880 time_total: 0.184916NoteThe acceleration performance of the Global Accelerator service is subject to your actual business tests.