0
0
Kafkadevops~20 mins

Producer throughput optimization in Kafka - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Kafka Producer Throughput Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2: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))
A1024
B6400
C1638
D8192
Attempts:
2 left
💡 Hint
Calculate how many messages fit in one batch, then divide by linger time in seconds.
Predict Output
intermediate
2: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
ANo error, messages sent immediately
BTimeoutException due to linger.ms too high
CIllegalArgumentException: batch.size must be > 0
DSerializationException due to missing serializer
Attempts:
2 left
💡 Hint
Check the valid range for batch.size in Kafka producer configs.
🚀 Application
advanced
2: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?
ASet compression.type=none, batch.size=16384, linger.ms=0
BSet compression.type=gzip, batch.size=1024, linger.ms=50
CSet compression.type=snappy, batch.size=65536, linger.ms=20
DSet compression.type=lz4, batch.size=512, linger.ms=100
Attempts:
2 left
💡 Hint
Higher batch size and moderate linger time with fast compression helps throughput.
🔧 Debug
advanced
2: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?
Abatch.size is too small causing frequent sends
Blinger.ms is too high causing excessive delay
Cacks=all causing slow acknowledgments
Dmax.in.flight.requests.per.connection=1 limiting parallelism
Attempts:
2 left
💡 Hint
Check settings that limit concurrency in sending requests.
🧠 Conceptual
expert
2: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?
Alinger.ms
Bbatch.size
Ccompression.type
Dacks
Attempts:
2 left
💡 Hint
This setting defines how long the producer waits before sending a batch.