- Kafka achieves low latency message delivery through Sequential I/O and Zero Copy Principle.
- Messages (events) in the Kafka are immutable and can't be changed once it's pushed (due to log based queue nature).
- The same techniques are commonly used in much other messaging/streaming platforms.
Kafka is based on Log Based Queue
- ⭐ Messages are persisted to append-only log files by the broker.
- Producers are appending these log files (sequential write) & consumers are reading a range of these files (sequential reads).
- Reading data out of Kafka is very fast thanks to
java.nio.channels.FileChannel#transferTo
. - This method uses
sendFile
system call which allows for very efficient transfer of data from a file to another file (including sockets).