All Products
Search
Document Center

Dynamic Content Delivery Network:Configure a timeout period for back-to-origin requests

Last Updated:Dec 19, 2023

You can configure a timeout period for back-to-origin HTTP requests to efficiently manage the connections between points of presence (POPs) and your origin server. If the timeout period for back-to-origin requests is too short, back-to-origin requests may frequently fail due to unstable network connections. If the timeout period for back-to-origin requests is too long, the failed requests still occupy connections for a long time when the maximum number of requests that your origin server can process is reached. As a result, normal requests cannot be responded to. We recommend that you configure the timeout period based on your network connectivity and the maximum number of requests that your origin server can process to ensure that requests can be redirected to the origin server as expected.

Background information

The time that is consumed by a back-to-origin HTTP request refers to the time that is required to initiate a Layer 7 HTTP request. The time that is consumed by a back-to-origin HTTP request does not include the time that is required to establish a Layer 4 TCP connection. Back-to-origin request timeout

Usage notes

The maximum timeout period that you can configure for DCDN cannot exceed 36 seconds. The period includes the time consumed by links between DCDN points of presence (POPs) and links between DCDN POPs and origin servers.

Back-to-origin retry, back-to-origin timeout, and origin probing

  • Retry order:

    • The retry is performed based on the priority of origin addresses in descending order. You can view the origin addresses in the Alibaba Cloud CDN console.

    • If two addresses have the same priority, the retry order is based on the weight ratio.

  • Retry granularity:

    • Retries are performed for each IP address. If a domain name is specified as an origin address, Alibaba Cloud CDN retries all IP addresses resolved from the domain name and accesses other available origin servers only if all the IP addresses that belong to the domain name are unavailable.

    • Probes automatically skip origin servers that are in the dead table.

  • Retry status code:

    • A DCDN POP sends a retry request when it receives an HTTP 5xx status code from the origin server.

  • Back-to-origin timeout: The DCDN POP sends a retry request after it receives a retry status code from the origin server. If no retry status code is received from the origin server, the timeout processing logic is followed. After the timeout period is reached, the DCDN POP is triggered to retry.

    • By default, the timeout period that is required to establish a TCP connection between POPs and an origin server is 10 seconds. To adjust the timeout period, submit a ticket

    • The origin write timeout is the amount of time allocated for data write after the TCP connection is established. By default, the origin write timeout is 30 seconds.

    • The origin read timeout is the amount of time that is required by the origin server to return all content requested by a DCDN POP after the TCP connection is established. By default, the origin read timeout is 30 seconds.

    • You can adjust the values of the origin read timeout and origin write timeout by configuring a timeout period for back-to-origin HTTP requests.

  • Origin probing:

    • Abnormal TCP connection: If the TCP connection between a DCDN POP and an origin server fails or times out two times in a row, DCDN removes the IP address of the origin server from the list of available origin IP addresses and adds the IP address to the dead table. In this case, subsequent back-to-origin requests are no longer sent to the IP address. Then the DCDN POP connects to the origin server over TCP to probe the IP address every 5 minutes. If the TCP connection is established, Alibaba Cloud CDN restores the IP address to the list of available origin IP addresses.

    • Normal TCP connection: If the TCP connection between a DCDN POP and an origin server is normal, but the POP receives a retry status code such as the 5xx status code from the origin server, the IP address of the origin server is not removed from the list of available origin IP addresses. In this case, a retry is triggered and subsequent requests are still sent to the origin server based on the weight ratio. If HTTP request errors occur at Layer 7 when the TCP connection is normal, the IP address of the origin server is not automatically removed from the list of available origin IP addresses. If you want Alibaba Cloud CDN to automatically remove the IP address from the list of available origin IP addresses, submit a ticket

Procedure

  1. Log on to the DCDN console.

  2. In the left-side navigation pane, click Domain Names.

  3. On the Domain Names page, find the domain name whose acceleration region you want to change and click Configure.
  4. In the left-side navigation tree of the domain name, click Origin Fetch.

  5. On the Origin Fetch tab, find Origin Request Timeout and click Modify.

  6. In the Origin Request Timeout dialog box, configure Timeout Value.

    Origin Request Timeout

  7. Click OK.

Related API

BatchSetDcdnDomainConfigs