Amy Boyle shares some thoughts on Kafka partitioning strategy:
If you have enough load that you need more than a single instance of your application, you need to partition your data. The producer clients decide which topic partition data ends up in, but it’s what the consumer applications will do with that data that drives the decision logic. If possible, the best partitioning strategy to use is random.
However, you may need to partition on an attribute of the data if:
-
The consumers of the topic need to aggregate by some attribute of the data.
-
The consumers need some sort of ordering guarantee.
-
Another resource is a bottleneck and you need to shard data.
-
You want to concentrate data for the efficiency of storage and/or indexing.
Good advice.