What happens when a topic is replicated in Kafka?

Replicating a topic in Kafka means storing multiple identical copies of each of its partitions across different brokers, so the topic's data survives the loss of any single broker.

Key Points: • Each partition gets one leader replica that handles all client reads and writes, plus one or more follower replicas that continuously copy the leader's data. • If the broker hosting a partition's leader fails, one of its in-sync followers is automatically promoted to leader, keeping the topic available. • Replication also lets the cluster spread read failover capacity across more brokers, since any in-sync replica can take over if needed. • The trade-off is extra storage and network usage proportional to the replication factor chosen.

Example: A topic created with a replication factor of 3 stores three copies of each partition on three different brokers, so losing any one broker still leaves two healthy copies of every partition available to serve traffic.

Interview Tip: A concise interview answer is:

"When a topic is replicated, each of its partitions gets extra copies stored on different brokers, so if the broker leading a partition fails, one of the in-sync replicas takes over as leader automatically, keeping the topic available without data loss, at the cost of the extra storage the replication factor requires."