On this page
Kafka Improvement Proposal
KIP-405: tiered storage, old segments in object storage
KIP-405 lets a Kafka broker move closed log segments to cheaper remote storage, such as S3, and keep only the recent part of each partition on local disk. Consumers still read any offset the same way; the broker fetches old data from the remote tier when needed. Long retention stops being a disk-sizing problem.
- Proposal
- KIP-405, Kafka Tiered Storage
- Status
- Shipped Early access in Kafka 3.6, production-ready since 3.9.
- Area
- Storage
- Proposal page
- KIP-405 on the Apache Kafka wiki
Why it was needed
Without tiered storage every byte a topic retains lives on the brokers' local disks, replicated to every replica. Keeping a month or a year of data means buying disks for it, and adding or replacing a broker means copying all of it over the network before the new broker is useful. Retention, cost and recovery time were all tied to the size of the local log.
What it changes
A topic with remote.storage.enable=true has two retention limits. local.retention.ms and local.retention.bytes say how much stays on the broker; retention.ms and retention.bytes say how much exists in total. The leader copies each closed segment to remote storage through a RemoteStorageManager plugin, and segments that are in the remote tier and past the local limit are deleted locally. A fetch below the local log start offset is served from remote storage.
How to use it
- Turn it on for the cluster with remote.log.storage.system.enable=true and configure a RemoteStorageManager plugin for your object store.
- Turn it on per topic with remote.storage.enable=true, then set local.retention.ms or local.retention.bytes for the hot part.
Where it stands
Early access in Kafka 3.6 and production-ready in Kafka 3.9. It is off unless the cluster and the topic turn it on. Compacted topics are not supported, and Apache Kafka ships the plugin interface rather than a production plugin for a specific object store.
What comes next
Kafka 4.3 and 4.4 added tuning on top, such as KIP-1241. Under discussion: KIP-1176, tiered storage for the active segment, and KIP-1272, tiered storage for compacted topics. Diskless topics (KIP-1150) go further and write new data straight to object storage.
See it in the simulator
- Kafka tiered storage: offloading old segments to remote (Tiered storage) Step 3: Old prefix offloaded to remote Open at this step: Kafka tiered storage: offloading old segments to remote
- Kafka tiered storage: a consumer reads from the remote tier (Reading from the remote tier) Step 4: Poll from offset 0 - served from remote Open at this step: Kafka tiered storage: a consumer reads from the remote tier
- Kafka local.retention.ms vs retention.ms in tiered storage (Local vs total retention) Step 1: Tiered topic · two retention windows Open at this step: Kafka local.retention.ms vs retention.ms in tiered storage