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.
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.
02 Worked example
Follow one worked example
Trace the example in order. Follow the same identities, units and state transitions through the diagram and the events below.
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 concept | Purpose | Boundary or cost |
|---|---|---|
| Logical data | Rows × payload × retention | Before engine overhead |
| Live replicas | Additional data copies | Not historical recovery by themselves |
| Indexes and logs | Serving and durability structures | Measure their growth |
| Backups | Restore prior state | Retention 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_00004 Cheat sheet
Review the decisions
Use this table to explain the mechanism and its limit without memorizing a product name.
| Choice or concept | Remember | Check |
|---|---|---|
| Logical data | Rows × payload × retention | Before engine overhead |
| Live replicas | Additional data copies | Not historical recovery by themselves |
| Indexes and logs | Serving and durability structures | Measure their growth |
| Backups | Restore prior state | Retention and restore time matter |
05 Where & why
Check the primary references
Use official references for protocol and implementation details. The questions here are teaching prompts.
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?
What does Logical size mean?
What does Backup mean?
Does a replica replace a backup?
Why separate logical and physical size?
Does longer retention increase QPS automatically?
Why budget migration space?
What proves a backup is useful?
07 Practice problems
Practice a new case
Solve the new cases before revealing hints. Complete worked solutions follow the set.
Daily size
EasyShow the hint
Unit convention
EasyShow the hint
Retention budget
MediumShow the hint
Retention change
MediumShow the hint
Concurrent copies
MediumShow the hint
Recovery design
HardShow the hint
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.