How YouTube Stores Its Massive Video Archive: Sharding, Vitess, and Spinning Disks
Any platform with heavy storage demands can reuse YouTube's pattern of serving hot content from CDN while archiving to cheap spinning disks, and using Vitess to keep MySQL sharding manageable without burning RAM on connection overhead.
YouTube's backend runs on a sharded MySQL cluster managed by Vitess, a database clustering system the company created to handle horizontal scaling without forcing shard logic into application code. Vitess handles sharding, failover, backup, and connection pooling; each MySQL connection normally costs 2MB of RAM, but Go-based pooling in Vitess cuts that overhead. The system runs on Kubernetes in a containerized environment, with Zookeeper coordinating nodes.
For the video files themselves, YouTube stores them on spinning hard drives in commodity servers, which are replaced rather than repaired when they fail. The platform adds more than a petabyte of new storage capacity every day because users upload over 500 hours of video per minute. Metadata, user preferences, account settings, and the indexes needed to fetch video all live in MySQL. The hot videos are served from CDN edge points; the long tail of less popular content is pulled from the database.
The architecture deliberately trades consistency for speed: read replicas can return slightly stale view counts, but videos render without waiting for the primary to sync. SSDs are rejected for archival storage because they are expensive and degrade over time, so rotating disks carry the bulk of the data.
YouTube's tolerance for stale read replicas shows a deliberate consistency trade-off: view counts are eventually consistent, but video playback must be immediate, so the system prioritizes rendering speed over perfect accuracy.
Vitess exists because hand-coded sharding is painful; moving shard logic into the framework lets developers write normal SQL while the system routes queries, a pattern that generalizes to any relational database struggling with scale.
The storage strategy separates hot and cold data: CDN handles popular videos, spinning disks handle archival, keeping performance high without forcing SSDs on the entire archive, a cost optimization that scales with content growth.