Systems Design Concepts Practice Test

Access More Questions
Which sharding approach stores shard assignments in a lookup table and uses a directory before querying data, offering flexibility but adding latency and a potential single point of failure?
Correct Answer:
Directory-Based Sharding stores shard assignments in a lookup table, but introduces latency and a potential single point of failure.
Explanation:
Sharding with a directory means you keep a central lookup structure that maps each shard key to the specific shard, and every query first consults that directory to route to the right shard. This setup offers flexibility because you can reassign data or rebalance shards by updating the directory without changing application logic. The trade-offs are clear: you pay extra latency for the directory lookup on every query, and there's a potential single point of failure if the directory becomes unavailable or bottlenecks the system. Understand how the others differ: range-based sharding assigns contiguous key ranges to shards directly, which is simple and fast for routing but harder to adapt when you need to rebalance or add shards. Consistent hashing uses a hashing ring so keys map to shards with minimal movement when the topology changes, avoiding a central directory and thus reducing rebalancing work. Two-phase commit is about coordinating transactions across multiple shards and can add latency due to coordination overhead, but it doesn’t define how shard assignments are stored or routed.

Access more questions from this quiz

Continue to Systems Design Concepts Practice Test for more practice questions and the full quiz experience.

Access More Questions