Skip to content
Learn Netverks
Company prep Snap
Senior (5–8 years) System design Hard

How does consistent hashing work and why is it used in distributed caches?

Reported in Snap USA engineering loops. Frequently asked in US system design rounds for CDN, cache, and sharding topics.

Role
Senior SDE
Location
Seattle, WA

Often asked in Snap on-site or virtual loops at US offices (Bay Area, Seattle, NYC, Austin, and remote US). Prepare a clear spoken answer plus key trade-offs.

Try answering aloud first

Cover trade-offs, structure, and a concrete example before revealing the baseline response.

Spoiler-free prep mode

How to frame this at Snap: Connect your answer to measurable impact, clarity of thought, and trade-offs the team cares about. Below is a strong baseline response you can adapt with your own project examples.

Problem: naive hash mod N remaps almost all keys when nodes are added/removed, causing cache stampedes.

Consistent hashing maps nodes and keys onto a ring (0..2^32-1). Key goes to the first node clockwise. Adding a node only moves keys in its adjacent arc—minimal disruption.

Virtual nodes: each physical node owns many points on the ring for even load distribution. Used in Dynamo, Cassandra, Memcached clients, and CDNs.

Discuss replication (successor nodes), hotspot mitigation, and monitoring skew. Time complexity O(log N) with balanced trees for ring lookup.

Comments (0)

Share how this question came up in your loop, or add tips for others preparing.

Log in to comment on this question.