What is a partition in a log-based system, and why have more than one?
Sketch your own answer first, then compare it with the one below.
A strong answer
A partition is one ordered, append-only slice of a topic. Each message gets an offset in its partition. Several partitions let many consumers read in parallel and let producers write to several machines.
One partition is one line with one reader, so its throughput is limited to what a single consumer can handle. With more partitions the topic scales out.
Order holds inside a partition, not across partitions. The partition count also sets how many consumers in a group can work at once.
Sources
- Jay Kreps, Neha Narkhede, Jun Rao (2011). Kafka: a distributed messaging system for log processing.
- Martin Kleppmann (2017). Designing Data-Intensive Applications.