Valg af en partitioneringsstrategi — hvordan events distribueres på tværs af et topics partitioner — er en vigtig Kafka-designbeslutning, der påvirker rækkefølge, parallelisme og lastfordeling. Partitionsnøglen og antallet af partitioner skal vælges omhyggeligt.
Hvordan partitionering fungerer
A producer's message goes to a partition based on:
→ with a KEY → hash(key) → determines the partition (same key → same partition consistently)
→ no key → distributed (round-robin / sticky) across partitions
→ the KEY choice determines ordering and distribution
