Storage Retention Replicas and Backup Budgets

Back of the Envelope Estimation · 35 min

System Design · Module 4 · Lesson 2 of 4 · 35 min

Storage Retention Replicas and Backup Budgets

Calculate logical data size, distinguish data copies from backups, and account for indexes logs and operational free space.

Retained logical bytes are the starting point; physical capacity also needs explicit overhead, recovery and growth budgets.

01 The idea

The problem this lesson solves

10,000 × 500 = 5,000,000 logical bytes per day.

Prerequisite: earlier lessons introduce the vocabulary and shared examples used here. Follow the module order.

RetentionHow long the product keeps a class of data.
Logical sizeThe modeled application data size before physical storage overhead.
BackupRetained recovery data used to restore a prior state under a defined policy.

02 Worked example

Follow one worked example

Storage Retention Replicas and Backup Budgets worked diagram01Daily recordsCount × bytes02RetentionDays retained03Live copiesReplica multiplier04Recovery budgetBackups + logsKeep the units and assumptions visible at each step.Storage Retention Replicas and Backup Budgets compact diagram01Daily recordsCount × bytes02RetentionDays retained03Live copiesReplica multiplier04Recovery budgetBackups + logs
Daily records: Count × bytes • Retention: Days retained • Live copies: Replica multiplier • Recovery budget: Backups + logs.

Trace the example in order. Follow the same identities, units and state transitions through the diagram and the events below.

1
Count new data10,000 × 500 = 5,000,000 logical bytes per day.
2
Apply retention365 days produces 1.825 GB of logical data.
3
Add copiesThree live copies produce 5.475 GB before overhead.
4
Budget operationsAdd indexes, logs, backups and free space as separately stated assumptions.

Retained logical bytes are the starting point; physical capacity also needs explicit overhead, recovery and growth budgets.

03 The method

Mechanisms decisions and a guided tutorial

Work through the explanation in order, then apply it in the tutorial. Each comparison names a cost as well as a benefit.

Choice or conceptPurposeBoundary or cost
Logical dataRows × payload × retentionBefore engine overhead
Live replicasAdditional data copiesNot historical recovery by themselves
Indexes and logsServing and durability structuresMeasure their growth
BackupsRestore prior stateRetention and restore time matter

Compute retained logical storage

10,000 links/day × 500 bytes/link × 365 days = 1,825,000,000 bytes, or 1.825 GB for one year. Three full copies require 5.475 GB of data copies before index, row, free-space, log and backup overhead. Backups and replicas serve different purposes; do not assume three replicas protect against an accidental delete that is replicated to all three. If a row expires, state whether deletion is immediate and whether old backups retain it.

Choose the unit and the lifecycle

Ten thousand links per day at 500 bytes each produce five million logical bytes per day. For 365 retained days, that is 1.825 billion bytes, or 1.825 decimal GB. Three data copies contain 5.475 GB before other costs. This arithmetic models steady accumulation for one year with no early deletes.

State decimal or binary units. Decimal GB uses one billion bytes; GiB uses 2^30 bytes. Never change conventions between row sizing and the final number. If links expire after thirty days instead of a year, retention changes the logical dataset even when request QPS remains the same.

Physical storage has several owners

Rows have metadata, alignment and storage-engine overhead. Indexes occupy their own structures. Write-ahead logs, temporary sort space, compaction or maintenance work and reserved free space consume capacity beyond the logical payload. A replica multiplies the relevant live structures, but backup retention has a separate lifecycle.

Measure row and index size on representative data rather than inventing a universal multiplier. When assumptions are necessary, list them as separate line items. A transparent approximate budget is more useful than one confident total whose hidden overhead cannot be revised.

Recovery requirements change the budget

Replicas can improve serving or failover options, but an accidental deletion can be copied to them. Backups and retained logs may recover an earlier state, provided the restore process is tested and meets the required time. A backup file existing is not evidence of a successful restore.

Retention must also describe old backups. Deleting a row from the live table does not immediately erase every retained backup copy. For design arithmetic, state when old data stops consuming each storage tier and how growth, migrations and rollback copies affect peak physical usage.

Guided tutorial

1. Write the lifecycle

Choose creation rate, row size, retained days and deletion timing.

2. Build line items

Separate logical rows, indexes, replica copies and backups.

