Sharding medium
When is the most operationally sound time to execute a 'Rebalancing' operation (moving large chunks of data between database shards)?
- A During peak traffic hours to ensure the system reaches its balanced state as quickly as possible under pressure.
- B During low-traffic 'Off-Peak' hours, using a throttled background process that prioritizes live requests over data movement.
- C Instantly after every write operation to ensure the cluster is never even slightly out of balance.
- D Manually, by shutting down the entire cluster for a scheduled maintenance window.
Answer: B. During low-traffic 'Off-Peak' hours, using a throttled background process that prioritizes live requests over data movement.
Moving Terabytes of data is an intensive task that consumes significant Disk I/O, Network bandwidth, and CPU. If you run a rebalance while your users are trying to use the app, the migration will compete for resources, leading to degraded performance and 'Tail Latency' spikes. The best practice is to treat rebalancing as a low-priority 'Background Job' that carefully monitors the current system load and 'slows down' if it detects that users are starting to experience latency, ensuring that architectural maintenance never compromises the user experience.
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)?