Caching is an important aspect of the high performance applications. As the data volume increases, the cached data needs to be distributed across multiple servers. We need to make sure the following objectives are met while doing so.
- Maximize the cache hits: This will reduce the load on primary data source and reduce the overall latency.
- Distribute the data and traffic evenly: This ensures optimal use of servers and avoid overloading a subset of the servers.
As the title of this post suggests, we will look into how consistent hashing can be used to achieve the above objectives. Before that, let’s look at using a straight forward approach for solving the problem.