Kafka medium
In a high-throughput producer, what is the trade-off of increasing `linger.ms` (e.g., from 0ms to 20ms)?
- A It increases per-message latency, but significantly improves overall cluster throughput by allowing the producer to batch more messages into a single network packet and disk write.
- B It decreases both latency and throughput by forcing the CPU to work harder on encryption.
- C It increases the risk of data loss, as messages are stored in volatile RAM for longer periods without being acknowledged.
- D It disables the use of Kafka's internal compression algorithms (Snappy/Gzip).
Answer: A. It increases per-message latency, but significantly improves overall cluster throughput by allowing the producer to batch more messages into a single network packet and disk write.
`Linger.ms` essentially adds a tiny 'patience' delay. If you have 1,000 messages arriving in 10ms, `linger.ms=20` lets the producer send them all in one batch rather than 1,000 separate TCP requests, which is far more efficient for the broker and the network.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- When implementing 'Exactly-Once Semantics' (EOS) in a Kafka stream, what is the role of the `isolation.level=read_committed` setting on the Consumer?
- Historically, which external service was required by Kafka to manage cluster hierarchy, metadata, and leader election status?
- Once a message is successfully appended to a Kafka partition log, what is its mutability status?
- In a Kafka cluster, what is the role of a 'Broker'?
- What is the primary indicator of a bottleneck in a Kafka consumer's processing logic?
- What is the primary architectural role of Apache Kafka in a distributed system?