Help Center/ Global Accelerator/ Getting Started/ Accelerating Access to an Application
Updated on 2024-01-31 GMT+08:00

Accelerating Access to an Application

Global Accelerator helps accelerate access to an application so that your global users can access your applications faster.

Example Scenario

As shown in Figure 1, a multinational enterprise has two branches, one in Singapore and one in Hong Kong. The Singapore branch has deployed an application on two servers in the CN South-Guangzhou region, and the Hong Kong branch has deployed an application on two servers in the CN-Hong Kong region.

Global Accelerator is required for each branch to access the cloud network from the nearest access point.

Figure 1 Network topology

When users in the Singapore branch access the application in the CN South-Guangzhou region, requests are sent to the anycast IP address in Singapore. The listener then distributes the requests evenly between endpoint 1 and endpoint 2.

When users in the Hong Kong branch access the application in the CN-Hong Kong region, requests are sent to the anycast IP address in Hong Kong. The listener then distributes 20% of the requests to endpoint 3 and 80% of the requests to endpoint 4.

Flowchart

Procedure

  1. Apply for a cross-border permit (mandatory for cross-border communications).

    In accordance with the laws and administrative regulations of the Ministry of Industry and Information Technology (MIIT) of the People's Republic of China, only China Mobile, China Telecom, and China Unicom are allowed for cross-border network communications, and a cross-border permit is required if you carry out business activities outside the Chinese mainland.

    If the acceleration area is inside the Chinese mainland but the endpoint group is outside the Chinese mainland, or if the endpoint group is inside the Chinese mainland but the acceleration area is outside the Chinese mainland, you need to apply for a cross-border permit.

    1. Log in to the management console.
    2. Click in the upper left corner and choose Networking > Global Accelerator.

      The Global Accelerator page is displayed.

    3. In the navigation pane on the left, click Cross-Border Permits.
    4. Click Request a Cross-Border Permit.
    5. On the application page, set related parameters and upload related materials.
      Table 1 Online cross-border permit application

      Parameter

      Applicant Name

      Huawei Cloud UID

      Type of Product

      Bandwidth (M)

      Start Date

      Termination Date

      Customer Type

      Country of the Customer

      Contact Name

      Contact Number

      Type of ID

      ID Number

      Scope of Business

      Number of Employees

      Per Capita Bandwidth

      Branch Location Country

      HUAWEI ID is your account ID. You can take the following steps to obtain your account ID.
      1. Log in to the management console.
      2. Click the username and select My Credentials from the drop-down list.
        Figure 2 My credentials
      3. On the API Credentials page, view the Account ID.
        Figure 3 Obtaining an account ID
      Table 2 Required materials

      Material

      Signature

      Seal

      Description

      A scanned copy of your company's business license

      -

      See the template Huawei Cloud provides for the position of the seal.

      A scanned copy of Huawei Cloud Cross-Border Circuit Service Agreement

      • Sign the material on the signature block.
      • Stamp the seal over the signature.

      A scanned copy of China Unicom Letter of Commitment to Information Security of the Cross-Border Circuit Service

      • Sign the material on the signature block.
      • Stamp the seal over the signature.
      • Specify the bandwidth you estimated and your company name.
    6. Click Submit.
    7. Submit a service ticket to request a cross-border permit.

  2. Create a global accelerator.

    To use Global Accelerator for faster access, you first need to create a global accelerator.

    1. Log in to the management console.
    2. On the homepage, click in the upper left corner and choose Networking > Global Accelerator.

      The Global Accelerator page is displayed.

    3. Click Buy Global Accelerator.
    4. Specify the parameters listed in Table 3.
      Figure 4 Creating a global accelerator
      Table 3 Parameters required for creating a global accelerator

      Parameter

      Description

      Name

      Name of the global accelerator you want to create.

      You can enter up to 64 characters. Only letters, digits, and hyphens are allowed.

      Enterprise Project

      An enterprise project you would like to use to centrally manage your Global Accelerator resources.

      You can use an existing enterprise project or create one.

      Applicability

      Where the global accelerator will be used.

      Europe is selected by default.

      Tags

      The identifier of a global accelerator. Each tag consists of a key and a value. You can add 20 tags for a global accelerator.

      Tag keys and values must meet the requirements listed in Table 4.

      NOTE:

      If a predefined tag has been created in TMS, you can select the corresponding tag key and value.

      For details about predefined tags, see Predefined Tag Overview.

      Description

      Supplementary information about the global accelerator.

      You can enter up to 255 characters.

      Table 4 Tag key and value requirements

      Parameter

      Requirements

      Key

      • Cannot be left blank.
      • Can contain letters, digits, spaces, underscores (_), periods (.), colons (:), equal signs (=), plus signs (+), hyphens (-), and at signs (@).
      • Cannot start or end with a space.
      • Cannot start with _sys_.
      • Can contain a maximum of 128 characters.

      Value

      • Can be left blank.
      • Can contain letters, digits, spaces, underscores (_), periods (.), colons (:), slashes (/), equal signs (=), hyphens (-), and at signs (@).
      • Cannot start or end with a space.
      • Can contain a maximum of 255 characters.
    5. Click Next.

      The Add Listener page is displayed.

  3. Add a listener to the global accelerator.

    Associate an endpoint group with the listener in the AP-Singapore region and add endpoint 1 and endpoint 2 to the endpoint group. The listener will listen to requests and routes them to the two endpoints based on the load balancing algorithm.

    For details about the parameters, see Table 5.

    Figure 5 Adding a listener
    Table 5 Parameters required for adding a listener

    Item

    Parameter

    Description

    Basic Configuration

    Name

    Listener name.

    You can enter up to 64 characters. Only letters, digits, and hyphens are allowed.

    Protocol

    The protocol used by the listener to receive requests from clients.

    The protocol can be TCP or UDP.

    Port

    The ports or port ranges used by the listener to receive requests from clients.

    The port number ranges from 1 to 65535. You can enter one or more ports or port ranges separated by commas (,).

    Example: 1-10,11-50,51,52-200

    Client Affinity

    • If you select None, the listener routes requests evenly among the endpoints in the endpoint group.
    • If you select Source IP address, the source IP address of each request is calculated using the consistent hashing algorithm to obtain a unique hash key, and all the endpoints are numbered and mapped to the hash keys. Requests from the same IP address are forwarded to the same endpoint for processing.

    TCP and UDP listeners support only Source IP address.

    Tags

    The identifier of a global accelerator. Each tag consists of a key and a value. You can add 20 tags for a global accelerator.

    Tag keys and values must meet the requirements listed in Table 4.

    NOTE:

    If a predefined tag has been created in TMS, you can select the corresponding tag key and value.

    For details about predefined tags, see Predefined Tag Overview.

    Description

    Supplementary information about the listener.

    You can enter up to 255 characters.

    Endpoint Groups

    Name

    Name of the endpoint group.

    Each listener can be associated with only one endpoint group in a given region.

    You can enter up to 64 characters. Only letters, digits, and hyphens are allowed.

    Region

    Region to which the endpoint group belongs.

    Description

    Supplementary information about the endpoint group.

    You can enter up to 255 characters.

    Traffic Dial

    The percentage of traffic directed to the endpoint group.

    If you increase the traffic dial, more requests will be distributed to this endpoint group.

    If you set the traffic dial to 0, no requests will be distributed to this endpoint group.

    The value ranges from 0 to 100.

    NOTE:

    If a listener has multiple endpoint groups, traffic will be first distributed to the endpoint group with the lowest latency and then to other endpoint groups based on the traffic dial value you set.

    Endpoint

    An endpoint serves as a single point of contact for clients. Global Accelerator distributes incoming traffic across healthy endpoints.

    • Endpoint 1: EIP bound to server 1 (88.xx.xx.10)
    • Endpoint 2: EIP bound to server 2 (10.xx.xx.11)

    Set the weights of the two endpoints both to 1.

    Health Check

    Health Check

    Whether to enable health check.

    If you disable health check, requests may be forwarded to unhealthy endpoints.

    Protocol

    The health check protocol can be TCP.

    Default value: TCP.

    Port

    The port used for health check.

    The port number ranges from 1 to 65535.

    Advanced Settings

    Interval (s)

    The maximum time between two consecutive health checks, in seconds.

    The interval ranges from 1 to 60.

    Timeout (s)

    The maximum time required for waiting for a response to a health check request, in seconds.

    The timeout ranges from 1 to 60.

    Maximum Retries

    The maximum number of health check retries allowed.

    The value ranges from 1 to 10.

    Table 6 Tag key and value requirements

    Parameter

    Requirements

    Key

    • Cannot be left blank.
    • Can contain letters, digits, spaces, underscores (_), periods (.), colons (:), equal signs (=), plus signs (+), hyphens (-), and at signs (@).
    • Cannot start or end with a space.
    • Cannot start with _sys_.
    • Can contain a maximum of 128 characters.

    Value

    • Can be left blank.
    • Can contain letters, digits, spaces, underscores (_), periods (.), colons (:), slashes (/), equal signs (=), hyphens (-), and at signs (@).
    • Cannot start or end with a space.
    • Can contain a maximum of 255 characters.

  4. Associate an endpoint group with the listener.

    Associate an endpoint group with the listener in the CN-Hong Kong region, and add endpoint 3 and endpoint 4 to this endpoint group.

    1. Click Add Endpoint Group and specify the parameters listed in Table 7.
      Table 7 Parameters required for adding an endpoint group

      Item

      Parameter

      Description

      Endpoint Groups

      Name

      Name of the endpoint group.

      Each listener can be associated with only one endpoint group in a given region.

      You can enter up to 64 characters. Only letters, digits, and hyphens are allowed.

      Region

      Region to which the endpoint group belongs.

      Description

      Supplementary information about the endpoint group.

      You can enter up to 255 characters.

      Traffic Dial

      The percentage of traffic directed to the endpoint group.

      If you increase the traffic dial, more requests will be distributed to this endpoint group.

      If you set the traffic dial to 0, no requests will be distributed to this endpoint group.

      The value ranges from 0 to 100.

      NOTE:

      If a listener has multiple endpoint groups, traffic will be first distributed to the endpoint group with the lowest latency and then to other endpoint groups based on the traffic dial value you set.

      Endpoint

      An endpoint serves as a single point of contact for clients, and Global Accelerator distributes incoming traffic across healthy endpoints.

      • Endpoint 3: EIP bound to server 3 (97.xx.xx.159)
      • Endpoint 4: EIP bound to server 4 (10.xx.xx.240)

      Set the weight of endpoint 3 to 1, and the weight of endpoint 4 to 4.

      Health Check

      Health Check

      Whether to enable health check.

      If you disable health check, requests may be forwarded to unhealthy endpoints.

      Protocol

      The health check protocol can be TCP.

      Default value: TCP.

      Port

      The port used for health check.

      The port number ranges from 1 to 65535.

      Advanced Settings

      Interval (s)

      The maximum time between two consecutive health checks, in seconds.

      The interval ranges from 1 to 60.

      Timeout (s)

      The maximum time required for waiting for a response to a health check request, in seconds.

      The timeout ranges from 1 to 60.

      Maximum Retries

      The maximum number of health check retries allowed.

      The value ranges from 1 to 10.

      In this example, users in the Singapore branch have faster access to the application on servers in the CN South-Guangzhou region than to that in the CN-Hong Kong region. Requests are preferentially sent to servers in the CN South-Guangzhou region.

      If the percentage of traffic directed to the endpoint group 1 and endpoint group 2 are set to 80%, requests from users in the Singapore and Hong Kong branches are distributed as follows:

      • 80% of the requests from users in Singapore will be sent to endpoint group 1, and the remaining 20% to the endpoint group 2.
      • 80% of the requests from users in Hong Kong will be sent to the endpoint group 2, and the remaining 20% to the endpoint group 1.
      Figure 6 Cross-border traffic dial
    2. Click Save.
    3. Click Next and confirm the configuration.
    4. Click Submit.
    5. If message "Accelerator xxx created successfully" is displayed, click Finish.

Verifying Global Accelerator

The listener uses TCP to receive requests from clients, so you can run curl to verify that the global accelerator is working normally. Run curl before and after you configure Global Accelerator and compare the values of time_connect.

  1. Before you configure Global Accelerator, run the following command on a server in the tested region:
    curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "http[s]://<IP>[:<Port>]"
    • IP: EIP bound to the application server.
    • Port: HTTP port number used by the application server.
    • time_connect: time taken to establish a TCP connection, in seconds. It is from the time when a TCP connection request is initiated to the time when the connection is established.
    • time_starttransfer: time when transfer starts, in seconds. It is from the time when the client sends a request to the time when the endpoint replies with the first byte.
    • time_total: total connection time, in seconds. It is from the time when the client sends a request to the time when the endpoint responds to the request.
  2. After you configure Global Accelerator, run the following command:
    curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" "http[s]://<IP>[:<Port>]"

    Set IP in the command to the anycast IP address provided by Global Accelerator in the region.

  3. Compare the values of time_connect and view the latency before and after acceleration.