Search
⌘K
Patterns

Scaling Writes

Learn about how to scale writes in your system design interview.

Scaling Writes

📈 Scaling Writes addresses the challenge of handling high-volume write operations when a single database or single server becomes the bottleneck. As your application grows from hundreds to millions of writes per second, individual components hit hard limits on disk I/O, CPU, and network bandwidth and interviewers love to probe these bottlenecks.

The Challenge

Many system design problems start with modest scaling requirements before the interviewer throws down the gauntlet: "how does it scale?" While you might be familiar with tools to handle the read side of the equation (e.g. read replicas, caching, etc.) the write side is often a much bigger challenge.
Bursty, high-throughput writes with lots of contention can be a nightmare to build around and there are a bunch of different choices you can make to handle them or make them worse. Interviewers love to probe bottlenecks in your solution to see how you would react to the runaway success of their next product (whether that's realistic or not is a separate discussion!).
Write Challenges
In this pattern we're going to walk through the various scenarios and challenges you should expect to see in a system design interview, and talk about the strategies you can use to scale your system.

The Solution

Write scaling isn't (only) about throwing more hardware at the problem, there's a bunch of architectural choices we can make which improve the system's ability to scale. A combination of four strategies will allow you to scale writes beyond what a single, unoptimized database or server can handle:
  1. Vertical Scaling and Database Choices
  2. Sharding and Partitioning
  3. Handling Bursts with Queues and Load Shedding
  4. Batching and Hierarchical Aggregation
Let's first talk about how we can scale while staying safely in a single-server, single-database architecture before we start to throw more hardware at the problem!

Vertical Scaling and Write Optimization

Vertical Scaling

Database Choices

Sharding and Partitioning

Horizontal Sharding

Vertical Partitioning

Handling Bursts with Queues and Load Shedding

Write Queues for Burst Handling

Load Shedding Strategies

Batching and Hierarchical Aggregation

Batching

Hierarchical Aggregation

When to Use in Interviews

Common Interview Scenarios

When NOT to Use in Interviews

Common Deep Dives

"How do you handle resharding when you need to add more shards?"

Split All Keys

Split Hot Keys Dynamically

Conclusion

Purchase Premium to Keep Reading

Unlock this article and so much more with Hello Interview Premium

Schedule a mock interview

Meet with a FAANG senior+ engineer or manager and learn exactly what it takes to get the job.

Schedule a Mock Interview