All Products
Search
Document Center

CDN:Configure cache sharing

Last Updated:Apr 23, 2024

After you configure cache sharing, accelerated domain names in the same Alibaba Cloud account can share resources that are cached on Alibaba Cloud CDN points of presence (POPs). If origin servers of different domain names store a large number of common resources, such as images, CSS files, and JavaScript files, you can configure cache sharing. This way, the domain names can share the common resources to reduce the bandwidth usage and increase the resource hit ratio for the domain names. This improves the acceleration performance of Alibaba Cloud CDN and reduces origin traffic.

How it works

Alibaba Cloud CDN works differently based on whether you configure cache sharing for domain names, such as a.example.com and b.example.com.

The domain names use the same Bootstrap framework and reference the same images, CSS files, and JavaScript files.

Cache sharing not configured

image

Cache sharing configured

image

Same origin URL

  • If a.example.com and b.example.com are hosted on the same origin origin.example.com, requests for the two domain names are retrieved from the same origin server regardless of whether you configure cache sharing.

  • If you do not configure cache sharing, resources are independently cached for each domain name, even if the origin URL of the domain names is the same. In this case, duplicate resources may be cached.

  • If you configure cache sharing, the domain names can share the cache because the origin URL of the domain names is the same. This accelerates content delivery.

Different origin URLs

  • If the origin domain of a.example.com is origin-a.example.com and the origin domain of b.example.com is origin-b.example.com, resources cannot be shared even if you configure cache sharing because the resources are from different origin servers.

  • However, cache sharing still takes effect. If specific resources, such as images, CSS files, JavaScript files, are used for a.example.com and b.example.com, these files can be shared to reduce bandwidth consumption.

Usage notes

  • You can configure cache sharing for only domain names in the same Alibaba Cloud account.

  • If you remove an accelerated domain name for which cache sharing is configured, the hit ratios of other accelerated domain names that share the cache with the domain name are affected. After you configure cache sharing for a domain name, disable or remove domain names that share the cache with caution. For example, if you configure cache sharing for Domain Name A to share the cache with Domain Name B, the system does not allow you to remove Domain Name B. You need to delete the cache sharing configurations of Domain Name A or configure Domain Name A to share the cache with another domain name before you remove Domain Name B.

  • If you transfer an accelerated domain name for which cache sharing is configured, the shared cache of the domain name is not affected.

  • After you configure cache sharing for an accelerated domain name, the accelerated domain name is replaced with the domain name that shares the cache only when you query or generate a cache key. The origin URL and origin host of the accelerated domain name remain the same.

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.

  4. In the left-side navigation tree of the domain name, click Cache.

  5. Click the Cache Sharing tab.

  6. Click Configure.

  7. In the Cache Sharing dialog box, select a domain name and click OK.