Requirements of Instagram’s Design
Explore the critical functional and non-functional requirements for designing Instagram, a read-heavy, high-scale service. Calculate resource needs, including petabytes of storage and terabits of bandwidth, using precise back-of-the-envelope methods. Use these constraints to inform the high-level System Design decisions.
Requirements
We will focus on core features to simplify the design. The system requirements are:
Functional requirements
Post photos and videos: Users can post photos and videos on Instagram.
Follow and unfollow users: Users can follow and unfollow other users on Instagram.
Like posts: Users can like posts and remove their likes.
Search photos and videos: Users can search photos and videos based on captions and location.
Generate news feed: Users can view photos and videos from accounts they follow, ranked by predicted interest, with an optional chronological view. The feed can also include suggested and promoted posts.
AI-powered Explore recommendations: Users can browse an Explore page featuring photos and videos from accounts they do not follow, selected based on their interests.
Non-functional requirements
Scalability: The system should be scalable to handle millions of users in terms of computational resources and storage.
Latency: The latency to generate a news feed should be low.
Availability: The system should be highly available.
Durability: Any uploaded content (photos and videos) should never get lost.
Consistency: We can compromise a little on consistency. It is acceptable if the content (photos or videos) takes time to show in followers’ feeds located in a distant region.
Reliability: The system must be able to tolerate hardware and software failures.
Suppose we wanted to implement a time-based expiration feature for the content on Instagram (like Snapchat). What functional requirements would we need to add or remove to reflect this feature?
Resource estimation
The system is read-heavy because users browse feeds far more often than they create posts. Design priorities include storage efficiency and low-latency feed retrieval. Instagram supports roughly 1 billion users who share about 95 million posts per day.
We make the following assumptions:
Total users: 1 billion (500 million daily active users)
Daily uploads: 60 million photos and 35 million videos
File sizes: Max 3 MB per photo, 150 MB per video
Traffic: Average 20 requests per user/day
Storage estimation
We estimate storage, bandwidth, and server count based on these figures.
Daily storage requirements: