If a request redirected from an edge node to the origin server carries the Range header, the origin server returns the content specified by the Range header to the edge node. This process is called object chunking. Object chunking accelerates content delivery by increasing cache hit ratios, reducing back-to-origin traffic and loads on origin servers, and reducing the server response time.

Background information

Range is an HTTP header that specifies the part of content to be retrieved. For example, Range: bytes=0-100 specifies that the origin server is required to return the first 101 bytes in the requested file.

After object chunking is enabled, requests for resources that have expired or are not cached on edge nodes are redirected to the origin server with the Range header retained. Then, Alibaba Cloud CDN retrieves the specified chunk of file from the origin server and caches the file chunk on edge nodes.

The following figure shows how object chunking works.Object chunking

Precautions

Take note of the following rules when you enable object chunking:
  • Make sure that the origin server supports HTTP range requests, and the origin server can respond to requests with the 206 HTTP status code (partial content message). If the origin server does not support HTTP range requests, resources cannot be cached on edge nodes after object chunking is enabled.
  • Object chunking is optional. It is disabled by default.

Procedure

  1. Log on to the Alibaba Cloud CDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column of the domain name.
  4. In the management pane of the domain name, click Video.
  5. In the Object Chunking section, click Modify.
  6. Set Object Chunking to On or Force.
    Object chunking
    Value Description Example
    Off The default value is Off. Edge nodes retrieve the entire file from the origin server regardless of whether the request carries the Range header. In this case, the file distribution efficiency is lower than expected in large file distribution scenarios. A client sends a request that contains range:0-100 to an edge node. The edge node redirects the request to the origin server without the Range header. The origin server returns the entire file to the edge node. If the total size of the file is 10 MB, the origin server returns 10 MB of file data to the edge node. The edge node caches the received file and returns the chunk specified by range:0-100 to the client.
    On

    If Object Chunking is set to On, edge nodes redirect requests with the Range header retained to the origin server. For the first request for a resource redirected to the origin server, Alibaba Cloud CDN rounds up the value of Range to the nearest integer. For subsequent requests for the resource, Alibaba Cloud CDN sets the value of Range to 512 KB.

    For example, a client requests content of 600 KB. The edge node retrieves 1,024 KB of content from the origin server for the request and returns file chunks of 512 KB to subsequent request.

    A client sends a request that contains range:0-100 to an edge node. The edge node rounds up the Range header value to 512 and redirects the request to the origin server. The origin server returns a file chunk of 512 KB. Then, the edge node caches the chunk and returns a chunk of the size specified by range:0-100 to the client.
    Force If Object Chunking is set to Force, edge nodes redirect requests to the origin server with the Range header retained regardless of whether the client requests carry the Range header. All files returned from the origin server to edge nodes are split into chunks of 512 KB. N/A
  7. Click OK.