Backend Mystery · Card #21
What is a distributed caching strategy for a high-availability application?
In this scenario, you have to consider the following points:
- Implement a **cluster of servers** that will all act as the distributed cache. Implement a **data sharding** process to evenly distribute the data amongst all cache servers and make sure it uses a consistent hashing algorithm to minimize cache reorganization when a server joins or leaves the cluster.
- Add **cache replication** to have redundancy of your data in case of a failure, that way, your distributed cache is fault-tolerant as well.
- **Cache invalidation** is a must on any caching solution, as your data will become stale if you don’t update it often.
caching system-design