Consumer throughput is the rate at which a Kafka consumer reads and processes messages from Kafka topics.
Click to reveal answer
intermediate
How does increasing the number of consumer threads affect throughput?
Increasing consumer threads can improve throughput by parallelizing message processing, but too many threads may cause contention and reduce performance.
Click to reveal answer
intermediate
What role does 'fetch.min.bytes' play in consumer throughput?
'fetch.min.bytes' sets the minimum amount of data the consumer fetches in one request, helping to batch messages and improve throughput by reducing network calls.
Click to reveal answer
intermediate
Why is 'max.poll.records' important for throughput optimization?
'max.poll.records' controls how many records a consumer fetches per poll. Increasing it can improve throughput by processing more messages at once, but may increase processing latency.
Click to reveal answer
advanced
How does enabling consumer 'async commit' affect throughput?
Async commit allows the consumer to commit offsets without blocking message processing, increasing throughput by reducing wait times.
Click to reveal answer
Which Kafka consumer setting controls the maximum number of records returned in a single poll?
Amax.poll.records
Bfetch.min.bytes
Csession.timeout.ms
Dauto.offset.reset
✗ Incorrect
'max.poll.records' sets the maximum number of records returned in one poll call.
What happens if 'fetch.min.bytes' is set too high?
Hint: Large batch size boosts throughput but may add latency [OK]
Common Mistakes:
Assuming latency always decreases with throughput
Ignoring fetch.min.bytes impact
Confusing max.poll.records with fetch.max.bytes
4. You notice your Kafka consumer is lagging and not processing messages fast enough. Which of the following configuration mistakes could cause this issue?
medium
A. Setting max.poll.records too low, like 1
B. Setting fetch.min.bytes to 1
C. Setting max.poll.interval.ms to a very high value
D. Setting enable.auto.commit to true
Solution
Step 1: Understand impact of low max.poll.records
Setting it to 1 means the consumer fetches only one record per poll, severely limiting throughput and causing lag.
Step 2: Evaluate other options
Setting fetch.min.bytes to 1 reduces wait time, high max.poll.interval.ms delays rebalance but doesn't reduce throughput, and auto commit true is normal behavior.
Final Answer:
Setting max.poll.records too low, like 1 -> Option A
Quick Check:
Too small batch size causes lag [OK]
Hint: Too small max.poll.records limits throughput [OK]
Common Mistakes:
Confusing fetch.min.bytes effect
Thinking auto commit affects speed directly
Ignoring batch size impact
5. You want to optimize a Kafka consumer for high throughput but low latency. Which combination of settings is best?
hard
A. Set both max.poll.records and fetch.min.bytes to high values
B. Set max.poll.records low (e.g., 10) and fetch.min.bytes high (e.g., 1048576)
C. Set max.poll.records high (e.g., 1000) and fetch.min.bytes low (e.g., 1)
D. Set both max.poll.records and fetch.min.bytes to low values
Solution
Step 1: Understand throughput and latency tradeoff
High max.poll.records allows processing many records per poll, increasing throughput.
Step 2: Understand fetch.min.bytes effect on latency
Low fetch.min.bytes means the consumer fetches data quickly without waiting for large batches, reducing latency.
Step 3: Combine settings for desired effect
High batch size with low fetch size balances high throughput and low latency.
Final Answer:
Set max.poll.records high (e.g., 1000) and fetch.min.bytes low (e.g., 1) -> Option C