"How would you design a distributed storage system to store and serve billions of short videos with high availability and low access latency globally?"
Video storage and delivery is fundamental to TikTok/Douyin. This question tests your understanding of distributed file systems, data replication across regions, CDN integration, and cost optimization for massive unstructured data. It reflects real engineering challenges at ByteDance's infrastructure team.
Start with the data characteristics: video files range from a few MB to hundreds of MB, write-once-read-many pattern, high read throughput required.
Design the metadata layer: a distributed key-value store mapping video IDs to storage locations, encoding formats, and CDN cache status.
Explain the storage layer: erasure coding vs. replication trade-offs, hot/warm/cold tiering based on access patterns, and data placement strategies across availability zones.
Cover the serving path: CDN integration, origin pull-through caching, adaptive bitrate selection, and edge computing for transcoding.
I would design a three-layer architecture. The metadata service uses a distributed KV store with strong consistency to map video IDs to physical storage locations, transcoding variants, and access statistics. The storage layer uses erasure coding (e.g., Reed-Solomon 8+4) for cost efficiency on warm/cold data, while keeping hot videos on replicated SSD clusters for low-latency reads. Data is distributed using consistent hashing across storage nodes within each region. For global serving, a multi-tier CDN handles most reads: edge nodes cache popular content, regional mid-tier nodes absorb cache misses, and origin servers pull from the storage layer. I would implement intelligent prefetching based on recommendation signals—when a video enters the ranking pipeline, preload it to nearby edge nodes. Cold videos are migrated to cheaper object storage with longer retrieval times. The system tracks access frequency per video to automatically manage tier transitions, targeting a 95% CDN cache hit rate for active content.
Discuss cost optimization—at ByteDance's scale, storage costs are enormous, so tiering and erasure coding are critical.
Mention the interplay between recommendation and storage: pre-warming CDN cache based on recommendation predictions.
Address multi-region consistency and disaster recovery strategies.
Erasure coding like RS(8,4) achieves similar durability to 3x replication but uses only 1.5x storage overhead instead of 3x. At ByteDance's scale of exabytes, this saves massive infrastructure costs while maintaining high availability.
Use a distributed transcoding pipeline that generates multiple resolution and codec variants upon upload. Prioritize popular codecs first and transcode less common formats on-demand, caching results. Leverage GPU clusters for parallel transcoding.
HireMe AI listens to your interview in real-time, detects questions, and generates instant answer suggestions — so you never freeze up again.
Try HireMe AI Free