Apache Kafka is a distributed event streaming platform used for pipelines, microservices and analytics. This four-part Apache Kafka guide turns the ideas Michael Noll popularised for software engineers into a practical OSO checklist, updated for Kafka 4.x where ZooKeeper is gone and KRaft is the default. If you want a shorter overview first, read what is Apache Kafka and our Kafka key concepts post. For a beginner-oriented path, see our separate Apache Kafka guide for beginners.
Part 1: What are events, streams and tables in Kafka?
Kafka models the world as events: facts that happened at a point in time. A stream is an unbounded sequence of those events. A table is a changing snapshot derived from a stream (for example the latest state per key).
Before you create topics, decide:
Decision
Why it matters
Event vs command
Events describe what happened; commands request work. Mixing them muddies replay.
Key design
Keys drive partitioning and compaction. Keyless messages use sticky or round-robin partitioning.
Retention vs compaction
Time/size retention keeps history; compaction keeps the latest value per key.
Consumers
Each consumer group tracks its own offsets, so analytics and product apps can share topics safely.
Producers append to the log; consumers read from offsets. That append-only design is why Kafka supports replay when a bug or model changes. Part 1 is complete when you can name the events, keys and consumers for one real use case.
Part 2: How do topics, partitions and storage work?
A topic is a named stream. It is split into partitions, each an ordered log of records. Brokers store partition replicas on disk; the controller (KRaft in modern clusters) manages membership and leadership.
Practical storage rules we use with clients:
Partition count follows parallelism. More partitions allow more consumer instances in a group, but increase open-file and metadata cost. Start from expected throughput and consumer parallelism, not an arbitrary large number.
Replication factor is usually three in production so you can lose a broker without losing the partition.
Clients read from the partition leader by default. Follower fetching is optional and must be enabled deliberately.
Retention defaults are time-based (commonly seven days unless you change them). Compaction is a separate cleanup policy for changelog-style topics.
Kafka 3.4 introduced production-ready ZooKeeper-to-KRaft migration (KIP-866). Kafka 4.0 removed ZooKeeper entirely, so new clusters should start on KRaft. Time-based metadata snapshots and related controller improvements from the 3.4 line still matter for large partition counts. For managed options that hide this operational layer, compare managed Kafka services.
Part 3: How do you process Kafka streams?
Once events are in topics you can process them with Kafka Streams, Apache Flink, ksqlDB, Spark Structured Streaming or custom consumers. The shared ideas are the same:
Stateless maps and filters reshape or drop events.
Stateful joins and aggregations need state stores (often RocksDB in Kafka Streams) and changelog topics for recovery.
Exactly-once or effectively-once semantics depend on idempotent producers, transactional APIs and careful sink design—do not assume the default consumer is enough.
Schema contracts (Avro, Protobuf or JSON Schema via a registry) stop producers and consumers drifting apart.
OSO clients often start with Kafka Streams for JVM services tightly bound to the cluster, and Flink when they need larger stateful jobs or SQL-heavy pipelines. Either way, treat processing as a first-class deployable with tests, not a side script. Our notes on Kafka Streams RocksDB cover state-store pitfalls in production.
Part 4: How do elasticity and fault tolerance work?
Kafka scales by adding brokers and reassigning partitions, and by growing consumer groups. Fault tolerance comes from replicas and controlled leader election.
Concern
What to design for
Broker loss
min.insync.replicas and producer acks=all so writes only succeed on a quorum
Consumer failure
Another group member resumes from the committed offset
Rebalance storms
Static membership, cooperative sticky assignors, and enough partitions for the intended parallelism
Multi-site
MirrorMaker 2, Cluster Linking or equivalent—not ad-hoc dual writes
Operations
Infrastructure as code, monitoring lag and under-replicated partitions, clear runbooks
Community learning still helps. Earlier Kafka Summit London sessions (the event series is now Current) and talks on KRaft from maintainers such as Colin McCabe remain useful background for why controller scalability improved. For self-service operating models that build on this four-part base, see our self-service Kafka operations guide.
Key takeaway: Learn Apache Kafka in four parts—events and tables, topics and storage, stream processing, then elasticity and fault tolerance—and only then scale partitions, consumers and ops.
Frequently asked questions
What is an Apache Kafka guide usually covering?
A practical Apache Kafka guide covers the event log model, topics and partitions, producers and consumers, storage and retention, stream processing options, and how the cluster stays elastic and fault tolerant under failure.
Is ZooKeeper still required for Apache Kafka?
No. Kafka 3.x made KRaft production-ready and migratable from ZooKeeper; Kafka 4.0 removed ZooKeeper. New clusters should run in KRaft mode.
How many partitions should a Kafka topic have?
Choose partition count from throughput and consumer parallelism, not a fixed large default. Too few partitions limit scale; too many increase metadata and file-handle cost on every broker.
What is the difference between a stream and a table in Kafka?
A stream is an unbounded sequence of events. A table is a mutable snapshot, usually the latest value per key, often maintained by compacting a changelog topic or by a stream processor state store.
Where should beginners start after this guide?
Start with a single topic, one producer and one consumer group in a non-production cluster, then add schemas and replication. Our Kafka for beginners article is a gentler on-ramp if this four-part guide feels dense.