内部的には、Kafka はデータを 追記専用(append-only)ログ としてディスク上に(セグメントで構成して)保存し、効率的な I/O 技術を用い、クラスターのメタデータを ZooKeeper(歴史的に)または KRaft(現在)を介して管理します。内部構造を理解することで、Kafka の挙動とパフォーマンスへの理解が深まります。
コミットログのストレージ
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)
