Cache sharing allows multiple CDN-accelerated domain names under the same Alibaba Cloud account to share cached resources on CDN points of presence (POPs). If different accelerated domain names serve many identical public resources, such as images, CSS files, and JavaScript files, from their origin servers, you can enable cache sharing. This feature allows sub-sites to share these common resources, which reduces bandwidth usage, improves the resource hit rate for accelerated domain names, enhances CDN acceleration performance, and lowers back-to-origin traffic.
How it works
By default, Alibaba Cloud CDN identifies each cached resource using a cache key composed of the accelerated domain name plus the URL path. This means a.example.com/image.png and b.example.com/image.png are treated as two separate cache entries, even if both files are identical — and both trigger an origin fetch.
When you configure cache sharing, one domain (the sharing domain) designates another domain (the source domain) as its cache reference. At cache key generation time, the CDN replaces the source domain with the sharing domain. This maps identical URL paths on both domains to the same cache entry.
Only the cache key is affected. The origin URL and origin host of each domain remain unchanged.
Without cache sharing
User 1 requests
a.example.com/image.png. The CDN fetches the file from origin and caches it undera.example.com.User 2 requests
b.example.com/image.png. Even though the file is already cached fora.example.com, the CDN treats this as a separate cache entry and fetches the file from origin again.
Each domain independently caches the same resource, doubling origin load.
With cache sharing configured
User 1 requests
a.example.com/image.png. The CDN fetches the file from origin and caches it.User 2 requests
b.example.com/image.png. The CDN recognizes the same cache entry (becauseb.example.commaps toa.example.com's cache key) and returns the cached file — no origin fetch.
After the first request, all subsequent requests for that resource are served from cache, regardless of which domain name is used.
Same vs. different origin domains
| Scenario | How cache sharing works |
|---|---|
Both domain names point to the same origin (for example, origin.example.com) | Requests already route to the same origin. Cache sharing consolidates cache entries across domain names. |
Domain names point to different origins (for example, origin-a.example.com and origin-b.example.com) | Cache sharing still works. Because the cache key substitutes the domain name, identical URL paths map to the same cache entry regardless of origin. |
Usage notes
Same-account requirement: Cache sharing only works between accelerated domain names within the same Alibaba Cloud account.
Removing a shared domain name: If you remove a domain name that other domains are sharing cache with, those domains' cache hit ratios drop because the shared cache entries become unavailable. Before removing a domain name that acts as the cache source, either delete the cache sharing configuration on the dependent domains or reconfigure them to share with a different domain name. For example, if
a.example.comshares cache withb.example.com, the system blocks removal ofb.example.comuntil you update or remove the cache sharing configuration ona.example.com.Transferring a domain name: Transferring an accelerated domain name that has cache sharing configured does not affect the shared cache.
Origin is unchanged: Cache sharing only modifies how the cache key is generated. The origin URL and origin host for each domain name remain exactly as configured.
Procedure
Log on to the ApsaraVideo VOD console.
In the left-side navigation pane, choose Configuration Management > CDN Configuration > Domain Names.
In the navigation pane on the left for your target domain name, click Cache.
On the Cache Sharing tab, click Modify.
In the Cache Sharing dialog box, select the target domain name, and then click OK to save the configuration.