Why is Kafka so fast?
Kafka achieves high throughput through: Sequential I/O on disk, zero-copy data transfer, batching of messages, efficient data format, and partitioning for parallel processing.
What is the role of batching in Kafka performance?
Producers batch multiple messages together before sending, reducing the number of network round trips. This significantly increases throughput at the cost of slight latency increase.
How does Kafka handle backpressure?
Kafka handles backpressure naturally through its pull-based consumer model. Consumers process at their own pace, so fast producers don’t overwhelm slow consumers (within retention limits).
What is the relationship between partitions and consumers?
In a consumer group, each partition is consumed by exactly one consumer. The maximum parallelism for a topic is equal to the number of partitions. More partitions = more potential consumers.