Challenge - 5 Problems
Kafka Compression 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 compression setting?
Consider a Kafka producer configured with the following properties:
What compression type will Kafka use to compress the messages before sending?
props.put("compression.type", "gzip");
props.put("batch.size", 16384);
props.put("linger.ms", 5);What compression type will Kafka use to compress the messages before sending?
Attempts:
2 left
💡 Hint
Check the value assigned to the 'compression.type' property.
✗ Incorrect
The 'compression.type' property controls the compression codec used by Kafka producer. Setting it to 'gzip' means messages are compressed using gzip before sending.
❓ Predict Output
intermediate2:00remaining
What error occurs with unsupported compression codec in Kafka?
Given this Kafka producer configuration:
What happens when the producer tries to send messages?
props.put("compression.type", "brotli");What happens when the producer tries to send messages?
Attempts:
2 left
💡 Hint
Check Kafka's supported compression codecs.
✗ Incorrect
Kafka supports only 'none', 'gzip', 'snappy', and 'lz4' by default. Setting an unsupported codec like 'brotli' causes an IllegalArgumentException when sending messages.
🚀 Application
advanced2:00remaining
How to configure Kafka consumer to decompress messages compressed with snappy?
You have a Kafka topic where messages are compressed using snappy by the producer.
Which consumer configuration ensures messages are decompressed correctly?
Which consumer configuration ensures messages are decompressed correctly?
Attempts:
2 left
💡 Hint
Think about how Kafka consumers handle compression.
✗ Incorrect
Kafka consumers automatically detect and decompress messages compressed by producers. No special configuration is needed for snappy or other supported codecs.
🧠 Conceptual
advanced2:00remaining
Why might you choose lz4 compression over gzip in Kafka?
Select the main reason to prefer lz4 compression instead of gzip for Kafka message compression.
Attempts:
2 left
💡 Hint
Consider speed vs compression ratio trade-offs.
✗ Incorrect
lz4 is designed for very fast compression and decompression with a reasonable compression ratio, making it suitable for high-throughput Kafka environments. gzip compresses better but is slower.
🔧 Debug
expert3:00remaining
What is the cause of this Kafka producer runtime error with gzip compression?
A Kafka producer configured with:
When sending messages, it throws:
What is the root cause?
props.put("compression.type", "gzip");
props.put("batch.size", 0);When sending messages, it throws:
java.lang.IllegalArgumentException: batch.size must be > 0What is the root cause?
Attempts:
2 left
💡 Hint
Check the error message carefully.
✗ Incorrect
The error clearly states batch.size must be greater than zero. Setting batch.size to zero is invalid regardless of compression type.