All Products
Search
Document Center

Global Accelerator:Use a single GA instance to accelerate multiple domain names over HTTP

Last Updated:Jan 16, 2024

This topic describes how to use a single Global Accelerator (GA) instance to accelerate multiple domain names over HTTP.

Background information

The following scenario is used as an example. An enterprise deployed two servers in the Singapore region for its headquarters. A web application that provides Internet-facing services by using two different domain names over HTTP is deployed on both servers. Most employees of the company need to access the web application from the China (Hong Kong) region. The company faces the following challenges:

  • The network connections that are established over the Internet are unstable. Network issues, such as network latency, network jitter, and packet loss, frequently occur.

  • Multiple servers provide Internet-facing services through two domain names. The company must configure content delivery acceleration for both domain names, which increases costs.

To resolve the issue, you can deploy the GA service and configure HTTP listeners.

多路径HTTP-HTTP

The following table describes information about the web servers of the enterprise and the forwarding rules that the HTTP listeners use after the enterprise uses the GA service to accelerate its web application.

Domain name

Forwarding rule

Endpoint group

Server

Service protocol

Service port

Server public IP

xxxtest.cloud

Default forwarding rule

Default endpoint group

Server 1

HTTP

80

8.219.XX.XX

www.xxxtest.cloud

Custom forwarding rule

Virtual endpoint group

Server 2

HTTP

80

47.245.XX.XX

Prerequisites

  • An HTTP service that uses port 80 is deployed on a backend server.

  • The A records that map backend domain name 1 (xxx test.cloud) and backend domain name 2 (www.xxx test.cloud) to the public IP addresses of the backend servers are created.

  • An Internet Content Provider (ICP) number is obtained. A website must obtain an ICP number to provide services in the Chinese mainland. For more information, see What is an ICP filing?

Note

In this example, NGINX is used to deploy the backend HTTP service and GA is used to configure the DNS record.

  • For information about how to deploy NGINX, see Step 2: Install NGINX.

  • For 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 topic, a pay-as-you-go standard GA instance is used to show how to configure GA to accelerate multiple domain names over HTTP. Before you create a pay-as-you-go standard GA 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 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 an acceleration area

Configure an acceleration area for the GA instance, specify the regions where users that require acceleration are located, 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, the China (Hong Kong) region of Asia Pacific is selected.

Assign Bandwidth

Peak 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 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 version that is used to connect to GA.

In this example, the default value IPv4 is selected.

ISP Line Type

Select an ISP line type for the GA.

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.

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 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 client affinity is enabled, 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.

Custom HTTP Headers

Select the HTTP headers that you want to add.

In this example, the default settings are used.

Show custom HTTP headers.

  • Obtain the GA instance ID by using the GA-ID header

  • Obtain the information about the acceleration region by using the GA-AP header

  • Obtain the listening protocol of the GA instance by using the GA-X-Forward-Proto header

  • Obtain the listening port of the GA instance by using the GA-X-Forward-Port header

  • Obtain client IP addresses by using the X-Real-IP header

Step 4: Configure an endpoint group and endpoints

  1. In the Configure an endpoint group step, configure the endpoint group and the endpoints, and then click Next.

    This topic describes only the key parameters. For more information, see Add and manage endpoint groups of intelligent routing listeners.

    Parameter

    Description

    Region

    Select the region where you want to deploy the endpoint group.

    In this example, Singapore 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 IP address of the backend service that you want to accelerate. In this example, the public IP address (8.219.XX. XX) of server 1 is entered.

    • Weight: Enter the weight of the endpoint. Valid values: 0 to 255. GA routes network traffic to endpoints based on the weights of the endpoints. 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

    By default, the source IP address of the client is retained. The backend service can view the source IP address of the client. HTTP listeners can retrieve client IP addresses from the X-Forwarded-For HTTP header. For more information, see Preserve client IP addresses.

    Backend Service Protocol

    Select the protocol that is used by backend servers.

    In this example, the default value HTTP is used.

    Port Mapping

    If the listener port and the port that is used by the endpoint to provide services are different, you must configure this parameter.

    • Listener Port: Enter the listener port.

    • Endpoint Port: Enter the port over which the endpoint provides services.

    If the listener port and the port that is used by the endpoint to provide services are the same, you do not need to add a port mapping. GA automatically forwards client requests to the listener port of the endpoint.

    In this example, no port mapping is configured.

    Traffic Distribution Ratio

    Specify a traffic distribution ratio for the endpoint group.

    Valid values: 0 to 100.

    In this example, the default value 100 is used.

    Health Check

    Specify whether to enable the health check feature.

    After you enable the feature, you can use health checks to check the status of endpoints. For more information about the health check feature, see Enable and manage health checks.

    In this example, health checks are disabled.

  2. In the Configuration Review step, check the configurations 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 to view more details.

  4. Configure a virtual endpoint group.

    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. On the Endpoint Group tab, click Add Virtual Endpoint Group in the Virtual Endpoint Group section.

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

      The configurations of the virtual endpoint group are the same as those of the default endpoint group that you created in Step 4-1, except for the Backend Service parameter. For this example, set Backend Service to 47.245.XX.XX, which is the public IP address of Server 2.

