Let us assume,
Total Storage Required Per Day
Photos: 60 million photos/day * 3 MB = 180 TeraBytes / day
Videos: 35 million videos/day * 150 MB = 5250 TB / day
Total content size = 180 + 5250 = 5430 TB
The Total Space Required for a Year:
5430 TB/day * 365 (days a year) = 1981950 TB = 1981.95 PetaBytes
1. Photo Uploading API:
2. Profile Management API:
3. Feed Retrieval API:
4. Like API:
5. Comment API:
6. Settings and Privacy API:
7. User Search API:
8. User Follow/Unfollow API:
9. Trending API:
10. Notification API:
For the tables required in this design, refer to the class diagram, the list of classes is not exhaustive but this is a good number of tables to start with.
Let us now discuss the different Databases and CAP Theorem:
Let us now discuss concepts like partitioning, sharding
Sharding is a database architecture strategy that involves horizontally dividing a large dataset across multiple independent database instances or shards. Each shard operates as a separate database, managing its subset of the data. Sharding is employed to distribute the load, improve performance, and handle large volumes of data in a scalable manner.
Below are a few ways we can apply sharding to our data
In a high-level design for an Instagram-like system, we can identify various components that collectively address the end-to-end functionality of the platform. Here are the key components:
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
For Databases, we have chosen different databases depending on different storage requirements and CAP theorem.
For user data, we have chosen a RDBMS, since we need high consistency.
For photos and videos, we have chosen Amazon S3 to get high scalability, high availability, and partition tolerance.
For comments, Activity Feed, and Notifications, we have chosen no-SQL databases, since they need to be eventually consistent, with high availability.
For Session management, we have used Redis to have low latency with frequent authentication and token generation services.
We could have included an additional database for storing the metadata for each post in a different database and could have included more services that run in the background, that generate feed for each user and store them.