0
0
Kafkadevops~10 mins

Producer throughput optimization 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 batch size for the Kafka producer.

Kafka
props.put("batch.size", [1]);
Drag options to blanks, or click blank then click option'
A16384
B1024
C512
D2048
Attempts:
3 left
💡 Hint
Common Mistakes
Using too small batch size reduces throughput.
Setting batch size to zero disables batching.
2fill in blank
medium

Complete the code to set linger.ms to delay sending messages for batching.

Kafka
props.put("linger.ms", [1]);
Drag options to blanks, or click blank then click option'
A100
B5
C0
D1000
Attempts:
3 left
💡 Hint
Common Mistakes
Setting linger.ms to 0 disables batching delay.
Setting linger.ms too high increases latency.
3fill in blank
hard

Fix the error in setting compression.type to improve throughput.

Kafka
props.put("compression.type", [1]);
Drag options to blanks, or click blank then click option'
A"gzip"
Bgzip
C"none"
D"snappy"
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting quotes causes a syntax error.
Using unsupported compression types.
4fill in blank
hard

Fill both blanks to create a producer config that sets max.in.flight.requests.per.connection and enables idempotence.

Kafka
props.put("max.in.flight.requests.per.connection", [1]);
props.put("enable.idempotence", [2]);
Drag options to blanks, or click blank then click option'
A5
B"true"
C"false"
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using boolean true instead of string "true" for idempotence.
Setting max.in.flight.requests.per.connection too high.
5fill in blank
hard

Fill all three blanks to configure retries, acks, and request.timeout.ms for better throughput and reliability.

Kafka
props.put("retries", [1]);
props.put("acks", [2]);
props.put("request.timeout.ms", [3]);
Drag options to blanks, or click blank then click option'
A3
B"all"
C30000
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using acks value without quotes.
Setting retries to 0 disables retries.