Kafka はイベントを保持し、設定可能な期間またはサイズの間、パーティションログにイベントを保持します。消費後もイベントが削除されないため、リプレイと複数のコンシューマーが可能になります。保持とログ管理の理解は、Kafkaを使用し、ストレージを管理する上で重要です。
保持 — イベントは保持される
Unlike traditional queues, Kafka RETAINS events (doesn't delete on consumption):
→ events stay in the partition log for a configured RETENTION period (e.g. 7 days) or
SIZE limit
→ enables: REPLAY (re-read history), multiple consumers reading independently, late
consumers catching up
→ after retention expires → old segments are deleted (or compacted)
→ Kafka is a durable LOG, not just a transient queue
保持設定
→ TIME-based → retention.ms (keep events for N time, e.g. 7 days)
→ SIZE-based → retention.bytes (keep up to N bytes per partition)
→ configured per topic; events past the limit are removed (oldest first)
→ choose based on replay needs, consumer lag tolerance, and storage capacity
