0
0
Kafkadevops~10 mins

Compression (gzip, snappy, lz4) in Kafka - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the Kafka producer compression type to gzip.

Kafka
props.put("compression.type", "[1]");
Drag options to blanks, or click blank then click option'
Agzip
Bsnappy
Clz4
Dnone
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'gz' instead of 'gzip' as the compression type.
Forgetting to put the compression type in quotes.
2fill in blank
medium

Complete the code to configure the Kafka producer to compress messages with snappy.

Kafka
props.put("compression.type", "[1]");
Drag options to blanks, or click blank then click option'
Alz4
Bgzip
Cnone
Dsnappy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'snip' or 'snap' instead of 'snappy'.
Confusing compression.type with other Kafka properties.
3fill in blank
hard

Fix the error in the code to enable lz4 compression for Kafka producer.

Kafka
props.put("compression.type", "[1]");
Drag options to blanks, or click blank then click option'
Alz_4
Blz4
Clz-4
Dlzfour
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores or dashes in the compression type string.
Misspelling 'lz4' as 'lzfour'.
4fill in blank
hard

Fill both blanks to create a Kafka producer configuration that uses gzip compression and sets the batch size to 16384 bytes.

Kafka
props.put("compression.type", "[1]");
props.put("batch.size", [2]);
Drag options to blanks, or click blank then click option'
Agzip
Bsnappy
C16384
D32768
Attempts:
3 left
💡 Hint
Common Mistakes
Using batch size as a string instead of an integer.
Mixing compression types and batch sizes.
5fill in blank
hard

Fill all three blanks to create a Kafka producer configuration that uses lz4 compression, sets batch.size to 50000, and enables idempotence.

Kafka
props.put("compression.type", "[1]");
props.put("batch.size", [2]);
props.put("enable.idempotence", [3]);
Drag options to blanks, or click blank then click option'
Agzip
B50000
Ctrue
Dlz4
Attempts:
3 left
💡 Hint
Common Mistakes
Using numeric values as strings for batch.size.
Setting enable.idempotence to 'yes' or '1' instead of 'true'.