All Products
Search
Document Center

Global Accelerator:Accelerate content retrieval from origin servers using GA and CDN

Last Updated:Dec 25, 2025

Industries such as e-commerce, online gaming, and on-demand audio and video streaming require high access speed and quality. To improve the experience of end users, you can use Global Accelerator (GA) together with Content Delivery Network (CDN). Global Accelerator (GA) leverages Alibaba Cloud's premium Border Gateway Protocol (BGP) bandwidth and global transmission network. In conjunction with CDN, it helps you build a global CDN back-to-origin network and ensures comprehensive acceleration of dynamic content.

Scenarios

A web service is deployed on Alibaba Cloud in the US (Silicon Valley) region. The domain name of the service is www.<YOURDOMAIN>.fun. The forwarding port is HTTP port 80. Most clients are located in China (Hong Kong). When clients in China (Hong Kong) access the web service in US (Silicon Valley), issues such as high network latency, network jitter, and packet loss frequently occur due to unstable cross-border Internet connections.

You can deploy CDN for your web service. CDN improves the user experience by caching content on edge nodes. You can also connect CDN to Global Accelerator (GA). GA leverages Alibaba Cloud's premium BGP bandwidth and global transmission network to accelerate back-to-origin delivery for CDN, ensuring high-speed delivery of dynamic content worldwide.

image

