Sharding hard
In a Leaderless sharded system (like Dynamo), what is the primary operational trade-off of setting the Write consistency level to `Quorum` (W=2 of 3 replicas)?
- A Writes are processed entirely in RAM, leading to a risk of data loss if a server loses power.
- B Every write requires only a single network message, making it the fastest possible consistency model.
- C Writes must wait for acknowledgment from at least two servers, increasing the 'Write Latency' and background network traffic compared to a single-leader model.
- D The database cannot support more than three physical servers per cluster when using Quorum-based sharding.
Answer: C. Writes must wait for acknowledgment from at least two servers, increasing the 'Write Latency' and background network traffic compared to a single-leader model.
In a 'Leader-based' system, the client only waits for the leader. the leader then replicates in the background. In 'Leaderless Quorum', the client *itself* must wait for multiple nodes to confirm the write. This 'Network Overhead' makes writes slower, but it provides a massive benefit: if any one node fails, there is no 'Failover Time'. The system remains perfectly available for writes because the other two replicas can still form a quorum. It's the ultimate trade-off: you pay for 'High Availability' with every single write you perform.
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'?
- 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)?
- 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)?