All Products
Search
Document Center

Global Accelerator:Use GA to accelerate applications deployed across regions and implement discover recovery for high availability

Last Updated:Feb 19, 2024

You can use Global Accelerator (GA) to accelerate applications that are deployed across regions. GA forwards requests to the regions in which an application is deployed and implements disaster recovery for high availability.

Background information

A finance company is headquartered in the US (Silicon Valley) region and has a branch in the US (Virginia) region. ECS01 is created in the US (Silicon Valley) region and ECS02 is created in the US (Virginia) region. An application is deployed on the Elastic Compute Service (ECS) instances. Most clients are located in China (Hong Kong) and Japan. To ensure that the business-critical application runs as expected and reduce losses when errors occur, the application must meet the following requirements:

  • If errors occur in the headquarters in the US (Silicon Valley) region, the company can fail over to the branch in the US (Virginia) region.

  • Network issues due to unstable cross-region Internet connections, such as network latency, network jitter, and packet loss, must be reduced.

GA容灾

You can create a GA instance and specify the Japan (Tokyo) and China (Hong Kong) regions as acceleration regions. Then, you can create Endpoint Group 1 in the US (Silicon Valley) region and Endpoint Group 2 in the US (Virginia) region. GA intelligently distributes requests based on the priority and traffic distribution ratio of each endpoint group. This way, traffic can be distributed across multiple regions.

You can enable the health check feature for multiple endpoint groups. If the endpoint group deployed in the headquarters fails the health check, GA distributes new requests to the healthy endpoint group that is deployed in the branch. After the unhealthy endpoint group recovers, GA distributes requests to the endpoint group again. This ensures the high availability of the application that is deployed across regions and reduces network latency.

In addition, you can configure DNS settings based on the CNAME that is allocated by GA. The CNAME of GA can be resolved based on the region. Different accelerated IP addresses are returned for users in different regions. This reduces the network latency and accelerates access to the application.

Prerequisites

  • An application is deployed on ECS01 in the US (Silicon Valley) region and ECS02 in the US (Virginia) region.

  • Two A records are created to map the application domain name to the public IP addresses of the backend servers.

Note

In this example, NGINX is used to deploy the backend HTTP service that uses port 80 and Alibaba Cloud DNS is used to configure the DNS records.

  • For more information about how to deploy an NGINX service, see Install NGINX.

  • For more information about how to configure DNS records, see Add a DNS record. If you use a third-party DNS service, refer to the user guide of the service provider.

Procedure

跨地域应用高可用容灾.png

Note

In this example, a pay-as-you-go standard Global Accelerator instance is used. Before you create a pay-as-you-go standard Global Accelerator instance, take note of the following information:

  • Pay-as-you-go Global Accelerator instances use the pay-by-data-transfer metering method. You do not need to associate a basic bandwidth plan with pay-as-you-go GA instances. The billing of data transfer over the Global Accelerator network is managed by Cloud Data Transfer (CDT). For more information, see Pay-by-data-transfer.

  • The first time you use a pay-as-you-go GA instance, go to the pay-as-you-go GA activation page and activate GA as prompted.

Step 1: Configure the basic information about an instance

  1. Log on to the GA console.

  2. On the Instances page, click Create GA Instance. Select Subscription Standard Instance or Pay-as-you-go Standard Instance based on your business requirements.

    In this example, Pay-as-you-go Standard Instance is selected.

  3. In the Basic Instance Configuration step, configure the following parameters 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 GA instances.

    Resource Group

    Select the resource group to which the standard GA instance belongs.

    The resource group must be a resource group created in Resource Management by the current Alibaba Cloud account. For more information, see Create a resource group.

Step 2: Configure acceleration areas

By adding an acceleration area, you can specify the regions of the GA users and allocate bandwidth to the regions.

In the Configure acceleration areas step, configure the parameters and click Next. The following table describes the parameters.

Parameter

Description

Acceleration Area

Select one or more regions from the drop-down list and click Add.

In this example, China (Hong Kong) and Japan (Tokyo) are selected.

Assign Bandwidth

Maximum Bandwidth

Specify the 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 maximum bandwidth value, throttling may occur and traffic may be dropped. Specify a maximum bandwidth value based on your business requirements.

IP Protocol

Select the IP version that is used to connect to Global Accelerator.

