Scrivio Interview library
DesignAdvanced7 min read · updated 13 November 2026

A cluster keeps 14 days of data on broker disks, 900 TB in total with replication factor 3, and teams want 90 days.

Design the move to tiered storage: which topics, what local retention, what changes for broker replacement and partition reassignment, and what can go wrong.

We enable tiered storage topic by topic, starting with the largest delete-policy topics and leaving compacted topics local, with local.retention.ms covering normal consumer lag (one or two days) and retention.ms set to 90 days. Local disk needs fall sharply, the remote store holds one copy of each segment, and broker replacement and reassignment get much faster because only the local window is copied. The risks are object storage costs, an upload backlog that fills local disks, remote outages that make old data unreadable and plugin maturity, so we roll out gradually, monitor upload lag and remote errors, and rehearse a remote outage.

Why this question is asked

Moving from 14 to 90 days of retention the old way would mean multiplying 900 TB of broker disk by more than six, and every broker rebuild would copy even more data. Tiered storage makes the request affordable, but it changes how the cluster fails and how it is operated. Interviewers ask this design question to see whether we can plan a migration with numbers, think about operations as well as storage, and name what can go wrong. In this answer, we will work out today's numbers, choose topics and retention settings, size local and remote storage, see what changes for broker replacement and reassignment, and then go through risks and the rollout.

1Today's Numbers

900 TB across the cluster with replication factor 3 is 300 TB of unique data for 14 days, about 21 TB of new data per day. Keeping 90 days the old way would need 21 x 90 x 3, about 5.8 PB of broker disk. That is the figure tiered storage lets us avoid.

A quick recap of the feature: with tiered storage, closed segments are uploaded by the partition leader to remote object storage through a RemoteStorageManager plugin, local copies are deleted after local.retention.ms, and consumers reading older offsets are served from the remote store. retention.ms still sets the total lifetime of the data.

2Which Topics and What Retention

Tiering is enabled per topic with remote.storage.enable=true, after the brokers have the remote log subsystem and plugin configured. We start with the largest topics whose cleanup.policy is delete, because they hold most of the bytes; often ten or twenty topics account for most of the 900 TB. Compacted topics cannot be tiered and are usually small, so they stay local, as do Kafka's internal topics.

local.retention.ms should cover the lag that consumers normally have, plus a margin for an outage of a downstream system. If consumers are normally minutes behind and the longest realistic outage of a consumer is a day, one to two days local is a good default. Readers that go further back accept remote latency. We set retention.ms to 90 days.

Text
kafka-configs.sh --bootstrap-server broker1:9092 --alter --entity-type topics \
--entity-name payments-events \
--add-config remote.storage.enable=true,local.retention.ms=172800000,retention.ms=7776000000
# Completed updating config for topic payments-events. (2 days local, 90 days total)
# Low-traffic topics: roll segments sooner so they can upload
kafka-configs.sh ... --entity-name audit-events --add-config segment.ms=21600000 # 6 hours

3Sizing Local and Remote Storage

Remote storage holds one copy of each segment, because the object store provides its own durability. For 90 days that is about 21 x 90 = 1.9 PB of object storage. Local storage holds the local window three times over: 21 TB x 2 days x 3 replicas = about 126 TB, compared with 900 TB today.

We do not size local disks to exactly that figure. A segment is deleted locally only after it is uploaded, so if uploads stall, local data grows by 63 TB per day of backlog (21 TB times three replicas). We add room for at least one day of upload backlog, plus the untiered compacted topics, plus 30 percent general headroom, which lands somewhere around 300 TB. That still frees most of today's disks.

Storage before and after (about 21 TB of new data per day)
ItemToday: 14 days localTarget: 90 days tiered
Local data (RF 3)900 TB~126 TB (2 days)
Upload backlog bufferNot needed~63 TB (1 day)
Local disk planned with headroom~1.2 PB~300 TB
Remote object storageNone~1.9 PB, one copy
Data copied to rebuild a broker~22 TB~3 TB
The rebuild figure assumes 40 brokers sharing local data evenly.

4What Changes for Broker Replacement and Reassignment

