Kafka in Production

Kafka's defaults will run; whether they'll survive a broker failure, a traffic spike, or a year of growth depends on a handful of decisions — replication, durability, partitioning, and what you monitor — that are far cheaper to make now than to retrofit later.

The concepts are in place; this final post is about running Kafka for real. Production Kafka is mostly about a few decisions that determine durability and scale, plus knowing the pitfalls that bite teams and the honest cases where Kafka is the wrong tool. This eighth post closes the Event-Driven Architecture with Kafka series.

Replication and in-sync replicas

The foundation of Kafka’s durability is replication: each partition has a leader and a configurable number of replicas on other brokers. Producers write to the leader; followers copy the data. The set of replicas that are caught up is the in-sync replica set (ISR). Two settings work together to decide how durable a write really is:

The combination that matters: acks=all + replication factor 3 + min.insync.replicas=2 is the standard durable configuration. acks=all alone is not enough — without min.insync.replicas, a partition down to one in-sync replica would still accept writes that a single failure then loses. Durability is this trio, not any one setting.

Partitioning strategy: decide early

Partition count is the decision teams most regret getting wrong, because it’s awkward to change later. It sets two ceilings from earlier in the series: consumer parallelism (a group can’t have more active consumers than partitions) and throughput. More partitions mean more parallelism and headroom — but also more overhead (open files, more rebalancing work, more end-to-end latency at extremes), so more is not free.

The guidance: estimate your target throughput and peak consumer parallelism, and provision partitions to cover peak with growth headroom, because increasing partitions later is disruptive (it changes key-to-partition mapping, breaking per-key ordering for existing keys). Under-provisioning caps your scale; wild over-provisioning adds overhead. Pick a considered number up front, and remember the key-distribution lesson: a good key spreads load across those partitions rather than creating a hot one.

What to monitor

Kafka is a system you must watch, and a few signals matter most:

Lag and under-replicated partitions are the two you cannot run blind on: the first tells you consumers are keeping up, the second tells you your data is as durable as you think.

Common pitfalls

The failures that recur, so you can avoid them:

Most Kafka incidents trace back to one of these six, and every one is preventable at design time.

When not to use Kafka

An honest close, matching the series’ first post. Kafka is heavy infrastructure — a distributed, stateful cluster to run, monitor, and reason about. It is overkill for:

Kafka earns its considerable operational cost when you genuinely need durable, replayable, high-throughput event streams shared across many independently-evolving consumers — the exact case event-driven architecture is for. Reach for it there, and reach for something simpler everywhere else.

The series, in one line

Event-driven architecture decouples services by sharing durable, replayable facts instead of synchronous calls, and Kafka is the log that makes those facts durable, ordered, and replayable at scale. Master the log and its consequences — producers keying for order and durability, consumer groups sharing and committing work, delivery semantics made correct with idempotency, schemas as an evolving contract, and the patterns and production settings above — and you can design event systems that scale and survive failure. Use it where independent evolution, fan-out, and replayable history are real; keep it simple everywhere else.

Key takeaways

Further reading

Sources & References

Running Kafka in production