]> git.ipfire.org Git - thirdparty/ccache.git/commit
feat(storage): Add support for cache sharding on secondary storage (#912)
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 7 Aug 2021 07:00:17 +0000 (09:00 +0200)
committerGitHub <noreply@github.com>
Sat, 7 Aug 2021 07:00:17 +0000 (09:00 +0200)
commit4b8f8249452c8c367a1605e87959f59d5595e766
tree89a0165a0f9a5ee4da5809d14ead6fdc3ff4640a
parent46cb9c5545c05c56122e84479f9304e7ba5219a8
feat(storage): Add support for cache sharding on secondary storage (#912)

This adds support for a shards attribute with a comma-separated list of
names for sharding (partitioning) the cache entries using Rendezvous
hashing, typically to spread the cache over a server cluster. When set,
the storage URL must contain an asterisk (*), which will be replaced by
one of the shard names to form a real URL. A shard name can optionally
have an appended weight within parentheses to indicate how much of the
key space should be associated with that shard. A shard with weight w
will contain w/S of the cache, where S is the sum of all shard weights.
A weight could for instance be set to represent the available memory for
a memory cache on a specific server. The default weight is 1.

For example,

    redis://cache-*.example.com|shards=a(3),b(1),c(1.5)

will put 55% (3/5.5) of the cache on redis://cache-a.example.com, 18%
(1/5.5) on redis://cache-b.example.com and 27% (1.5/5.5) on
redis://cache-c.example.com.
doc/MANUAL.adoc
src/storage/Storage.cpp
src/storage/secondary/SecondaryStorage.cpp
test/suites/secondary_file.bash