Today, replacing a failed broker means copying its whole share of 14 days, about 22 TB with 40 brokers, from other replicas, which takes many hours under a replication throttle. With tiering, a new replica copies only the local window; the older history is already in remote storage and does not move. So rebuilds and partition reassignments become several times faster, and adding brokers to rebalance load becomes a routine operation instead of a weekend project.

Two details matter. First, a replica that becomes leader takes over the job of uploading, using the remote log metadata to know what has already been copied. Second, our reassignment tooling and throttle settings were tuned for the old data volumes; we revisit them so we do not leave rebuilds needlessly slow.

5What Can Go Wrong

Cost: object storage is cheap per GB, but requests and transfer are billed too. Uploads are a modest number of large PUTs, but replays with small fetches create many GETs, and a bucket in another region adds transfer charges. We model cost with real replay patterns before promising savings.

Upload backlog: if remote writes slow down or fail, segments that are not yet uploaded stay local, and disks fill at three times the ingest rate. That is the most dangerous failure, because a full disk takes the broker down. Remote outage: while the store is unavailable, data older than the local window cannot be read, so replays fail even though Kafka itself is healthy. Plugin maturity: the remote storage plugin is code from outside Apache Kafka, and its bugs, upgrade path and support become our concern.

6Rolling Out Safely

We enable tiering on one large but non-critical topic first, watch it for a few weeks, then move topic by topic. We add alerts for upload lag (time or bytes since the oldest segment that should have been uploaded), remote copy and fetch error rates, remote read latency, and local disk usage against the upload backlog budget. We lower total retention to 90 days only after uploads have been reliable.

Before the critical topics move, we rehearse a remote storage outage in staging: block access to the bucket, confirm that producers and tail consumers continue normally, measure how fast local disks fill, and write the runbook for that case, including when to temporarily extend local disk or pause the noisiest producers.

7Follow-up questions

How would you size the remaining local disks?

Start from the local window: daily ingest times local retention days times the replication factor, here 21 TB x 2 x 3, about 126 TB. Add the untiered topics, an upload backlog buffer of at least one day of ingest times the replication factor (about 63 TB), and 30 percent headroom for uneven partitions and reassignments. That gives roughly 300 TB across the cluster. Then check it against the time we need to fix a remote outage; if that is longer than a day, the buffer must grow.

Can consumers tell whether data came from local or remote storage?

Not from the API. They see the same records and offsets. They notice only through latency and throughput, which is why teams that replay old data should be told about the new behaviour and given measured numbers.

What happens to existing data when tiering is turned on for a topic?

Closed segments that already exist become eligible for upload, and once uploaded, those older than local.retention.ms are deleted locally. On a large topic that is a burst of upload traffic, so we enable topics one at a time and watch the upload rate.

8Conclusion

In this answer, we planned the move from 14 days local to 90 days tiered: about 21 TB of new data per day, large delete-policy topics tiered first with one or two days local, compacted topics left alone, roughly 300 TB of local disk including an upload backlog buffer and about 1.9 PB of single-copy object storage. Broker rebuilds and reassignments become much faster. The risks are cost, upload backlog, remote outages and plugin maturity, so we roll out gradually with alerts and a rehearsed outage.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start with the numbers. 900 TB with replication factor 3 is 300 TB unique for 14 days, about 21 TB a day. Doing 90 days the old way would be close to 6 PB of broker disk, which is why we want tiered storage.

Then, if they want more

I would enable it per topic, starting with the biggest delete-policy topics, since a handful usually hold most of the bytes. Compacted topics can't be tiered and stay local. For each topic I set local.retention.ms to cover normal consumer lag plus a realistic outage, say one or two days, and retention.ms to 90 days.

Remote storage then holds one copy, about 1.9 PB, because the object store has its own durability. Locally we need about 126 TB for two days times three replicas, but I would plan about 300 TB, because segments are only deleted locally after upload, so an upload stall fills disks at three times ingest.

A big operational win is that replacing a broker or reassigning partitions only copies the local window, a few TB instead of over 20. The risks: request and transfer costs, upload backlog filling disks, a remote outage making old data unreadable, and the plugin's maturity.

So I would roll out one topic at a time, alert on upload lag, remote errors and disk usage, and rehearse a bucket outage in staging before moving critical topics.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Apache Kafka documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Design the move to tiered storage: which topics, what local retention, what changes for...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-internals/88f5c4a955/