[ OK ]01644c48-7620-4c66-a5ad-039ffd95d271 — full content available
[ INFO ]category: System Design difficulty: unknown freq: first seen: 2026-05-28
[UNKNOWN][SYSTEM DESIGN]Medium Frequency
$catproblem.md
Design Instagram
Problem Statement
Design an Instagram-like image feed. Users publish image posts, follow other users, and open a personalized feed that loads images quickly as they scroll. The system should handle popular posts and scale to millions of users.
Constraints
Users can publish image posts.
Users can follow other users.
Users can view a personalized feed of images from the users they follow.
The feed should load images quickly as users scroll.
The system should be scalable to handle millions of users.
The system should handle popular posts efficiently.
Examples
User A follows User B and User C. When User A opens their feed, they should see the latest posts from User B and User C.
If a post becomes very popular and is viewed by many users, the system should still be able to serve the post quickly.
Hints
Consider using a microservices architecture to separate concerns and scale different parts of the system independently.
Use a caching layer to store popular posts and reduce load on the database.
Implement a feed ranking algorithm to prioritize posts based on factors like recency, engagement, and user preferences.
Consider using a CDN to serve images quickly to users around the world.
Solution
User Service: Handles user registration, login, and following/unfollowing other users.
Post Service: Handles creating, updating, and deleting posts.
Feed Service: Handles generating personalized feeds for users based on who they follow.
Image Storage: Stores images in a distributed file system or cloud storage.
Caching Layer: Caches popular posts and user feeds to reduce load on the database.
Feed Ranking Algorithm: Prioritizes posts in the feed based on factors like recency, engagement, and user preferences.
CDN: Serves images quickly to users around the world using a content delivery network.
By breaking down the system into microservices and using caching, a feed ranking algorithm, and a CDN, the system can handle millions of users and serve popular posts efficiently.