Introduction
Kafka retention policies control how long or how much data is kept in a topic. This helps manage disk space and ensures old data is removed automatically.
When you want to keep messages only for a certain number of hours or days to save disk space.
When you want to limit the total size of data stored in a topic to avoid filling up your server.
When you need to automatically delete old messages after a set time without manual cleanup.
When you want to keep data until it reaches a size limit, then remove the oldest messages first.
When you want to balance between data availability and storage costs by controlling retention.