Consistent hashing

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/14

flashcard set

Earn XP

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

15 Terms

1
New cards

What is consistent hashing?

A technique to distribute data across nodes so that minimal remapping is needed when nodes are added or removed.

2
New cards

Why is consistent hashing used?

To improve scalability and fault tolerance in distributed systems.

3
New cards

How does consistent hashing work?

It maps both data and nodes to a circular hash space and assigns data to the nearest clockwise node.

4
New cards

What is the main advantage of consistent hashing?

Only a small portion of data needs to be redistributed when the system changes.

5
New cards

What is a hash ring?

A circular space where both keys and nodes are placed based on their hash values.

6
New cards

What happens when a new node is added in consistent hashing?

Only a fraction of the keys are reassigned to the new node.

7
New cards

What happens when a node is removed in consistent hashing?

Its keys are transferred to its next clockwise neighbor on the hash ring.

8
New cards

What is a virtual node in consistent hashing?

A logical subdivision of a physical node to improve data distribution and load balancing.

9
New cards

Why are virtual nodes used?

To evenly distribute keys and reduce load imbalance between physical nodes.

10
New cards

What is a drawback of basic consistent hashing?

Uneven distribution if there are few nodes and no virtual nodes.

11
New cards

What types of systems commonly use consistent hashing?

Distributed caches (e.g., Memcached), databases, and load balancers.

12
New cards

What is the time complexity for key lookup in consistent hashing?

Typically O(1) with appropriate data structures like sorted maps.

13
New cards

How is a key assigned to a node in consistent hashing?

By hashing the key and finding the nearest node in the clockwise direction on the ring.

14
New cards

What is a good hash function for consistent hashing?

A uniform, deterministic function like MD5 or SHA-1.

15
New cards

What is the primary goal of consistent hashing in distributed systems?

To maintain data availability and performance during system changes.