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

Prerequisites

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

Background information

The following scenario is used in this example. An enterprise deployed two servers in the China (Beijing) region for its headquarters, and a web application is deployed on both servers. The web application provides Internet-facing services through two different domain names over HTTP. Most employees of the enterprise need to access the web application from the China (Hangzhou) region. They face 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, may frequently occur.
  • Multiple servers provide Internet-facing services through two domain names. The company must configure content delivery acceleration for both domain names. This increases the cost.

To resolve these issues, you can deploy the GA service and configure HTTP listeners. HTTP listeners support domain name-based forwarding rules. HTTP listeners can forward requests that are destined for different domain names to the corresponding backend servers. This allows you to use only one GA instance to accelerate multiple domain names over HTTP.

Architecture

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
www.xxxtest.icu Custom forwarding rule Virtual endpoint group Server 1 HTTP 80 182.XX.XX.248
xxxtest.icu Default forwarding rule Default endpoint group Server 2 HTTP 80 182.XX.XX.196

Procedure

Procedure for accelerating multiple domain names

Step 1: Purchase a GA service bundle

You can enter the information about the web service in the GA console. After you enter the information, the system generates a list of recommended services. The list includes a GA instance and a basic bandwidth plan.

  1. Log on to the Global Accelerator console.
  2. In the upper-right corner of the Instances page, click Purchase Guide.
    Note If this is the first time that you use the GA service, skip this step.
    Purchase Guide
  3. In the Enter the required information to generate a list of recommended services section, enter the required information and click Generate Service List.
    Parameter Description
    Acceleration Area Select the region that requires acceleration.

    In this example, China (Hangzhou) is selected.

    Service Region Select the region where the backend servers are deployed.

    In the example, China (Beijing) is selected.

    ICP Filing Specify whether you have applied for an ICP number for the domain name of the web service.

    In this example, Yes is selected.

    Server Area Specify whether the backend service is 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, 2 is entered.

    Maximum Concurrent Connections The maximum number of concurrent connections that a GA instance supports. When the number of existing concurrent connections reaches the upper limit, new connection requests are dropped.

    In this example, 5 Thousand is selected.

  4. In the Recommended Service List section, click Generate Service List after you confirm the information.
    Recommended service list
    Note The instance configurations in Recommended Service List provide the most cost-effective plan to run your services. You can also change the instance configurations on the buy page.
  5. On the buy page, set the following parameters and click Buy Now to complete the payment.
    Parameter Description
    Term Select the subscription duration.
    Specification Select a specification for the GA instance.

    In this example, Small I (Specification Unit) is selected.

    Bandwidth Type Select a bandwidth type for the basic bandwidth plan.

    In this example, Basic is selected.

    Peak Bandwidth Select the bandwidth limit of the basic bandwidth plan.

    In this example, 2 Mbit/s is selected.

Step 2: Add an acceleration area

After you purchase and configure a GA instance, you must add an acceleration area, specify the region where the clients are located, and then allocate bandwidth to the region. Then, you can use the GA instance to accelerate your services.

  1. On the Instances page, find the GA instance that you created and click the instance ID.
  2. On the instance details page, click the Acceleration Areas tab. On the China East tab, click Add Region.
  3. In the Add Acceleration Area dialog box, set the following parameters and click OK:
    Parameter Description
    Region Select the region where the users that require the acceleration service are located.

    In this example, China (Hangzhou) is selected.

    Bandwidth Allocate bandwidth to the region.

    In this example, 2 Mbit/s of bandwidth is allocated.

    Internet Protocol Select the Internet protocol that is used by the users to connect to GA.

    In this example, IPv4 is selected.

    After you add the region, the system assigns an accelerated IP address to the region that is added to the GA instance. This accelerated IP address is used to accelerate data transfer from users in the specified region to the specified backend servers through GA. Accelerated IP address

Step 3: Add a listener and an endpoint group

A listener checks for connection requests and then distributes the requests to backend servers based on the specified protocol and ports. 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, traffic is distributed to the optimal endpoint in the associated endpoint group.

