Scale a database to handle 10x growth

Instruction: Discuss your strategy for scaling a relational database system to accommodate a tenfold increase in traffic.

Context: This question assesses the candidate's skills in database scaling techniques and their ability to plan for significant growth in data volume and access rates.

Updated

Official answer

Clarify what grows tenfold: stored bytes, requests, writes, concurrent users, a hot tenant or all of these. State latency, consistency, availability and cost targets. Measure query plans, lock waits, connection pressure, I/O, memory and peak load before selecting an architecture.

Reduce avoidable work first: correct N+1 access, bound result sets, improve appropriate indexes and remove needless writes. Indexes cost storage and write work. A larger instance may be a sufficient solution within the forecast horizon; vertical scaling is not inherently wrong because it has a ceiling.

Read replicas help eligible reads, not primary write throughput, and may lag. Define read-after-write behavior. Caches need bounded size, invalidation/version rules and protection against stampedes. Neither feature automatically preserves every consistency requirement.

Shard only when its benefits justify cross-shard queries/transactions, routing, rebalance and recovery. Choose a key from access patterns and skew; a hot entity may remain a bottleneck. Test peak and failure capacity, including the loss of a replica or shard, then migrate with reconciliation and a defined rollback/repair boundary.

Report measured capacity and headroom for the expected workload. Ten times the requests does not necessarily require ten times the servers, and a list of scaling products does not establish an available or correct system.

Related Questions