Video in progress
How many consumers in one group can read the same partition at the same time?
Only one. Within a group a partition is assigned to exactly one consumer; a single consumer, on the other hand, can read several partitions.
📖 Answer
This restriction exists to preserve the order inside a partition. If two consumers pulled from the same partition in parallel, message 10 could be processed before message 9.
In practice it works out like this:
| Partitions | Consumers | What happens |
|---|---|---|
| 4 | 2 | 2 each |
| 4 | 4 | 1 each |
| 4 | 6 | 2 of them sit idle |
So the upper limit of parallelism in a group is the number of partitions. If you need 20 parallel workers, the topic needs at least 20 partitions.
Other groups aren't affected by this limit: the analytics group can read the same partition with its own consumer without any problem.
Sign up to mark studied questions and save your progress.