In this example, the default value IPv4 is selected.

ISP Line Type

Select an ISP line type for the Global Accelerator.

BGP (Multi-ISP) is selected in this example.

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.

In the Configure listener step, set the required parameters, and click Next.

The following table describes only the parameters that are relevant to this topic. Use the default values for other parameters. For more information, see Add a TCP or UDP listener.

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.

You can create endpoint groups in different regions only for one TCP or UDP listener.

In this example, TCP is selected.

Port

Specify a port for the listener 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, Disable is selected.

Step 4: Configure endpoint groups and endpoints

You can create endpoint groups in the US (Silicon Valley) and US (Virginia) regions, and configure health checks for the endpoint groups to ensure the high availability of the application.

You can also specify traffic distribution ratios to change the proportion of requests that are forwarded to each endpoint group.

  1. Create an endpoint group in the US (Silicon Valley) region.

    1. In the Configure an endpoint group step, configure the following parameters and click Next.

      Parameter

      Description

      Region

      Select the region to which the endpoint group (destination servers) belongs.

      In this example, US (Silicon Valley) is selected.

      Note

      The regions of endpoint groups must be unique. You can create only one endpoint group in each region.

      Endpoint Configuration

      Client requests are routed to endpoints. To add an endpoint, configure the following parameters:

      • Backend Service Type: Select Alibaba Cloud Public IP.

        Important

        If you specify ECS instances in virtual private clouds (VPCs), Alibaba Cloud public IP addresses, custom IP addresses of origin servers, or custom domain names of origin servers as endpoints, you can configure health checks for the endpoints. If you specify Server Load Balancer (SLB) instances as endpoints, the health check configurations do not take effect.

      • Backend Service: Enter the IP address of the backend service that you want to accelerate. In this example, the IP address of ECS01 that is deployed in the US (Silicon Valley) region is entered.

      • Weight: Enter the weight of the endpoint. Valid values: 0 to 255. GA distributes network traffic to endpoints based on the weights. In this example, the default value 255 is used.

        Warning

        If you set the weight of an endpoint to 0, Global Accelerator 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, the default value Do Not Preserve is used.

      Traffic Distribution Ratio

      Specify a traffic distribution ratio for the endpoint group.

      Valid values: 0 to 100. In this example, 50 is entered.

      Health Check

      Specify whether to enable the health check feature. After you enable this feature, you can perform health checks to check the status of endpoints.

      In this example, the health check feature is enabled.

      Health Check Protocol

      Select the protocol that you want to use for health checks. Valid values: TCP, HTTP, and HTTPS.

      In this example, HTTP is selected.

      Port

      Specify the port of the endpoint to which probe packets are sent for health checks. Valid values: 1 to 65535.

      In this example, 80 is entered.

      Health Check Interval

      Specify the interval between two consecutive health checks. Unit: seconds. Valid values: 1 to 50.

      In this example, 2 is entered.

      Path

      Specify the path that is used for health checks.

      The URI must be 1 to 80 characters in length and start with a forward slash (/). The URI can contain letters, digits, hyphens (-), forward slashes (/), periods (.), percent signs (%), question marks (?), number signs (#), and ampersands (&). The URI can also contain the following extended characters: _ ; ~ ! ( ) * [ ] @ $ ^ : ' , +.

      By default, GA sends a GET request to the default homepage of the backend service. If you do not want to use the default homepage for health checks, you can manually specify a URI.

      In this example, / is specified.

      Note This parameter is supported only for HTTP and HTTPS health checks.

      Healthy Threshold

      The number of consecutive health check failures that must occur before a healthy endpoint is considered unhealthy, or the number of consecutive health check successes that must occur before an unhealthy endpoint is considered healthy. Valid values: 2 to 10.

      In this example, 3 is entered.

    2. In the Configuration Review step, confirm the configurations of the listener and Endpoint Group 1 and click Submit.

      Note

      It takes 3 to 5 minutes to create a Global Accelerator instance.

    3. (Optional) After you create a GA instance, you can click the instance ID on the Instances page to view the configurations of the instance. On the instance details page, you can click tabs such as Instance Information, Listeners, and Acceleration Areas.

  2. Create an endpoint group in the US (Virginia) region.

    1. On the instance details page, click the Listeners tab.

    2. On the Listeners tab, find the listener that you want to manage and click the endpoint group ID in the Default Endpoint Group column.

    3. In the Default Endpoint Group section of the Endpoint Group tab, click + Add Endpoint Group.

    4. On the Add Endpoint Group page, configure the parameters based on the following information and click Create.

      • Region: Select US (Virginia).

      • Backend Service of Endpoint Configuration: Enter the IP address of the origin server ECS02 in the US (Virginia) region.

      For other parameters, use the same configurations when you create Endpoint Group 1.

Step 5: Create a CNAME record

You can modify DNS resolution settings to map the domain name of the application to the CNAME of the GA instance. When a client accesses the backend service by using the domain name, GA resolves the domain name to an accelerated IP address based on the region of the client.

  1. Log on to the Alibaba Cloud DNS console.

  2. If your domain name is not registered by using Alibaba Cloud Domains, you must add your domain name to Alibaba Cloud DNS.

    Note

    If your domain name is not registered by using Alibaba Cloud Domains, you must add your domain name to Alibaba Cloud DNS before you can configure a DNS record. For more information, see the "Add a domain name" section of the Manage domain names topic. If your domain name is registered by using Alibaba Cloud Domains, skip this step.

  3. On the Domain Name Resolution page, find the domain name and click DNS Settings in the Actions column to go to the DNS Settings page.

  4. On the DNS Settings page, find and select the existing A records, click Batch Operation, and then click Delete.

  5. On the DNS Settings page, click Add DNS Record. In the Add DNS Record panel, configure the following parameters and click OK.

    • Record Type: Select CNAME from the drop-down list.

    • Hostname: Enter the prefix of the subdomain name. In this example, @ is entered.

    • DNS Request Source: Select Default.

    • Record Value: Enter the CNAME that is allocated by GA.

      You can find the CNAME allocated by Global Accelerator on the Instances page.

    • TTL Period: the period of time for which the DNS record is cached on the DNS server. A smaller value indicates a shorter period of time to apply record updates. The default value 10 Minutes is used.

  6. Check whether the CNAME record takes effect.

    Open the CLI on a computer in an acceleration region and run the ping command to ping the accelerated domain name.

    If the CNAME in the output is the same as the CNAME allocated by Global Accelerator, the CNAME record takes effect.

Step 6: Verify the acceleration performance

To check how disaster recovery ensures the high availability of the application that is deployed across regions, perform the following steps.

Note

The following operating systems are used in this example. The command that is used to run the test may vary based on the operating system. For more information, refer to the user guide of the operating system.

  • Client operating system: Windows Server 2022.

  • Origin server operating system: Alibaba Cloud Linux 3.

Check the high availability of endpoint groups

  1. Disconnect the origin server in the US (Silicon Valley) region to simulate the failure of an endpoint group and check the access result.

    1. Open a browser on a computer in China (Hong Kong), Japan (Tokyo), and another region.

    2. Enter the domain name of the application that is deployed in the US (Silicon Valley) region and the US (Virginia) region.

      The following figures show the test results.

      • The following figure shows the access result after a client in the China (Hong Kong) region accesses the application. The responsive server is ECS02 that is deployed in the US (Virginia) region.

        HK 访问结果 01断掉.png

      • The following figure shows the access result after a client in the Japan (Tokyo) region accesses the application. The responsive server is ECS02 that is deployed in the US (Virginia) region.

        JP 访问结果 01断掉.png

  2. After the server in the US (Silicon Valley) region recovers, use the preceding method to check the access results of client requests from the China (Hong Kong) and Japan (Tokyo) regions.

  • The following figure shows the access result after a client in the China (Hong Kong) region accesses the application. The responsive server is ECS01 that is deployed in the US (Silicon Valley) region.

    HK 访问恢复.png

  • The following figure shows the access result after a client in the Japan (Tokyo) region accesses the application. The responsive server is ECS01 that is deployed in the US (Silicon Valley) region.

    JP 访问恢复.png

Note

The endpoint group that responds to client requests varies based on your business. If you configure multiple acceleration regions and endpoint groups for a GA instance, the resolution results of client requests vary based on the priority and traffic distribution ratio of each endpoint group. For more information, see Distribute traffic across endpoint groups in different scenarios.

Verify the acceleration performance

For more information about how to verify the acceleration performance, see Use network detection tools to verify acceleration performance.