AdvancedPerformance
How does Kafka handle backpressure from slow consumers?
Reference answer
Kafka does NOT have server-side backpressure — the broker doesn't throttle producers based on consumer lag. Backpressure is handled client-side: 1) Producer: buffer.memory fills up → max.block.ms timer starts → producer blocks/throws if buffer doesn't free within max.block.ms. 2) Consumer: controls its own fetch rate via max.poll.records and fetch timing. 3) Kafka Streams: applies backpressure within its topology via bounded queues between operators. 4) Quota enforcement: broker-side byte-rate quotas (quota.producer.default) can throttle specific clients.
Expected key concepts: backpressure, buffer.memory, max.block.ms, block, max.poll.records, bounded queues, Kafka Streams, quota, quota.producer.default, throttle