Q20 · How do you handle high-volume write workloads?

Back to 24 Architecture Questions.

The question is not “shard everything”. The axis it turns on: how much durability and ordering the write can give up. Every knob on the write path trades throughput against a guarantee somebody has to name: the acknowledgment point buys durability with caller latency, batching buys throughput with delay, and ordering is usually bought for no reason at all.

The ack point is the dial A write moves through a buffer, a write-ahead log, and a replica quorum. The acknowledgment can be sent at any of the three points: early is fast but losable, late is durable but slow. FIGURE 20 THE ACK POINT IS THE DIAL Ack to Client choose the point Write arrives Buffer batch, in memory WAL on-disk log Quorum replicated ack here: fast, lost on crash ack here: crash-safe ack here: node-loss safe the ack point is the dial: durability is bought with caller latency, throughput with risk

What the answer should contain

The acknowledgment point is the durability dial. Ack after quorum fsync: the write survives the loss of a node; the caller pays the round-trips. Ack after the WAL append: crash-safe on one node, node-loss is a risk. Ack from memory: maximum throughput, and the data dies with the process. Clickstream can ack from memory; money acks after quorum; most things live in between, and the choice must be written down per data class.

Batching is where throughput actually comes from. Group commit, batched flushes, size or time windows: the cost of a write is mostly fixed overhead, so amortizing it across a batch is the first-order win. The price is added latency, bounded by the batch window.

Ordering: buy per-key, refuse global. Almost every workload needs “events for this key, in order” (so partition by key), and almost none need a global sequence. Global ordering caps throughput at one serialization point for no business-visible benefit. If someone demands it, make them name the decision that breaks without it.

Shape the storage for writes. Append-only inserts beat in-place updates on hot tables; partition by time or key so no single structure takes all writes; index minimally, because every index is a write tax. The schema is a write-path decision, not just a read-path one.

Bound the intake. Bounded queues, reject early, and never use the disk as an unbounded buffer: “disk full, and the queue kept accepting” is the worst failure mode to discover during the load event that caused it. Backpressure, rejecting work early instead of queueing it without a bound, is part of the write design.

Idempotency is still on the ticket. Batching and retries multiply duplicates: every acked path must be replayable, and at-least-once is the honest delivery model all the way down.

Ideas worth mentioning out loud

Follow-ups to expect

Red flags in an answer

Sources