Practice/Meta/Design Instagram
Design Instagram
Product DesignMust
Problem Statement
Design a large-scale video streaming service similar to YouTube or Netflix where users can upload videos, watch content, and receive personalized recommendations. The platform needs to handle millions of concurrent viewers streaming high-definition video content while maintaining smooth playback with minimal buffering. Content creators should be able to upload videos of varying lengths and formats, which the system must process, encode, and distribute efficiently across a global user base.
The system must support features like video search, comments, likes, subscriptions, and viewing history. Consider how to optimize for both live streaming and on-demand video playback, handle content delivery at scale, and ensure videos load quickly regardless of user location or network conditions.
Key Requirements
Functional
- Video Upload and Processing -- Users can upload videos up to 2GB in size; system must transcode into multiple resolutions and formats
- Video Streaming -- Users can watch videos with adaptive bitrate streaming based on network conditions
- Search and Discovery -- Users can search for videos by title, tags, or content; platform provides recommendations
- Social Features -- Users can like, comment, subscribe to channels, and share videos
- Analytics Dashboard -- Content creators can view watch time, viewer demographics, and engagement metrics
Non-Functional
- Scalability -- Support 100 million daily active users with 500,000 concurrent video streams; handle 10,000 video uploads per hour
- Reliability -- 99.9% uptime for streaming service; no data loss for uploaded videos
- Latency -- Video playback should start within 2 seconds; seek operations complete in under 1 second
- Consistency -- View counts and likes can be eventually consistent; user authentication must be strongly consistent
What Interviewers Focus On
Based on real interview experiences, these are the areas interviewers probe most deeply:
1. Video Storage and Content Delivery Architecture
This tests your understanding of how to efficiently store and serve large binary files at global scale. Raw video files are enormous and serving them directly from origin servers would be prohibitively expensive and slow.
Hints to consider:
- Separate storage strategy for raw uploads versus processed/encoded videos
- Content Delivery Network (CDN) architecture for edge caching and geographic distribution
- Chunk-based storage to enable seeking and adaptive bitrate streaming
- Cost tradeoffs between hot storage (frequently accessed) and cold storage (archival)
2. Video Processing Pipeline
Interviewers want to see how you design asynchronous job processing at scale. Video transcoding is CPU-intensive and time-consuming, requiring careful orchestration.
Hints to consider:
- Message queue-based architecture to decouple upload from processing
- Parallel processing of different resolution outputs (360p, 720p, 1080p, 4K)
- Thumbnail generation and preview clip extraction as separate pipeline stages
- Handling failures and retries when encoding jobs crash or timeout
3. Adaptive Bitrate Streaming Protocol
This reveals your knowledge of video streaming technology and how to optimize user experience across varying network conditions.
Hints to consider:
- HTTP Live Streaming (HLS) or MPEG-DASH protocol selection and tradeoffs
- Manifest files that describe available quality levels and segment locations
- Client-side logic for detecting bandwidth and switching between quality tiers
- Segment duration choices balancing latency versus overhead
4. Database Schema and Metadata Management
Video metadata (title, description, views, likes) has different access patterns than the video content itself, requiring thoughtful data modeling.
Hints to consider:
- Separate databases for user data, video metadata, and social interactions
- Denormalization strategies for read-heavy operations like view counts
- Indexing strategy for search functionality across millions of videos
- Time-series data storage for analytics and watch history
5. Recommendation System Architecture
This explores your ability to design personalized experiences using both real-time and batch processing patterns.
Hints to consider:
- Collaborative filtering based on viewing history of similar users
- Content-based filtering using video tags, categories, and metadata
- Real-time signal incorporation (clicks, watch duration, engagement) versus batch model training
- Cold start problem for new users and new videos without historical data