Skip to main content
InterviewHubPRO
Section Overview
Q46

Question 46 of 50

Part 3: Architectural Patterns & Enterprise Systems (25 - 35)

92%
Design Patterns (GoF) (50 Qs)•Part 3: Architectural Patterns & Enterprise Systems (25 - 35)

Sharding / Partitioning Pattern: Horizontal data scaling.

senior LevelSystem Design

In Simple Words: When a single database server hits physical CPU or disk capacity limits:

  • Split the dataset horizontally across multiple distinct database servers (Shards):
    • Range-Based Sharding: Shard 1 holds IDs 1 - 1,000,000; Shard 2 holds 1,000,001 - 2,000,000. Risk of hot spots if new traffic concentrates on latest IDs.
    • Hash-Based Sharding: hash(customer_id) % num_shards. Distributes traffic evenly.
    • Directory-Based Sharding: A lookup service maps customer IDs to physical shard endpoints.