Quick revision
The short answer
The three controllers form a Raft quorum that owns the cluster metadata: topics, partitions, leaders, ISRs, configs, ACLs and broker registrations, all kept in the internal __cluster_metadata log. One controller is active and the other two replicate that log as hot standbys, while the six brokers store and serve the actual topic data and keep an in-memory copy of the metadata. Because a Raft quorum needs a majority, three controllers survive one failure; when two are down, metadata changes stop, although existing partition leaders keep serving reads and writes.
What to remember
In this answer, we saw that in a KRaft cluster the controllers own the metadata in the __cluster_metadata log, with one active controller and the others as hot standbys, while brokers store data and serve clients from an in-memory metadata image. A quorum needs a majority, so three controllers survive one failure and five survive two, and an even number adds nothing. Without a quorum, data keeps flowing on healthy partitions, but every metadata change, including leader elections after a broker failure, stops.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The three controllers form a Raft quorum that owns the cluster metadata: topics, partitions, leaders, ISRs, configs, ACLs and broker registrations, all kept in the internal __cluster_metadata log. One controller is active and the other two replicate that log as hot standbys, while the six brokers store and serve the actual topic data and keep an in-memory copy of the metadata. Because a Raft quorum needs a majority, three controllers survive one failure; when two are down, metadata changes stop, although existing partition leaders keep serving reads and writes.
Why this question is asked
Since Kafka 4.0 removed ZooKeeper, every Kafka cluster is a KRaft cluster, so knowing which node does what is the starting point for sizing, upgrades and outage analysis. Interviewers ask this question because the answer tells them whether we understand the split between the control plane (who decides) and the data plane (who stores and serves records), and whether we can reason about quorum math instead of guessing. In this answer, we will recap what process.roles means, look at what controllers do and where the metadata lives, see how brokers use that metadata, work out how many failures the quorum tolerates, and see exactly what keeps working and what stops when the quorum is lost.
1A Quick Recap of process.roles
Every Kafka 4.x node is started with a property called process.roles. It can be broker, controller, or broker,controller. A node with the broker role stores partitions on disk and talks to producers and consumers. A node with the controller role takes part in managing the cluster: it decides which broker leads each partition, which replicas are in sync, which topics exist, and so on.
A node with both roles is said to run in combined mode. That is convenient on a laptop or in a small cluster of three machines, but in production we usually keep the two roles on separate machines, which is what our cluster does: three dedicated controllers and six dedicated brokers. The controllers find each other through controller.quorum.voters (a fixed list) or controller.quorum.bootstrap.servers (used with a dynamic quorum since Kafka 3.9), and every broker is told the same addresses so it can reach them.
ZooKeeper used to hold this metadata in older versions. Kafka 4.0 removed ZooKeeper mode entirely, so KRaft (Kafka Raft) is now the only way to run Kafka.
Notice that a broker does not list itself as a voter. Only the controllers vote; the brokers are readers of the metadata.
2What the Controllers Do and Where the Metadata Lives
The three controllers run the Raft consensus protocol among themselves. Raft elects one of them as the leader of the quorum, and that node is called the active controller. Every metadata change, such as creating a topic, changing a config or moving a partition leader, is decided by the active controller and written as a record to a special internal topic with a single partition, __cluster_metadata.
The other two controllers follow that log. They fetch every new record from the active controller and append it to their own copy, so each of them holds the full metadata and can take over within moments if the active controller fails. That is why we call them hot standbys: there is no reload or re-read step when one of them becomes active, because it already has the state in memory.
A record in the metadata log counts as committed only when a majority of the voters have it. With three voters, the active controller plus one follower is a majority. Only committed records are applied and published to the brokers, which is what makes the metadata consistent even when a controller crashes in the middle of a change.
- Active controllerdecides changes, appends them to __cluster_metadata
- Two standby controllersreplicate the metadata log, ready to take over
- Six brokersfetch the metadata log, keep an in-memory image
- Partition data on brokerstopic logs, replicated broker to broker
- Producers and consumersask brokers for metadata, then talk to leaders
5 layers, from the top down. Step through them one at a time.
The controllers form the control plane; the brokers form the data plane.
3How Brokers Use the Metadata
A broker starts by registering with the active controller, telling it its node id, its listeners and its log directories. From then on it sends a heartbeat every couple of seconds. If the heartbeats stop for longer than broker.session.timeout.ms, the controller fences the broker, which means it is no longer allowed to lead partitions, and it elects new leaders for its partitions.
The broker also fetches the __cluster_metadata log, exactly like a follower would, and applies each committed record to an in-memory structure called the metadata image. When a producer or consumer sends a Metadata request asking where the leaders of a topic are, the broker answers from that image. So clients never talk to the controllers directly; they learn the cluster layout from any broker.
4Counting the Failures the Quorum Survives
Raft needs a majority of voters to commit anything. With n voters the majority is n / 2 + 1, rounded down for the division, and the number of failures we can survive is n minus that majority. With three voters the majority is two, so we survive one failure. With five voters the majority is three, so we survive two.
Notice that an even number adds nothing. Four voters need a majority of three, so four still survive only one failure, while costing an extra machine and adding one more node that has to acknowledge writes. That is why controller quorums are almost always three or five.
| Voters | Majority needed | Failures survived |
|---|---|---|
| 1 | 1 | 0 |
| 3 | 2 | 1 |
| 4 | 3 | 1 |
| 5 | 3 | 2 |
So for our cluster, the answer is one. One controller can be down for maintenance or because of a crash, and metadata changes continue. When a second one fails, the single survivor cannot form a majority and every metadata change stops until a second controller is back.
5What Keeps Working Without a Quorum
Losing the controller quorum is not the same as losing the cluster. The brokers still hold their metadata image, partition leaders still accept produce requests, followers still replicate, and consumers still fetch. A service that only produces and consumes on healthy partitions may not notice anything at first.
What stops is everything that needs a new committed metadata record. Topic creation and deletion fail, config changes fail, partition reassignments do not progress, and ISR changes cannot be recorded. The dangerous one is leader election: if a broker crashes while the quorum is down, nobody can elect new leaders for its partitions, so those partitions stay offline. A cluster without a controller quorum is running on borrowed time.
6Follow-up questions
Why does the metadata log need periodic snapshots?
Without snapshots, the __cluster_metadata log would grow forever and a restarting controller or broker would have to replay every record since the cluster was created. A snapshot is a compact file holding the full metadata state as of one offset. A node loads the latest snapshot and then replays only the records after it, and older log segments can be deleted. Kafka creates snapshots automatically based on how many bytes of records have accumulated (metadata.log.max.record.bytes.between.snapshots) and on a time interval (metadata.log.max.snapshot.interval.ms); check your version for the defaults. A follower that is far behind can also be sent a snapshot instead of millions of individual records.
Is the active controller a single point of failure?
No. If the active controller dies, the remaining voters notice that its leader heartbeats stopped, hold a Raft election, and one of them becomes the new active controller, usually within a second or two. Because the standbys already replicate the log, the new active controller has the state and starts processing requests right away. Only losing a majority stops the control plane.
7Conclusion
In this answer, we saw that in a KRaft cluster the controllers own the metadata in the __cluster_metadata log, with one active controller and the others as hot standbys, while brokers store data and serve clients from an in-memory metadata image. A quorum needs a majority, so three controllers survive one failure and five survive two, and an even number adds nothing. Without a quorum, data keeps flowing on healthy partitions, but every metadata change, including leader elections after a broker failure, stops.
Open with
In Kafka 4 the cluster runs in KRaft mode, so the three controller nodes form a Raft quorum and the six broker nodes do the data work. The controllers store all cluster metadata, meaning topics, partitions, leaders, ISRs, configs, ACLs and broker registrations, in an internal single-partition log called __cluster_metadata.
Then, if they want more
One controller is the active one and makes every decision; the other two replicate the log and are ready to take over immediately. The brokers register with the active controller, send heartbeats, and fetch that same metadata log to keep an in-memory image, which they use to answer clients' Metadata requests and to know which partitions they lead or follow.
Clients never talk to the controllers. Because Raft commits only with a majority, three controllers tolerate one failure, five tolerate two, and an even number like four adds no tolerance.
If we lose two of the three, the existing leaders keep serving produce and fetch, so traffic may look normal, but nothing that needs a metadata commit works: no topic creation, no config changes, no ISR updates and, worst of all, no new leader elections if a broker dies.
ZooKeeper was removed in 4.0, so this is the only mode now. I would use dedicated controllers like here for production and keep combined mode for development or very small clusters.
About this answer
- Last updated
- 13 November 2026
- Versions it names
- Kafka 4.0, Kafka 3.9
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Explain what each group does, where the cluster metadata lives, and how many controller...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-internals/e7bc5cb589/