How is reading from a log like Kafka different from reading from a traditional queue?
Sketch your own answer first, then compare it with the one below.
A strong answer
A queue removes a message once a consumer acknowledges it. A log keeps it. Reading only moves the consumer's position, the offset, forward.
That has three consequences. First, several independent consumers, or groups, can read the same data at their own pace, because each keeps its own position. Second, a consumer can go back and read again, to rebuild a table or to recover from a bug. Third, deletion is by retention (age or size), not by acknowledgement, so a slow consumer can lose data if it falls behind the window.
Ordering is also different. A queue with many consumers loses order, while a log keeps order inside each partition and gives each partition to one consumer in a group.
The cost is that the consumer is responsible for tracking progress, and a crash repeats whatever came after the last commit.
Sources
- Jay Kreps, Neha Narkhede, Jun Rao (2011). Kafka: a distributed messaging system for log processing.
- Martin Kleppmann (2017). Designing Data-Intensive Applications.