Sharding easy
From an engineering perspective, when should you choose 'Vertical Scaling' (a bigger server) over 'Horizontal Scaling' (Sharding)?
- A Never. Sharding is the modern standard and is superior in every possible technical scenario.
- B As long as your data fits comfortably on a single machine, because sharding introduces massive architectural and operational complexity.
- C Only when you have reached at least 1 Petabyte of data and have exhausted all other options.
- D Only when your application requires a guaranteed 'Five Nines' (99.999%) availability rating.
Answer: B. As long as your data fits comfortably on a single machine, because sharding introduces massive architectural and operational complexity.
Sharding is an 'architectural choice of last resort'. While it allows for infinite growth, it breaks many convenient database features like ACID transactions across tables and fast joins. A single, powerful database server is significantly easier to develop, monitor, and maintain. A common engineering mistake is 'premature sharding'—implementing distributed complexity before the scale of the traffic actually requires it.
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)?
- 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?