Recall & Review
beginner
What is the purpose of compression in Kafka?
Compression reduces the size of messages sent over the network and stored on disk, improving throughput and saving storage space.
Click to reveal answer
beginner
Name three compression codecs supported by Kafka.
Kafka supports gzip, snappy, and lz4 compression codecs.
Click to reveal answer
intermediate
How does gzip compression compare to snappy in Kafka?
Gzip offers higher compression ratio but is slower, while snappy is faster but compresses less effectively.
Click to reveal answer
intermediate
What is a key advantage of lz4 compression in Kafka?
Lz4 provides a good balance of fast compression and decompression speed with reasonable compression ratio, making it suitable for real-time data streams.
Click to reveal answer
beginner
How do you enable compression for Kafka producers?
Set the producer configuration property 'compression.type' to 'gzip', 'snappy', or 'lz4' to enable compression.
Click to reveal answer
Which Kafka compression codec typically offers the fastest compression speed?
✗ Incorrect
lz4 is designed for fast compression and decompression, faster than snappy and gzip.
What is the default compression type in Kafka if none is specified?
✗ Incorrect
By default, Kafka producers do not compress messages unless 'compression.type' is set.
Which compression codec is best when you want the smallest message size regardless of speed?
✗ Incorrect
Gzip compresses data more tightly than snappy or lz4 but is slower.
How does compression affect Kafka network usage?
✗ Incorrect
Compression reduces the size of messages, lowering network bandwidth usage.
Which Kafka compression codec is recommended for real-time streaming with low latency?
✗ Incorrect
Lz4 offers fast compression and decompression suitable for low latency streaming.
Explain the differences between gzip, snappy, and lz4 compression codecs in Kafka.
Think about speed versus compression size trade-offs.
You got /3 concepts.
Describe how to enable compression on a Kafka producer and why you might want to do it.
Consider configuration and benefits.
You got /4 concepts.