The object chunking feature enables an origin server to return data specified by the Range request header after the origin server receives a request from an edge node. In large file distribution scenarios such as on-demand video streaming and software package distribution, object chunking accelerates file distribution, reduces back-to-origin network traffic and loads on origin servers, and reduces the response time of origin servers.
The Range header can define the amount of data to be returned by specifying the positions of the first and last byte. For example,
Range: bytes=0-100 specifies that the origin server returns the first 101 bytes in the requested file.
After object chunking is enabled, requests for resources that are not cached or have expired on edge nodes are redirected to the origin server with the Range header. Then, Alibaba Cloud CDN retrieves the specified chunk of file from the origin server and caches the file chunk on edge nodes.
- 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 and disabled by default.
- Log on to the Alibaba Cloud CDN console.
- In the left-side navigation pane, click Domain Names.
- 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.
- In the management pane of the domain name, click Video.
- In the Object Chunking section, click Modify.
- Set Object Chunking to On or Force.
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-100to an edge node. The edge 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. After the edge node receives the file, the edge node caches the file and returns the chunk specified by
range:0-100to the client.
After Object Chunking is set to On, edge nodes redirect requests with the Range header to the origin server.
The first time an edge node redirects an HTTP range request to the origin server, the value of the Range header is rounded up to the nearest integer multiple of 512. For example, if a client requests 600 KB of data, the value of the Range header in the back-to-origin request is rounded up to 1024. Then, the file returned by the origin serve is split into two chunks. Each chunk is 512 KB in size.
A client sends a request that contains
range:0-100to an edge node. The edge node redirects the request to the origin server with the Range value rounded up to 512. The origin server returns a file chunk of 512 KB. Then, the edge node caches the chunk and returns a smaller chunk specified by
range:0-100to the client.
Force After Object Chunking is set to Force, edge nodes redirect requests to the origin server with the Range header 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
- Click OK.