Global Accelerator (GA) can be used together with Alibaba Cloud CDN (CDN) to accelerate content retrieval from origin servers. 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.
Background information
The following scenario is used as an example. A web service is deployed in the US (Silicon Valley) region. The origin servers provide web services through elastic IP addresses (EIPs) of Alibaba Cloud. The forwarding port is TCP port 80. Users are located in the China (Hong Kong) region. When clients in China (Hong Kong) access the web service in US (Silicon Valley), issues such as 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 set CDN to interact with GA to accelerate the delivery of dynamic content on a global scale.
Procedure
Step 1: Enter the required information about the accelerated web service
You can enter the information about the accelerated web service in the GA console. The system then generates a list of recommended services, including a GA instance and a basic bandwidth plan.
Log on to the GA console.
In the upper-right corner of the Instances page, click Purchase Guide.
NoteSkip the step if it is your first time using GA.
In the Enter the required information to generate a list of recommended services section, enter the required information.
Acceleration Area: Select the region where acceleration is required. In this example, China (Hong Kong) is selected.
Service Region: Select the region where the backend servers are located. In this example, US (Silicon Valley) is selected.
ICP Filing: If you need to accelerate a web service, specify whether you have requested an Internet Content Provider (ICP) number for the domain name of the web service. If the backend service is not a web service, select No. In this example, No is selected.
NoteIf the accelerated service is deployed in the Chinese mainland or the acceleration region is in the Chinese mainland, you must obtain an ICP number before you can provide the service. For more information, see What is an ICP filing?
Server Area: Specify whether the backend servers are deployed on Alibaba Cloud. In this example, On Alibaba Cloud is selected.
Peak Bandwidth Range: Enter the bandwidth required during peak hours. Unit: Mbit/s. In this example, 10 is entered.
Maximum Concurrent Connections: Specify the maximum number of concurrent connections that the GA instance supports. When the number of concurrent connections reaches the upper limit, new connection requests are discarded. In this example, 5 Thousand is selected.
Click Generate Service List.
After a list is generated, you can check the recommended services in the list.
Step 2: Purchase a service bundle
You can purchase a GA service bundle based on the recommended service list. The list includes a GA instance and a basic bandwidth plan.
Click Buy Service Bundle.
On the buy page, set the following parameters for the GA instance:
Term: Select a subscription duration.
NoteThe subscription duration applies to all services in the service bundle. For example, if you set the subscription duration to one year, you subscribe to both the GA instance and basic bandwidth plan for one year.
Specification: Select a specification for the GA instance that you want to create. In this example, Small I (Specifications Unit) is selected.
Bandwidth Type: Select the bandwidth type of the basic bandwidth plan. In this example, Premium is selected.
Peak Bandwidth: Specify the maximum bandwidth of the basic bandwidth plan. In this example, the value is set to 10 Mb.
Click Buy Now and complete the payment.
After you complete the payment, associate the basic bandwidth plan with the GA instance. For more information, see Associate a basic bandwidth plan.
After you purchase the service bundle, the system automatically assigns a CNAME to the GA instance. Requests destined for the CNAME are accelerated and resolved to the origin servers.
Step 3: Add an acceleration area
After you purchase a GA instance, you can add an acceleration area, specify the region to which clients belong, and then allocate resources to the region.
On the Instances page, find the GA instance that you created in Step 2: Purchase a GA service bundle and click the instance ID.
On the instance details page, click the Acceleration Areas tab. Then, click the Asia Pacific tab and click Add Region.
In the Add Acceleration Area dialog box, configure the parameters and click OK. The following table describes the parameters.
Region: Select the region where users are located. In this example, China (Hong Kong) is selected.
Bandwidth: Specify a maximum bandwidth value for the acceleration region. In this example, 10 Mbit/s is entered.
IP Protocol: Select the IP version of the clients that use GA. In this example, IPv4 is selected.
After an acceleration area is added, GA assigns an accelerated IP address to each acceleration region in the area. The accelerated IP address is used to accelerate client access.
Step 4: Add a listener
Listeners are used to monitor connection requests from clients. GA monitors connection requests received on the specified listener ports and forwards the requests to endpoints through the specified protocol.
On the instance details page, click the Listeners tab and then click Add Listener.
On the Configure Listener & Protocol wizard page, set the following parameters for the listener:
Parameter
Description
Listener Name
Enter a name for the listener.
The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.
Protocol
Select a protocol for the listener.
In this example, TCP is selected.
Port Number
Specify a listener port to receive and forward requests to endpoints. Valid values: 1 to 65499.
In this example, port 80 is used.
Client Affinity
Specify whether to enable client affinity. If you enable client affinity, requests from the same client are forwarded to the same endpoint when the client connects to a stateful application.
In this example, Source IP is selected.
Click Next to configure an endpoint group.
Step 5: Configure an endpoint group
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 Endpoint Group wizard page, set the following parameters for the endpoint group:
The following table describes only the parameters that are relevant to this topic. For more information, see Create and manage the endpoint groups of intelligent routing listeners.
Parameter
Description
Endpoint Group Name
Enter a name for the endpoint group.
The name must be 2 to 128 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.
Select Acceleration Region
Select the region to which the endpoint group (destination servers) belongs.
In this example, US (Silicon Valley) is selected.
Endpoint Configuration
Client requests are routed to endpoints. To add an endpoint, configure the following parameters:
Backend Service Type: Select Alibaba Cloud Public IP Address.
Backend Service: Enter the public IP address of the backend service that you want to accelerate.
Weight: Enter a weight for the endpoint. Valid values: 0 to 255. GA distributes network traffic to endpoints based on the configured weights.
WarningIf the weight of an endpoint is set to 0, GA stops distributing network traffic to the endpoint. Proceed with caution.
Preserve Client IP
Specify whether to preserve client IP addresses.
If you enable this feature, the backend server can obtain client IP addresses. For more information, see Preserve client IP addresses.
In this example, Preserve Client IP is disabled.
Click Next, confirm the configurations of the listener and endpoint, and then click Submit.
Step 6: Activate CDN
CDN reduces the loads of the origin and helps avoid network congestion. You can use CDN to accelerate website content delivery in different areas and for different scenarios. You must activate CDN before you can use the service.
Skip this step if you have activated CDN.
Visit the product page of Alibaba Cloud CDN.
Click Activate Now.
On the activation page, specify Billing Method based on your business requirements.
For information about the billing rules of CDN, see CDN pricing.
Select the Alibaba Cloud CDN Terms of Service check box and click Activate Now.
After CDN is activated, click Console to log on to the CDN console.
Step 7: Add an accelerated domain name
CDN retrieves resources from the origin servers and caches them on CDN edge nodes. When a client requests resources from an accelerated domain name, CDN retrieves the resources from the CDN node that is the nearest to the client.
In the left-side navigation pane, click Domain Names.
On the Domain Names page, click Add Domain Name.
On the Add Domain Name page, configure the following parameters to add an accelerated domain name.
Set the parameters in the Basic Configuration section.
Parameter
Description
Domain Name to Accelerate
Enter the domain name of the web service to be accelerated.
In this example, www.example.com is entered.
Business Type
Select the business type of your website.
After you configure the Business Type parameter, you cannot modify the value.
Image and Small File: If you need to accelerate the delivery of small-size and static resources, such as small files, images, and web style sheets, we recommend that you select this option. For more information, see the "Image and small file distribution" section of the Common scenarios topic.
Large File Download: For downloads of static content whose size is greater than 20 MB, we recommend that you select this option. Large file downloads refer to game package installation, app updates, mobile ROM upgrades, and app downloads. For more information, see the "Large file distribution" section of the Common scenarios topic.
VOD: If you need to accelerate the delivery of audio or video files for VOD playback, we recommend that you select this option. For more information, see the "On-demand audio and video streaming" section of the Common scenarios topic.
DCDN: If your website contains a large amount of dynamic and static content, and most of the requests are for dynamic resources, we recommend that you select this option. For more information, see What is DCDN?
In this example, Image and Small File is selected.
Region
Select the area to be accelerated.
In this example, Global (Excluding Mainland China) is selected.
NoteIf the area to be accelerated includes the Chinese mainland, your domain name must have an ICP number. For more information, see What is an ICP filing?
In the Origin Servers section, click Add Origin Server. In the Add Origin Server dialog box, set the following parameters.
Parameter
Description
Origin Info
Enter the information about the origin server. If the requested resources are not cached on CDN edge nodes, requests are redirected to the origin server to retrieve the resources.
Select Site Domain in this example, and enter the CNAME to the GA instance. For more information, see Step 2: Purchase a GA service bundle.
Priority
You can configure priorities to specify primary and secondary origin servers. The primary origin server has a higher priority than the secondary origin server. Alibaba Cloud CDN preferentially redirects requests to the primary origin server.
In this example, Primary is selected.
Weight
If origin servers have the same priority, Alibaba Cloud CDN redirects requests to the origin servers based on their weights. This balances loads among the origin servers. The valid values of origin server weights are 1 to 100. A greater value indicates a higher weight. An origin server with a higher weight receives more user requests. The default weight is 10. You can specify a weight based on your business requirements.
100 is entered in this example.
Port
The default port is port 80. You can specify a port based on the settings of your origin server. Valid values are 1 to 65535. Custom ports support only HTTP. If you want CDN to redirect HTTPS requests to origin servers over custom ports, see Configure the origin protocol policy.
In this example, port 80 is used.
Click Next, and then click Return to Domain Name List.
After you add an accelerated domain name, CDN assigns a CNAME to the domain name.
Step 8: Configure DNS settings
After you add an accelerated domain name, you must modify the DNS record to resolve the domain name to CDN. Then, requests sent to the domain name can be forwarded to CDN edge nodes for acceleration. The following example shows how to configure the DNS record in the Alibaba Cloud DNS console.
If you use the DNS resolution service that is provided by a third-party service provider, log on to the platform of the service provider and modify the DNS record for your OSS bucket.
- Log on to the Alibaba Cloud DNS console.
- On the Manage DNS page, find the target domain name, and click Configure in the Actions column.
- On the Configure page, find the DNS records, and click Edit in the Actions column.
In the Edit Record panel, set Type to CNAME and set Value to the CNAME that is assigned to the accelerated domain name in Step 7: Add an accelerated domain name.
Click Confirm.
Step 9: Verify the settings
Use a computer that runs Windows in China (Hong Kong) to check how GA interacts with CDN to accelerate content delivery.
To test the acceleration performance, perform the following steps:
Enter the domain name www.example.com into the address bar of the browser to access the web service deployed in the US (Silicon Valley) region.
Open the CLI and run the following command to check the latency of data transmission:
curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "http[s]://<the domain name of the web service>[:<port>]"
where:- time_connect: the period of time to establish a TCP connection.
- time_starttransfer: the period of time for the backend server to send the first byte after the client sends a request.
- time_total: the period of time for the backend server to respond to the session after the client sends a request.