ภายใน Kafka จัดเก็บข้อมูลเป็น append-only log บน disk (จัดเรียงเป็น segment) ใช้เทคนิค I/O ที่มีประสิทธิภาพ และจัดการ metadata ของ cluster ผ่าน ZooKeeper (ในอดีต) หรือ KRaft (ปัจจุบัน) การเข้าใจการทำงานภายในช่วยให้เข้าใจพฤติกรรมและ performance ของ Kafka ลึกขึ้น
การจัดเก็บแบบ commit log
Each partition is an append-only LOG stored on disk, split into SEGMENTS (files):
→ new events are APPENDED to the end (sequential writes → fast)
→ events are immutable once written; identified by OFFSET
→ old segments are deleted (retention) or compacted
→ an INDEX maps offsets to file positions (fast lookups)
→ the append-only log is the core of Kafka's design (durable, sequential, efficient)