3. Change retention

Compare 30 days with 365 days while leaving traffic unchanged.

4. Plan a restore test

State the data-loss window and recovery time you must verify.

logical_bytes = writes_per_day * bytes_per_record * retained_days
live_data_copies = logical_bytes * copy_count
physical_budget = live_data_copies + index_copies + logs + free_space
backup_budget = separately modeled retained recovery data
# decimal GB = bytes / 1_000_000_000

04 Cheat sheet

Review the decisions

Use this table to explain the mechanism and its limit without memorizing a product name.

Choice or conceptRememberCheck
Logical dataRows × payload × retentionBefore engine overhead
Live replicasAdditional data copiesNot historical recovery by themselves
Indexes and logsServing and durability structuresMeasure their growth
BackupsRestore prior stateRetention and restore time matter
RetentionHow long the product keeps a class of data.
Logical sizeThe modeled application data size before physical storage overhead.
BackupRetained recovery data used to restore a prior state under a defined policy.

05 Where & why

Check the primary references

Use official references for protocol and implementation details. The questions here are teaching prompts.

Primary reference
Google SRE overload handling

Read Google SRE overload handling

Primary reference
Google SRE service-level objectives

Read Google SRE service-level objectives

State the implementation version and the workload assumptions when defending your own design.

06 Interview questions

Explain the reasoning out loud

Answer before opening the explanation. The questions progress from vocabulary to decisions and failure behavior.

What does Retention mean?
How long the product keeps a class of data.
What does Logical size mean?
The modeled application data size before physical storage overhead.
What does Backup mean?
Retained recovery data used to restore a prior state under a defined policy.
Does a replica replace a backup?
No. It can reproduce a bad write or delete. Historical recovery requires retained data and a tested restore path.
Why separate logical and physical size?
The application payload is only part of the storage engine’s footprint. Separate line items make overhead assumptions visible and revisable.
Does longer retention increase QPS automatically?
No. It increases stored data for the same creation stream. Query cost or workload may change, but that is a separate assumption.
Why budget migration space?
During a migration, old and new copies or indexes may coexist. Peak disk use can exceed the final steady-state size.
What proves a backup is useful?
A successful restore and recovery test against the required data-loss and time objectives, not only the presence of a file.

07 Practice problems

Practice a new case

Solve the new cases before revealing hints. Complete worked solutions follow the set.

Daily size

Easy
Size 2,000 records/day at 250 bytes each in bytes/day.
Follow-up
State the assumption or edge case that makes the answer correct.
Show the hint
Multiply count by payload.

Unit convention

Easy
Explain the difference between GB and GiB in a capacity memo.
Follow-up
State the assumption or edge case that makes the answer correct.
Show the hint
One uses decimal, the other powers of two.

Retention budget

Medium
Size 50,000 records/day at 400 bytes each for 180 days and three copies in decimal GB.
Follow-up
Report logical storage and replicated data separately.
Show the hint
Multiply days before copies.

Retention change

Medium
Find logical storage for 20 MB/day retained for 45 days.
Follow-up
State the assumption or edge case that makes the answer correct.
Show the hint
The daily unit remains MB.

Concurrent copies

Medium
A migration keeps two 8 GB datasets and builds a 2 GB index; find this modeled peak.
Follow-up
State the assumption or edge case that makes the answer correct.
Show the hint
Include the old copy until rollback retention ends.

Recovery design

Hard
Explain how a service with three replicas recovers an accidental table delete and what extra data it needs.
Follow-up
State the assumption or edge case that makes the answer correct.
Show the hint
The delete may reach every live copy.

Worked solutions

1. Daily size

500,000 logical bytes/day.

2. Unit convention

GB is 10^9 bytes; GiB is 2^30 bytes. State the convention and use it consistently.

3. Retention budget

Logical storage is 50,000 × 400 × 180 = 3.6 billion bytes = 3.6 GB. Three data copies are 10.8 GB, excluding indexes, logs and backups.

4. Retention change

900 MB of logical payload under the stated decimal-unit model, before overhead.

5. Concurrent copies

18 GB before logs, free space and other existing structures.

6. Recovery design

Use retained backups/logs and a tested restore procedure to recover a prior state. State the recovery point, permitted data loss, restore time, and how writes during recovery are handled.