Requirements of Instagram’s Design
Learn about the requirements and computational needs for the Instagram service.
Requirements
We’ll concentrate on some important features of Instagram to make this design simple. Let’s list down the requirements for our system:
Functional requirements
Post photos and videos: The users can post photos and videos on Instagram.
Follow and unfollow users: The users can follow and unfollow other users on Instagram.
Like or dislike posts: The users can like or dislike posts of the accounts they follow.
Search photos and videos: The users can search photos and videos based on captions and location.
Generate news feed: The users can view the news feed consisting of the photos and videos (in chronological order) from all the users they follow. Users can also view suggested and promoted photos in their news feed.
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.
Having understood the requirements of Instagram’s design, answer the following question:
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
Our system is read-heavy because service users spend substantially more time browsing the feeds of others than creating and posting new content. Our focus will be to design a system that can fetch the photos and videos on time. There is no restriction on the number of photos or videos that users can upload, meaning efficient storage management should be a primary consideration in the design of this system. Instagram supports around a billion users globally who share 95 million photos and videos on Instagram per day. We’ll calculate the resources and design our system based on the requirements.
Let’s assume the following:
We have 1 billion users, with 500 million as daily active users.
Assume 60 million photos and 35 million videos are shared on Instagram per day.
We can consider 3 MB as the maximum size of each photo and 150 MB as the maximum size of each video uploaded on Instagram.
On average, each user sends 20 requests (of any type) per day to our service.
Storage estimation
We need to estimate the storage capacity, bandwidth, and the number of servers to support such an enormous number of users and content.
The storage per day will be: