Sharding medium
Which sharding architecture generally provides the lowest request latency but at the cost of significantly higher client-side complexity and coupling?
- A Proxy-based sharding (e.g., using Nginx or Vitess).
- B Server-side routing (e.g., using a Gossip-based system like Cassandra).
- C Client-side sharding (using a 'Smart Client' or specialized database driver).
- D Active-Passive sharding with a shared storage layer.
Answer: C. Client-side sharding (using a 'Smart Client' or specialized database driver).
With a 'Smart Client', the routing logic lives directly in your application code. Because the client connects directly to the correct shard, it avoids the extra 'Network Hop' and CPU overhead of a central proxy. However, this creates a major maintenance burden: if you add a new database shard, you must re-configure and deploy *every single instance* of your application. Proxies are more popular for large teams because they decouple the application from the database topology, allowing for zero-downtime cluster changes without touching application code.
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)?