Video in progress

What is tiered storage, and how does it change decisions about keeping data in Kafka for a long time?

Tiered storage (KIP-405; early access in Kafka 3.6, production-ready since 3.9) moves old segments to object storage like S3, leaving only the recent part on the broker's disk. Retention of months or years gets cheaper and adding or replacing brokers gets faster, but reading old data is slower.

📖 Answer

Before, if you needed long retention, there were two ways: put very large disks on the brokers (expensive, and replication takes hours when a broker dies) or sink the data to S3 separately and build another path for replay.

With tiered storage:

# broker
remote.log.storage.system.enable=true
# topic
remote.storage.enable=true
local.retention.ms=21600000     # 6 hours on local disk
retention.ms=7776000000         # 90 days in total

Nothing changes for the consumer: it reads by offset just as before, and if needed the broker fetches the data from remote.

What changes:

  • Brokers get "lighter": the local disk is small, and when a broker is replaced only a few hours of data are copied. Scaling and rebalancing get faster.
  • Replay is cheap: filling a new service from 90 days of history, or reprocessing after a bug, without a separate pipeline.
  • Cost: object storage is much cheaper than disk, but GET requests and cross-region traffic cost money.

Limits and things to watch: compacted topics aren't supported; the first-byte latency when reading old data is noticeable; in open-source Kafka you need a separate remote storage plugin (RSM), which depends on the vendor. And reading a large volume of old data can occupy the broker's thread pools and affect real-time consumers, so that also needs to be limited with quotas.

I don't treat this as a reason to decide "Kafka is a data store": for analytical queries you still need a data lake. But it's very useful for stretching the "replay window" from days to months.