Challenge - 5 Problems
Kafka Producer Throughput Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Kafka producer throughput calculation?
Given the following Kafka producer configuration snippet, what is the effective throughput in messages per second if the batch.size is 16384 bytes, linger.ms is 5 ms, and the average message size is 512 bytes?
Kafka
batch_size = 16384 linger_ms = 5 message_size = 512 messages_per_batch = batch_size // message_size effective_throughput = messages_per_batch / (linger_ms / 1000) print(int(effective_throughput))
Attempts:
2 left
💡 Hint
Calculate how many messages fit in one batch, then divide by linger time in seconds.
✗ Incorrect
The batch size is 16384 bytes, each message is 512 bytes, so 16384 // 512 = 32 messages per batch. The linger time is 5 ms, which is 0.005 seconds. Throughput = 32 / 0.005 = 6400 messages per second. The code computes this exactly and prints 6400.
❓ Predict Output
intermediate2:00remaining
What error does this Kafka producer config cause?
What error will this Kafka producer configuration cause when trying to send messages?
Properties:
acks=all
batch.size=0
linger.ms=10
Attempts:
2 left
💡 Hint
Check the valid range for batch.size in Kafka producer configs.
✗ Incorrect
batch.size=0 is valid in Kafka and disables batching. The producer sends each message as an individual request immediately. No exception is thrown during producer initialization or message sending.
🚀 Application
advanced2:00remaining
Optimize Kafka producer throughput with compression and batching
You want to optimize Kafka producer throughput for a high-volume topic. Which combination of settings will most likely increase throughput without significantly increasing latency?
Attempts:
2 left
💡 Hint
Higher batch size and moderate linger time with fast compression helps throughput.
✗ Incorrect
Using snappy compression is fast and reduces data size. Increasing batch.size to 65536 bytes allows more messages per batch. Setting linger.ms to 20 ms allows batching without too much delay. This combination improves throughput while keeping latency reasonable.
🔧 Debug
advanced2:00remaining
Identify the cause of low Kafka producer throughput
A Kafka producer is configured with batch.size=32768 and linger.ms=100, but throughput is unexpectedly low. Which of the following is the most likely cause?
Attempts:
2 left
💡 Hint
Check settings that limit concurrency in sending requests.
✗ Incorrect
Setting max.in.flight.requests.per.connection=1 limits the number of unacknowledged requests to one, reducing parallelism and throughput. This is often the cause of low throughput despite large batch size and linger time.
🧠 Conceptual
expert2:00remaining
Which Kafka producer setting most directly controls the trade-off between latency and throughput?
In Kafka producer configuration, which setting most directly controls the trade-off between latency and throughput by delaying sending to batch more messages?
Attempts:
2 left
💡 Hint
This setting defines how long the producer waits before sending a batch.
✗ Incorrect
linger.ms defines the maximum time to wait for additional messages before sending a batch. Increasing linger.ms increases batching and throughput but adds latency. It directly controls the latency-throughput trade-off.