Step 5: Add a forwarding rule

When an HTTP listener receives requests, the HTTP listener forwards the requests that meet the conditions in forwarding rules to the associated endpoint groups. If the requests do not match a custom forwarding rule, the HTTP listener forwards the requests to the default endpoint group in the default forwarding rule.

In this step, create a custom forwarding rule for the virtual endpoint group of Server 2 to forward all requests from the www. xxx test.cloud domain to Server 2.

  1. On the listener details page, click the Forwarding Rule tab.

  2. On the Forwarding Rule tab, click Add Forwarding Rule.

  3. In the Add Forwarding Rule section, configure the following parameters and click OK.

    • Name: Enter a name for the forwarding rule.

    • If (Matching All Conditions): Select a match condition for the forwarding rule. In this example, Domain is selected and the www. xxx test.cloud domain name is entered.

    • Then: Select a forwarding action. In this example, Forward to is selected and the virtual endpoint group that you created is selected.

    转发策略.png

Step 6: Add a CNAME record

You must create a DNS record to map the domain name that you want to access to the CNAME of the GA instance. This way, requests can be forwarded to GA.

  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 that you want to manage and click DNS Settings in the Actions column.

  4. On the DNS Settings page, find the A record and click Modify in the Actions column.

    In this example, the Hostname of domain name 1 is set to @, and the Hostname of domain name 2 is set to www.

  5. In the Modify DNS Record panel, set Record Type to CNAME, set Record Value to the CNAME assigned to the GA instance, and then click OK.

    You can view the CNAME assigned to the GA instance on the Instances page.

Note

If you want to return resolution results based on the region where a client resides, make sure that Alibaba Cloud DNS is upgraded to Enterprise Standard Edition or Enterprise Ultimate Edition. For more information, see the "Upgrade" section of the Renewal and upgrade topic.

After the upgrade is complete, you can change the default ISP line of the existing A record to the ISP line of a specific region and add a CNAME record that maps the website domain name to the CNAME assigned to the GA instance.

Step 7: Test network connectivity

Perform the following steps to check whether a client can access web services deployed in the Singapore region by using different domain names and whether content delivery is accelerated:

Note

In this example, the Alibaba Cloud Linux 3 operating system is used. The command that is used to test the connectivity varies based on the operating system that you use. For more information, see the user guide of your operating system.

  1. Check whether the CNAME record takes effect.

    1. Open the CLI on an on-premises machine in the China (Hong Kong) region.

    2. Run the following command to ping xxx test.cloud and www. xxx test.cloud domain names:

      ping <Website domain name>

      If the CNAME in the output is the same as the CNAME assigned by GA, the CNAME record takes effect.

      CNAME生效验证.png

  2. Run the following command for domain name 1 (xxx test.cloud) and domain name 2 (www. xxx test.cloud) to test the network connectivity:

    curl http://<The domain name of the web application>

    Figure 1. Access result of domain name 1 测试网站连通性 ECS02.png

    Figure 2. Access result of domain name 2 测试网站连通性 ECS01.png

  3. For information about how to test acceleration performance, see Use network detection tools to verify acceleration performance.