Å velge en partisjonieringsstrategi — hvordan hendelser distribueres over en topics partisjoner — er en viktig Kafka-designbeslutning som påvirker ordning, parallellisme og lastfordeling. Partisjonnøkkelen og antallet partisjoner må velges nøye.
Hvordan partisjonering 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