Prerequisites

  • Applications are deployed on the origin server.

    In this example, the Alibaba Cloud Linux 3 operating system is used. NGINX and Netcat are used to build a web page that includes dynamic time display and static images to simulate the server.

    Example: Deploy a test service on ECS

    1. Run the vi ECS_server_install.sh command and press the i key to enter edit mode.

    2. Copy and paste the following script content:

      #!/bin/bash
      
      # Update the system and install NGINX and Netcat.
      sudo yum update -y
      sudo yum install nginx -y
      sudo yum install -y nc
      
      # Start NGINX and configure NGINX to start automatically.
      sudo systemctl start nginx
      sudo systemctl enable nginx
      
      # Configure NGINX.
      sudo bash -c 'cat > /etc/nginx/nginx.conf <<EOF
      user nginx;
      worker_processes auto;
      error_log /var/log/nginx/error.log;
      pid /run/nginx.pid;
      
      events {
          worker_connections 1024;
      }
      
      http {
          include /etc/nginx/mime.types;
          default_type application/octet-stream;
          log_format main '\$remote_addr - \$remote_user [\$time_local] "\$request" '
                            '\$status \$body_bytes_sent "\$http_referer" '
                            '"\$http_user_agent" "\$http_x_forwarded_for"';
          access_log /var/log/nginx/access.log main;
          sendfile on;
          keepalive_timeout 65;
          include /etc/nginx/conf.d/*.conf;
      
          server {
              listen       80;
              listen       [::]:80;
              server_name  _;
              root         /usr/share/nginx/html;
      
              location / {
                  try_files \$uri \$uri/ =404;
              }
      
              location /dynamic {
                  proxy_pass http://127.0.0.1:8080;
                  proxy_set_header Host \$host;
                  proxy_set_header X-Real-IP \$remote_addr;
                  proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
                  proxy_set_header X-Forwarded-Proto \$scheme;
              }
      
              error_page 404 /404.html;
                  location = /40x.html {
              }
      
              error_page 500 502 503 504 /50x.html;
                  location = /50x.html {
              }
          }
      }
      EOF'
      
      # Create static content.
      sudo bash -c 'echo "<img src=\"test.png\" alt=\"Static Image\" width=\"300\"/>" > /usr/share/nginx/html/test.png'
      
      # Create a dynamic content script.
      sudo bash -c 'cat > /usr/share/nginx/html/dynamic_script.sh <<EOF
      #!/bin/bash
      while true; do
          echo -e "HTTP/1.1 200 OK\r\nContent-Length: \$(date | wc -c)\r\n\r\n\$(date)" | /usr/bin/nc -l -p 8080
      done
      EOF'
      
      # Grant execution permissions to the dynamic script and run the script in the background.
      sudo chmod +x /usr/share/nginx/html/dynamic_script.sh
      nohup /usr/share/nginx/html/dynamic_script.sh > /dev/null 2>&1 &
      
      # Restart the NGINX service.
      sudo systemctl restart nginx
      
      # Create the index.html file.
      sudo bash -c 'cat > /usr/share/nginx/html/index.html <<EOF
      <!DOCTYPE html>
      <html>
      <head>
          <title>Test Page</title>
      </head>
      <body>
          <h1>GA and CDN Test Page</h1>
          <h2>Static Content: Image</h2>
          <img src="test.png" alt="Static Image" width="300"/>
      
          <h2>Dynamic Content: Current Time</h2>
          <div id="dynamic-time">Loading current time...</div>
      
          <script>
              function fetchTime() {
                  fetch("/dynamic")
                  .then(response => response.text())
                  .then(data => {
                      document.getElementById("dynamic-time").innerText = data;
                  })
                  .catch(error => {
                      document.getElementById("dynamic-time").innerText = "Failed to load current time.";
                  });
              }
      
              setInterval(fetchTime, 1000);
              fetchTime();
          </script>
      </body>
      </html>
      EOF'
    3. Press the Esc key to exit edit mode, and then enter :wq to save the file and exit.

    4. Execute the sudo sh ECS_server_install.sh command to run the script.

    5. Upload the test.png image file to the /usr/share/nginx/html directory specified by the sample script.

  • You have added an A record to point the service domain name www.<YOURDOMAIN>.fun to the public IP address of the origin server.

    This topic uses Alibaba Cloud DNS as an example to describe how to configure DNS records. For more information about how to configure DNS records, see Add DNS records. If you use a third-party DNS service, refer to the user guide provided by the service provider.

  • You have activated the CDN service.

Procedure

Step 1: Configure a GA instance

In this example, a pay-as-you-go standard GA instance is used.

  1. On the Standard Instance > Instances page of the GA console, click Create Standard Pay-as-you-go Instance.

  2. In the Basic Instance Configuration step, configure the basic information and click Next.

    GA基础配置.png

  3. In the Configure Acceleration Area step, add an acceleration region, allocate bandwidth to the region, and then click Next.

    In this example, the Acceleration Region parameter is set to China (Hong Kong), and the ISP Line Type parameter is set to BGP (Multi-ISP). You can use the default values for other parameters or modify the parameters based on your business requirements. For more information, see Add and manage acceleration areas.

    Important
    • If the acceleration regions include regions in the Chinese mainland, you must apply for an ICP number for the domain name to provide services.

    • 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.

    GA加速区域.png

  4. In the Configure listeners step, configure the forwarding protocol and the port, and then click Next.

    In this scenario, set the Protocol parameter to HTTP and the Port parameter to 80. You can use the default values for other parameters, such as the Other listener parameter configurations, or modify them as needed.

    HTTP监听.png

  5. On the Configure endpoint group page, configure the backend services for the endpoints, and click Next.

    In this scenario, set Region to US (Silicon Valley), Backend Service Type to ECS, and Backend Service to the target ECS instance. Then, read and select Compliance Commitments Regarding Cross-border Data Transfers. For other endpoint group parameters, keep the default values or modify them as needed.

    EPG.png

    GA 跨境合规 INTL.png

  6. In the Configuration Review step, confirm the configurations for Global Accelerator and click Submit.

  7. On the Instances page, find the created GA instance and obtain the CNAME assigned to the GA instance in the CNAME column.

Step 2: Configure CDN

  1. On the Domain Names page of the CDN console, click Add Domain Name.

  2. On the Domain Name Information configuration wizard page, configure Business Information and Origin Servers.

    1. Configure Business Information.

      In this scenario, in the Business Information section, set Region to Global (Excluding the Chinese Mainland) and Domain Name to Accelerate to your business domain name, such as www.<YOURDOMAIN>.fun. You can use the default values for the other parameters or modify them as needed. For more information about domain name configuration, see Add an accelerated domain name.

      CDN 添加域名 INTL.png

    2. Configure Origin Servers.

      In the Origin Servers section, click Add Origin Server. In the Add Origin Server dialog box, select the type of the origin server, enter the address, and then click OK.

      In this example, for Origin Info, select the Site Domain type and enter the CNAME of GA. Set Weight to 100. You can keep the default values for other parameters or modify them as needed. For more information about how to configure origin information, see Add an accelerated domain name.

      CDN 配置源站.png

    3. Select Compliance Warranty Regarding Cross-border Data Transfers and click Next.

  3. On the Recommended Configurations page, you can configure features for the domain name, such as cache expiration time, bandwidth cap, and page optimization, and then click Configure, or directly click Skip.

    In this scenario, in the Cache Expiration Time section, find the default cache rule, click Modify in the Actions column, and set Object to /dynamic and Expire In to 0 seconds to fetch dynamic content from the origin. For more information about the recommended configurations, see Recommended Configurations (Optional).

    CDN PHP不缓存.png

  4. On the Domain Names page, find the added domain name and obtain the CNAME assigned by CDN in the CNAME column.

Step 3: Configure DNS records

After the domain name is added, you must create a DNS record of the domain name to the CNAME assigned by CDN. Then, requests that are sent to the domain name can be forwarded to CDN for acceleration.

To avoid conflicts between the existing A record and the CNAME record, you can set different DNS request sources or resolution lines for the records. In this example, you can add a CNAME record for the China (Hong Kong) region to perform a test. If the test is successful, you can gradually apply the CNAME record to other regions or switch to the default line.

  1. On the Public Zone page, find the domain name that you want to use and click Settings in the Actions column.

    Note

    For a domain name that is not registered with Alibaba Cloud, you must add the domain name to the Alibaba Cloud DNS console before you can configure DNS records.

  2. On the DNS Settings page, click Add Record, configure a CNAME record, and then click OK.

    In this scenario, Record Type is set to CNAME, Host Record is set to www, Query Source is set to China (Hong Kong), and Record Value is set to the CDN CNAME. For other DNS record parameters, you can use the default values or modify them as needed.

    配置CNAME.png

Step 4: Test access

On a computer in the acceleration region (in this topic, China (Hong Kong)), use the developer tools in your browser to access www.<YOURDOMAIN>.fun and view the loading time of each resource on the current webpage.

  1. Check the network latency after GA and CDN are configured.

    CDN+GA回源加速效果.png

  2. Check the network latency when only CDN is configured.

    You can change the origin site of CDN from the CNAME of GA to the public IP address of the origin server, delete the endpoint group from GA, and then perform a test.

    CDN加速.png

  3. Check the network latency when GA and CDN are not configured.

    You can disable the accelerated domain name in CDN, disable the CNAME record in DNS, and then perform a test.

    未使用CDN+GA.png

  4. Compare the results:

    The test data shows that after CDN is used, the access latency of static content (test.png) is reduced. After GA is configured with CDN, the access latency of dynamic content (dynamic) is further reduced.

    Scenario

    Static content test.png

    Time consumed (ms)

    Dynamic content dynamic

    Time consumed (ms)

    Comparison

    Scenario 1: Use GA and CDN

    5

    228

    Compared with Scenario 2, the access speed of dynamic content is 50.5% faster.

    Scenario 2: Use CDN only

    5

    461

    Compared with Scenario 3, the access speed of static content is 98.1% faster.

    Scenario 3: GA and CDN are not used

    261

    474

    /

Note

The acceleration performance varies based on your actual business tests.

References

  • Pay-as-you-go GA fees include GA instance fees, capacity unit (CU) fees, and data transfer fees. For more information, see Billing of pay-as-you-go GA instances.

  • When you use GA and CDN to accelerate origin fetches, CDN traffic (or bandwidth) fees are incurred. For more information, see CDN billing overview.