What Is Consistent Hashing? - by NK
A simple solution is to replicate the cache server. Yet only a limited amount of data set can be cached. So cache server must be partitioned to store more data. But partitioning the cache to handle dynamic load is a difficult problem. A naive approach is Static Hash Partitioning. Here’s how it works: Hash the data key Do a modulo operation of the generated hash code against the number of cache servers. This finds you the cache server ID Store data key in the cache server But existing mapping between data keys and cache servers will break if a cache server fails. Also installing an extra cache server to handle more load will break the mapping. A workaround is to rehash the data keys. But it’s an expensive operation. So static hash partitioning won’t handle a dynamic load without service degradation. A simple solution to this problem is consistent hashing. Want to become a better software engineer? Each week, Milan sends one piece of practical advice about .NET and software architecture.
Get my system design playbook for FREE on newsletter signup: Share this post & I'll send you some rewards for the referrals. Imagine you own a website and it became popular. So you install a cache to reduce the load on the origin server. But soon the cache server will hit its limits and result in cache misses. A simple solution is to replicate the cache server. Yet only a limited amount of data set can be cached. So cache server must be partitioned to store more data. Data Replication vs Partitioning But partitioning the cache to handle dynamic load is a difficult problem. A naive…
related reading
- The Simple Magic of Consistent Hashing | Mathias Meyerpaperplanes.de
- Hash-Range Partitioning | ben.kirw.inben.kirw.in
- Making 768 servers look like 1 — PlanetScaleplanetscale.com
- Core Concepts for System Design Interviews | Hello Interview System Design in a Hurryhellointerview.com
- Rohan Iyerrohaniyer.vercel.app
- Scaling Memcachepdos.csail.mit.edu
- Building Venice with Apache Helixlinkedin.com
- A very concrete explanation of how a cache worksparksb.github.io
- The Architecture of Open Source Applications (Volume 2)Scalable Web Architecture and Distributed Systemsaosabook.org
- Chain Replication for Supporting High Throughput and Availabilitycs.cornell.edu
- Wesley Aptekar-Cassels | There is no such thing as a static websiteblog.wesleyac.com
- Database Fundamentalstontinton.com