Guide · Kafka

The Kafka Operations Guide

Kafka rarely fails loudly. It falls behind, rebalances at the wrong moment, fills a disk, or drops a message nobody can find. This guide takes the operational decisions in the order they arrive on a real estate and points to the article that works each one in full.

Tyler Eastridge

By Tyler Eastridge, Head of Operations

LinkedIn · Updated

4 min read10 sections
On this page
Operating Kafka in one paragraph

Operating Kafka in one paragraph

Decide the metadata layer first: new clusters run KRaft, and the 4.0 line removes ZooKeeper entirely, so a migration plan is not optional. Size partitions to the consumer count you will actually run, not the throughput you hope for, and choose keys that spread load. Watch consumer lag as a rate, not a number, and treat every rebalance as an event with a cause. Set retention by what downstream systems can replay, tune producer timeouts to the broker's real acknowledgement path, and turn on exactly-once only where the application can use it. Secure the cluster with SASL, ACLs and TLS before it carries anything regulated. Design disaster recovery around an RPO you have written down. And if none of this is work your team wants to own, a support contract or a managed service is the alternative to running it badly.

KRaft, ZooKeeper removal and the 4.0 line

Kafka 4.0 runs on KRaft only; ZooKeeper is gone. New clusters should start on KRaft, and existing ZooKeeper clusters need a planned migration before they can take the 4.x line. KRaft is production-ready for most estates, with the usual caveats about controller quorum sizing, metadata snapshot behaviour and tooling that still assumes a ZooKeeper connection string.

Partition strategy: count, keys and hot partitions

Partition count sets your parallelism ceiling and cannot be reduced later, so size it to the consumer count you will run at peak with headroom, not to a throughput figure. Keys decide ordering and load distribution; a key with skewed cardinality produces a hot partition that no amount of broker hardware fixes. Re-partitioning a topic in production is a migration, so get this right before the topic carries traffic.

Consumer lag: measure it as a rate

Lag is the distance between the last produced offset and the last committed one, per partition. A lag number tells you almost nothing; the rate of change does. Lag that grows is a consumer that cannot keep pace, a hot partition, or a rebalance in progress. Alert on sustained growth and on time-to-catch-up, not on a static threshold that pages during every deploy.

Rebalances: every one has a cause

A rebalance stops consumption for the group while partitions are reassigned. They are triggered by members joining or leaving, by session or poll timeouts, and by topic changes. Most rebalance storms are a poll interval shorter than the processing time, or a consumer that dies and restarts in a loop. Cooperative sticky assignment and static membership cut the cost; fixing the trigger removes it.

Producer timeouts and delivery guarantees

A producer timeout is the broker's acknowledgement path taking longer than the client will wait: under-replicated partitions, a leader election, a full request queue, or an acks=all write waiting on a slow follower. Fix the path, not the timeout. Idempotent producers and transactions give exactly-once within Kafka; they do not make the downstream side effect exactly-once, which is where most exactly-once claims quietly fail.

Retention: by time, by size, and by what can replay

Retention is a replay budget. Time-based retention sets how far back a consumer can recover; size-based retention protects the disk. Set both, per topic, from what downstream systems can actually reprocess, and remember that compacted topics keep the latest value per key rather than a window. Retention is also the disk-full incident waiting to happen on any topic where nobody set it.

Security: SASL, ACLs and encryption

Authentication with SASL (SCRAM, or OAuth where the estate has an identity provider), authorization with ACLs per principal and topic, TLS on every listener including inter-broker, and secrets kept out of client configuration files. Do this before the cluster carries regulated data, because retrofitting ACLs onto a hundred consumer groups is a project of its own.

Disaster recovery: architectures, RPO and testing

A single cluster across availability zones survives a zone; it does not survive a region. Cross-region DR is a second cluster with MirrorMaker 2 or cluster linking, and the choice between active-passive and active-active is set by the recovery point you can accept and whether consumers can resume from mirrored offsets. Write the RPO down, then test the failover with consumers attached and time it.

Kafka on Kubernetes

Kafka on Kubernetes works with an operator, persistent volumes whose failure domain you have checked, and pod anti-affinity across zones. The provider differences are in storage classes and load balancing of long-lived connections; the failure modes are the same as any stateful workload on a scheduler: a drain during a leader election, a volume that is zonal when you assumed regional.

Who runs it

Every step above is routine for a team that has done it before and a project for one that has not. The alternatives to learning it during an incident are a support contract, if the platform team can hold the pager, or managed operations, if it cannot. A health check is the honest way to find out which you need.

Frequently asked questions

Is KRaft production-ready?

Yes for new clusters, and Kafka 4.0 runs on KRaft only. Existing ZooKeeper clusters need a planned migration before taking the 4.x line; the caveats are controller quorum sizing and tooling that still expects a ZooKeeper connection.

How many partitions should a Kafka topic have?

Enough for the consumer parallelism you will run at peak, with headroom, because partition count cannot be reduced later. The cost of too many is metadata and file handles per broker; the cost of too few is a consumer ceiling you cannot raise without a migration.

What is the most common cause of Kafka incidents?

In the estates AceMQ supports: rebalance storms from poll intervals shorter than processing time, consumer lag on a hot partition caused by key skew, and a disk filled by a topic nobody set retention on. All three are visible before they page anyone.

Does Kafka guarantee exactly-once delivery?

Within Kafka, with idempotent producers and transactions, yes. Across the boundary into a database or an API call, no; the downstream side effect still needs to be idempotent, which is where most exactly-once designs fail.

Kafka services

Where this gets done

The work behind this page, run by the same engineers who wrote it.

More resources

Other Kafka guides, comparisons and research

From the blog

Recent Kafka articles

Next step

Need this done on your Kafka estate?

Named senior Kafka engineers, 24/7, with a 15-minute emergency SLA — self-managed, MSK or Confluent Platform.