For more information about how to configure default endpoint groups and virtual endpoint groups, see Endpoint groups.

  1. On the instance details page, click the Listeners tab and then click Add Listener.
  2. On the Configure Listener & Protocol wizard page, specify the following listener information and click Next.
    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 the protocol of the listener.

    HTTP is selected in this example.

    Port Number Specify a port for the listener. The port is used to receive and forward requests to endpoints. Valid values: 1 to 65499.

    The value is set to 80 in this example.

    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 Address is selected.

  3. On the Configure Endpoint Group wizard page, set the following parameters for the default endpoint group and click Next.
    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.

    Region Select the region where you want to create the endpoint group. The backend servers that the clients want to access must be deployed in the specified region.

    In the example, China (Beijing) is selected.

    Backend Service Specify whether the backend service is deployed on Alibaba Cloud.

    In this example, Alibaba Cloud is selected.

    Preserve Client IP By default, client IP address preservation is enabled for HTTP listeners. HTTP listeners can retrieve client IP addresses from the x-forwarded-for HTTP header field. For more information, see Preserve client IP addresses.
    Endpoint Endpoints are backend servers that receive and handle client requests. To add an endpoint, specify 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, 182.XX.XX.196 is entered, which is the public IP address of Server 2.
    • Weight: Enter a weight for the endpoint. Valid values: 0 to 255. GA distributes network traffic to endpoints based on their weights.
      Notice If the weight of an endpoint is set to 0, GA stops distributing network traffic to the endpoint. Proceed with caution.
    Backend Service Protocol Select the protocol that the backend server uses. Valid values:
    • HTTP: This is the default value.
    • HTTPS

    In this example, HTTP is selected.

  4. On the Confirm wizard page, confirm the configurations of the listener and endpoint, and then click Submit.
  5. Configure a virtual endpoint group.
    1. On the Listeners tab, find the listener that you want to manage and click the endpoint group ID in the Default Endpoint Group column.
    2. On the Endpoint Group tab, click Add Virtual Endpoint Group.
    3. In the Add Virtual Endpoint Group dialog box, set the following parameters and click Create.
      The configurations of the virtual endpoint group are the same as those of the default endpoint group that you created in Step3 except for the following parameters:

      Backend Service: Enter 182.XX.XX.248, which is the public IP address of Server 1.

Step 4: Add a forwarding rule

You can configure forwarding rules for HTTP listeners. After you create an HTTP listener, the system automatically creates a default forwarding rule that is used to forward requests to the default endpoint group. You can create a custom forwarding rule to forward requests to a virtual endpoint group.

GA forwards network traffic against forwarding rules based on domain names or paths. An HTTP listener forwards requests that meet the match conditions in forwarding rules to the optimal endpoints in the associated endpoint groups. When an HTTP listener receives requests, the HTTP listener preferably forwards requests based on custom forwarding rules. 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.

To create a custom forwarding rule for the virtual endpoint group that is associated with Server 1, perform the following steps:

  1. On the listener details page, click Forwarding Rule.
  2. On the Forwarding Rule tab, click Add Forwarding Rule.
  3. In the Add Forwarding Rule section, set the following parameters to configure the forwarding rule:
    • Policy Name: Enter a name for the forwarding rule.

      The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

    • If (Matching All Conditions): Select a match condition for the forwarding rule. Domain Name is selected in this example. After you select this option, enter the domain name to which you want to forward requests. www.xxxtest.icu is entered in this example.

      The domain name must be 3 to 128 characters in length and can contain letters, digits, underscores (_), and periods (.).Supported wildcard characters are asterisks (*) and question marks (?).

    • Forward to Virtual Endpoint Group: Select an endpoint group. The virtual endpoint group that you created is selected in this example.
  4. Click OK.
    Forwarding rules

Step 5: Configure DNS settings

To forward requests from clients to GA, you must modify the DNS record to map the domain names that you want to accelerate to the CNAME of the GA instance. The following example shows how to modify the DNS record in the Alibaba Cloud DNS console.
Note 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 web application.
  1. Log on to the Alibaba Cloud DNS console.
  2. On the Manage DNS page, find the domain name that you want to manage, and click Configure in the Actions column.
  3. On the Configure page, find the DNS record that you want to modify, and click Edit in the Actions column.
  4. In the Edit Record dialog box, set Type to CNAME and set Value to the CNAME that is assigned to the GA instance. DNS
  5. Click OK.

Step 6: Verify the connectivity

Use both domain names to verify the connectivity to the web application that is deployed in the China (Beijing) region. In addition, check whether content delivery is accelerated.
Note The Linux operating system is used in this example. The command that is used to verify the connectivity varies based on the operating system that you use. For more information, see the user guide of your operating system.
  1. Open the CLI on an on-premises machine. In this example, the machine is located in the China (Hangzhou) region.
  2. Use www.xxxtest.icu to access the web application and check whether content delivery is accelerated.
    1. To verify the connectivity to the web application, run the following command:
      curl http://<The domain name of the web application>
      Figure 1. Verification result
      Verify the connectivity to Server 1
    2. To verify data transmission, run the following command:
      curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "http://<The domain name of the web application>
      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.
      Figure 2. Data transmission before GA is used
      Before GA is used for Server 2
      Figure 3. Data transmission after GA is used
      After GA is used for Server 2
      Note The result varies based on the actual workloads.
  3. Use xxxtest.icu to access the web application and check whether content delivery is accelerated.
    1. To verify the connectivity to the web application, run the following command:
      curl http://<The domain name of the web application>
      Figure 4. Verification result
      Verify the connectivity to Server 2
    2. To verify data transmission, run the following command:
      curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "http://<The domain name of the web application>
      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.
      Figure 5. Data transmission before GA is used
      After GA is used for Server 2
      Figure 6. Data transmission after GA is used
      After GA is used for Server 2
      Note The result varies based on the actual workloads.