ASCI Logo
ASCI
Programs
Practice DSA
Degrees & Careers
Pricing
Log inGet Started

Quick Navigation & Search

Search curriculum tracks, DSA problems, systems theory and tools...

system design-distributed

Curriculum Index

Current LevelInitiate
0/ 500 XP
Gravit Certificate:
100% Required
  • 1.1 Consistent Hashing with Virtual Nodes
•
1
2
3
4
5
6
7
8
9
10
Module 1: Consistent Hashing & Ring Partitions•Lesson 1

1.1 Consistent Hashing with Virtual Nodes

### Consistent Hashing Ring
In naive mod hashing (hash(key) % N), adding 1 node forces nearly 100% of keys to move, triggering cache stampedes. Consistent hashing assigns nodes and keys to positions on a circle, moving only $\frac{1}{N}$ of keys when nodes join or leave.
Python 3.11
•
Interactive Challenge
+95 XP
Challenge Objective

Calculate keys remapped in consistent hashing and output 'KEYS_MOVED: 909'.

solution.py
UTF-84 SpacesAuto-saved
cpython3.11:~/workspace
CPython 3.11.8 (WASM)
$python3 -u solution.py
Click "Compile & Run" (or press Ctrl + Enter) to compile AST, verify bytecode, and execute the solution.