Skip to main content
Cache Sharding allows CDN servers grouped within the same Point of Presence (PoP) to share each other’s cache, improving CDN performance. When a user requests content, a CDN server that does not hold the file locally proxies the request to the group member where the cache is located, using a consistent hashing algorithm. Cache Sharding is particularly useful for websites and applications with a large amount of content in the CDN cache and for those where multiple files receive similar request volumes — e-commerce sites, video game content delivery, and VoD streaming platforms benefit most.

Cache distribution mechanism

Without Cache Sharding, a CDN server only checks its own cache for a file request. This is inefficient when there are many servers in one PoP: if a server without the file gets a request, it retrieves the file from the origin instead of a neighboring server. When Cache Sharding is enabled for a CDN resource, CDN servers within one PoP (or data center) are clustered to use each other’s cache with the consistent hashing algorithm. Consistent hashing stores data in a hash table using a hash function. Each item’s key is hashed to an address in a “hash ring” — a circular space divided into sectors. The sector an address falls in determines which server holds that data. This lets any server in the group calculate which peer holds a given file without a central registry or broadcasting a lookup request. Example: Assume three CDN servers, A, B, and C, form one group. The consistent hashing algorithm maps file X to server B — meaning B is always the designated server for X within this group. When a user requests X, the request may reach any of the group’s servers. If the request hits B and B has X cached, B serves it immediately. If the request hits A or C, each calculates the hash for X, determines that B is responsible, and proxies the request to B. B then either serves X from its cache or fetches it from the origin, caches it, and serves the user. If a server fails, it is removed from the group and the hash is recalculated. All subsequent requests are distributed among the remaining servers, with new designated servers assigned for each file.
Servers without shared cache each pull from origin; servers with Cache Sharding proxy to the server holding the cached file

Performance improvements

Cache Sharding optimizes content storage and distribution:
  • More efficient cache use. Only one copy of a file is needed for all the data center’s servers. Each CDN server is used efficiently rather than storing duplicate content.
  • Origin protection from redundant requests. CDN servers use the hash key to determine whether the file exists in the group’s cache. The origin is only requested if no group member has the content cached. This reduces traffic costs and lowers the load on the origin server.
  • Improved content delivery speed. Retrieving a file from a neighboring server in the group is faster than routing a request to the origin, which improves Time to First Byte (TTFB).

Enable Cache Sharding

Cache Sharding is enabled automatically on new CDN resources. For existing CDN resources created before the feature was deployed, contact Gcore support to enable it.
Cache Sharding is not used for Streaming CDN resources.