0
0
Kafkadevops~20 mins

Replication factor in Kafka - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Kafka Replication Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:00remaining
What does the replication factor control in Kafka?

In Kafka, the replication factor is a key configuration. What does it control?

AThe number of consumers in a consumer group
BThe number of partitions in a topic
CThe maximum size of a message in bytes
DThe number of copies of each partition across different brokers
Attempts:
2 left
💡 Hint

Think about data safety and availability in Kafka.

Predict Output
intermediate
1:30remaining
Output of creating a topic with replication factor 3

Given the following Kafka topic creation command, what will be the replication factor of the topic?

kafka-topics.sh --create --topic test-topic --partitions 2 --replication-factor 3 --bootstrap-server localhost:9092
AThe topic will have 3 copies of each partition on different brokers
BThe topic will have 2 copies of each partition
CThe topic will have 1 copy of each partition
DThe command will fail because replication factor cannot be 3
Attempts:
2 left
💡 Hint

Replication factor is set explicitly in the command.

Predict Output
advanced
1:30remaining
What happens if replication factor is higher than available brokers?

Consider a Kafka cluster with 2 brokers. What happens if you try to create a topic with replication factor 3?

AThe topic creation fails with an error about insufficient brokers
BThe topic is created with replication factor 2 automatically
CThe topic is created with replication factor 3 but some replicas are on the same broker
DThe topic is created with replication factor 1
Attempts:
2 left
💡 Hint

Replication factor cannot exceed the number of brokers.

🧠 Conceptual
advanced
1:00remaining
Why is a higher replication factor beneficial?

What is the main benefit of setting a higher replication factor for a Kafka topic?

ASimpler consumer group management
BReduced disk usage on brokers
CImproved fault tolerance and data availability
DFaster message processing speed
Attempts:
2 left
💡 Hint

Think about what happens if a broker fails.

🚀 Application
expert
2:00remaining
Calculate minimum in-sync replicas for replication factor 5

You have a Kafka topic with replication factor 5. To ensure strong durability, you want to set the minimum in-sync replicas (min.insync.replicas) to the highest number that still allows the leader to acknowledge writes if one broker fails. What should this value be?

A2
B4
C5
D3
Attempts:
2 left
💡 Hint

min.insync.replicas must be less than or equal to replication factor minus one to tolerate one failure.