Sharding medium
In a standard 'Modulo Sharding' setup (`key % N`), what is the primary consequence of adding a new server to the cluster (increasing N from 10 to 11)?
- A Only a small fraction (roughly 1/11th) of the existing keys will need to be moved to the new server.
- B The new server will remain empty until you manually re-route new traffic to it.
- C The existing routing logic will instantly break, causing a total cluster outage until the rehash is complete.
- D Nearly every existing key in the entire cluster will now result in a different modulo remainder, requiring massive data movement and churn.
Answer: D. Nearly every existing key in the entire cluster will now result in a different modulo remainder, requiring massive data movement and churn.
Modulo sharding is highly volatile. Because `ID % 10` and `ID % 11` are rarely the same, almost every piece of data in your system would need to be relocated to a different physical server to remain findable. This makes scaling a live system extremely difficult. 'Consistent Hashing' was developed to solve this problem by ensuring that when a node is added, only the keys belonging to that node's immediate neighbors on the virtual 'ring' are relocated, drastically reducing the operational impact and downtime of cluster expansion.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- In an E-Commerce platform, why might you choose to shard the `Orders` table by `user_id` rather than the more obvious `order_id`?
- In the context of database scaling, what is the fundamental difference between 'Vertical Partitioning' and 'Horizontal Partitioning' (Sharding)?
- If Shard A fails in a large cluster, and its incoming traffic is automatically re-routed to Shard B, what is the risk of a 'Cascading Failure'?
- From an engineering perspective, when should you choose 'Vertical Scaling' (a bigger server) over 'Horizontal Scaling' (Sharding)?
- Which sharding strategy is mathematically optimized for efficient 'Range Scans' (e.g., retrieving all records created between January and March)?
- In a sharded architecture, what does the 'Scatter-Gather' query pattern imply for application performance?