The database is at 85% CPU at peak and growing 5% per month. Plan.
IntermediateScenarioCapacity & Load Testing
Answer
Situation read → Roughly two to three months until saturation. Databases scale slowly, so act now.
What I'd do →
- Find top queries by total time (
pg_stat_statements, Performance Insights) and optimize the worst ones. - Add caching for read-heavy, rarely changing data.
- Move reads to replicas where staleness is acceptable.
- Plan a vertical scale during a maintenance window and test it.
- Longer term: partitioning or sharding, or splitting workloads.
- Add a capacity ticket alert at 70% sustained.
Why → Optimization buys time cheaply; scaling and architecture changes need lead time.
Interview tip → Start with query optimization before throwing hardware at it.
More on Capacity & Load Testing
Marketing announces a campaign that will bring 5x normal traffic in three weeks. Prepare.IntermediateA load test shows p99 latency jumps from 120 ms to 2 s at 800 RPS, while CPU is only 45%.IntermediateYou're asked how many pods are needed for Black Friday. Walk through the calculation.IntermediateYour HPA scales out during spikes, but users still see errors for the first 2 minutes.AdvancedA soak test shows memory climbing steadily over 8 hours. What's next?BeginnerThe load test passed in staging, but production fell over at half that load.Advanced