การเลือก partitioning strategy — วิธีที่ events ถูกกระจายไปยัง partition ต่าง ๆ ของ topic — เป็นการตัดสินใจด้านการออกแบบ Kafka ที่สำคัญซึ่งส่งผลต่อ ordering, parallelism และ load distribution partition key และจำนวนต้องเลือกอย่างระมัดระวัง
partitioning ทำงานอย่างไร
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
