パーティションキーとは?
パーティションキーは、システムがハッシュ化してメッセージや行を複数のパーティションのいずれかに割り当てるためのフィールドです。同じキーを持つすべての項目は同じパーティションに入り、相対的な順序がそのまま保たれます。キーをうまく選ぶことで、関連するレコードをまとめつつ負荷を均等に分散できます。
なぜ重要か
パーティションキーは、作業がどれだけ均等に分散されるかと、どのメッセージがまとまって順序付けされるかの両方を決めます。偏ったキーはホットパーティションを生み、誤ったグルーピングは consumer が依存する順序を壊します。
関連ガイド
What Is Message Ordering?Message ordering is the guarantee about the sequence in which a messaging system delivers messages, often pre…
What Is a Consumer Group?A consumer group is a set of consumers that share the work of reading a topic, with each partition assigned t…
What Is a Kafka Offset?A Kafka offset is the sequential position of a message within a partition, used by consumers to track which r…