Files
supply/book/ch06_storage_modeling.md
T
charles 6a19012f84 Add storage modeling chapter
Update the summary and renumber the bibliography chapter.
2026-05-19 14:21:42 -07:00

101 lines
7.4 KiB
Markdown

# Storage Modeling: The Translation of Virtual Demand to Physical Reality
In the preceding chapters, we explored how compute resources are virtualized and matched to demand. However, storage presents a unique challenge in the supply chain: it is the most "persistent" of resources, and its physical reality is often far removed from the simple "1 GiB" requested by a user.
To understand the storage supply chain is to understand the translation layer—the complex machinery that converts a logical request for data persistence into a specific allocation of disk, RAM, and CPU across a global fleet.
## 1. Virtual Storage Abstraction
When a user requests 1 GiB of storage in a system like Google Cloud Storage (GCS), they are not interacting with a disk, but with a **virtual abstraction**. This abstraction decouples the perception of data from its physical residency.
### Object-Based Addressing
Unlike traditional block devices, where data is addressed by sectors, cloud storage is modeled as *objects* within *buckets*. A 1 GiB file is not stored as a contiguous block but is broken into smaller, manageable chunks. These chunks are distributed across a fleet of physical storage servers, allowing the system to scale horizontally and avoid the bottlenecks of any single physical device.
### The Virtualization Layer
The mapping between these logical objects and physical disk locations is managed by a distributed file system layer (such as Colossus). This layer handles the "grunt work" of the supply chain:
- **Bad Sector Management**: Transparently routing around failing disk regions.
- **Load Balancing**: Ensuring no single physical server becomes a "hotspot."
- **Chunking and Sharding**: Splitting data to optimize for both parallel access and failure resilience.
In this model, the "product" being sold is not disk space, but *durability and availability*.
## 2. The SLO Spectrum: Economic Heat and Storage Classes
Not all storage is created equal. Because the physical cost of maintaining data varies wildly based on how often it is accessed, providers use **Storage Classes** to create an economic model for data "heat."
### The Trade-off Matrix
Providers offer a spectrum of classes (Standard, Nearline, Coldline, Archive) that allow users to trade off at-rest costs against retrieval fees.
| Class | Ideal Use Case | Access Frequency | Min Duration | Retrieval Cost |
| :--- | :--- | :--- | :--- | :--- |
| **Standard** | Hot data, active apps | High | None | Free |
| **Nearline** | Backups, monthly reports | Low ($\approx$ 30 days) | 30 days | Low |
| **Coldline** | Disaster recovery | Very Low ($\approx$ 90 days) | 90 days | Medium |
| **Archive** | Long-term vault | Rare ($\approx$ 365 days) | 365 days | High |
### The "Economic Heat" Model
In a traditional supply chain, "hot" inventory is kept in the most accessible part of the warehouse. In cloud storage, "heat" is managed via **Retrieval Fees**.
Instead of physically moving data between different disk types in real-time (which would be computationally expensive), the system uses pricing as a lever. Data in the `Archive` class costs very little to store but is expensive to retrieve. This discourages the use of cold storage for active workloads, effectively using economic signals to optimize the physical placement of data.
## 3. From Virtual to Physical: The Translation Layer
The most critical gap in the storage supply chain is the translation from a "virtual GiB" to "physical raw disk." To achieve "eleven nines" of durability, providers cannot rely on simple mirroring (which would require 3x the physical space). Instead, they use **Erasure Coding (EC)**.
### Erasure Coding and the Overhead Formula
Erasure coding splits data into $k$ data fragments and $m$ parity fragments. The physical footprint of any virtual request is determined by this ratio:
$$\text{Physical Overhead} = \frac{k + m}{k}$$
For example, in a **(10, 4) scheme**, 1 GiB of logical storage consumes **1.4 GiB of raw physical disk**. This allows the system to survive the simultaneous loss of any 4 fragments without data loss, providing far greater durability than simple replication with significantly less overhead.
### The Physical Reality of the "Bit"
When a user writes a "bit" to the cloud, the supply chain triggers a series of physical events:
1. The data is chunked and erasure-coded.
2. Fragments are dispatched across different "Failure Domains" (different racks or zones).
3. The metadata service records the precise physical location of each fragment.
4. Checksums are calculated and stored to detect "bit rot" over time.
## 4. Complementary Resource Requirements: The CPU/RAM Tax
Storage does not exist in a vacuum. Every GiB of disk requires a corresponding "tax" of compute and memory to manage it. This creates a **complementary resource dependency**.
### The Metadata and Cache Tax (RAM)
RAM is consumed primarily by the metadata index (the map of where chunks live) and I/O buffer caches.
- **Metadata Footprint**: The memory required scales with the *number of objects* rather than the total volume.
- **Buffer Management**: Higher-performance tiers (Standard) allocate more RAM for caching "hot" data to reduce disk seek latency.
### The Computational Tax (CPU)
CPU cycles are consumed by:
- **Integrity Checks**: Calculating CRC32 or SHA-256 checksums.
- **EC Encoding/Decoding**: The intensive process of calculating parity during writes and reconstructing data during disk failures.
- **Encryption**: Handling AES encryption at rest.
### The "Metadata Wall"
A failure in planning these complementary resources leads to the "metadata wall." If a provider adds 10 PB of disk but fails to increase the RAM of the metadata servers, the index will no longer fit in memory. The system then falls back to disk-based metadata lookups, causing a catastrophic spike in latency.
Typical planning ratios include:
- **Storage Density**: e.g., 1 CPU core per 10-20 TB of raw disk.
- **Memory Buffers**: e.g., 1:160 RAM-to-Disk ratio for warm storage nodes.
## 5. Infrastructure TCO and Physical Lifecycle
The final stage of the storage supply chain is the management of the physical hardware's lifecycle, focusing on Total Cost of Ownership (TCO) and physical wear.
### TCO Modeling
TCO is modeled across a 3-to-5-year lifecycle:
$$\text{TCO} = \text{CapEx (Hardware)} + \text{OpEx (Power + Cooling + Labor)} + \text{Maintenance (Replacements)}$$
Archive storage reduces CapEx by using high-density HDDs or Tape and reduces OpEx by spinning down disks, which allows the provider to offer lower per-GB prices while offsetting the higher CPU/Network cost of retrieval.
### Wear Leveling and Write Amplification
For flash-based tiers (SSD/NVMe), the supply chain is modeled around **endurance**. The **Write Amplification Factor (WAF)** measures how much internal NAND writing occurs compared to host logical writes:
$$WAF = \frac{\text{Internal NAND Writes}}{\text{Host Logical Writes}}$$
A high WAF shortens the physical life of the disk. To mitigate this, providers employ:
- **Over-provisioning**: Leaving a percentage of the disk unaddressable to lower WAF.
- **Predictive Replacement**: Using SMART data to trigger the "proactive migration" of data to a new drive before a physical failure occurs, avoiding the expensive CPU-intensive EC reconstruction process.
By viewing storage through this lens, we see that a simple API request for "1 GiB" is actually the trigger for a complex chain of physical resource allocations, mathematical transformations, and long-term hardware lifecycle management.