system design
If you are starting off with system design, this is the BEST starting point for you!
If you’re an absolute beginner in System Design, this roadmap will guide you step-by-step through all the key concepts using one consistent example: Instagram. Each week, I’ve also included the best YouTube videos to help you understand these concepts practically and visually!
π️ Week 1 – Foundations
What is System Design?: The process of building software systems like Instagram that can scale (handle millions of users), maintain reliability (stay available without crashing), and ensure maintainability (are easy to update and extend).
4 Components: Client, Server, Database, APIs.
Client: Your Instagram app,
Server: Processes requests like “upload photo”
API: Fetches user feed,
Database: Stores user data, posts, reels etc.
Videos to Watch:
π️ Week 2 – Scaling Basics & Load Balancing
Vertical Scaling: Add more CPU/RAM to Instagram’s SINGLE web server. Works early on but becomes costly.
Horizontal Scaling: Add many web servers to handle traffic. Instagram uses hundreds of servers to handle profile views and post uploads simultaneously.
Load Balancer: Routes user requests evenly across servers. If 3 instagram servers exist, 1st handles uploads, 2nd handles profile fetches, and the 3rd handles likes.
Stateless Service: Each request from your Instagram app( fetching your feed, liking a post, or adding a comment) is independent and can be handled by any server. Hence, the servers don’t store session information or “remember” users between requests. Instead, your app holds a token or cookie that is sent with every request, allowing the server to identify and authenticate the user each time.
Videos to Watch:
π️ Week 3 – Databases & Data Partitioning
SQL vs NoSQL:
SQL (Postgres/MySQL) → stores structured data (users, posts).
NoSQL (Cassandra): stores large, flexible data (likes, comments feed).
Replication: Instagram’s user data is copied across multiple databases around the world. If one database (say, in India) fails, another replica (like one in Singapore or Europe) instantly takes over, ensuring the app stays available without interruption.
Sharding: Data between these databases is split by user ID or region.
Users A–M → DB1; N–Z → DB2 → prevents one database from overloading.CAP Theorem: Instagram chooses Availability + Partition Tolerance over strict consistency: a like might appear a few seconds late but app stays up.
Videos to Watch:
π️ Week 4 – Caching & CDN
Caching: Cache store frequently accessed data in memory (Redis, Memcached). When you open Instagram, your feed loads from cache instead of querying the DB each time.
CDN: Stores static content (images, stories, profile pics) on servers worldwide for faster load. Your photo stored on a CDN node in India is served instantly to nearby users.
Latency vs Throughput: Caching/CDN reduce latency (delay) and increase throughput (requests/sec).
Videos to watch:
π️ Week 5 – Event-Driven Architecture
Message Queues: Decouple services to handle background jobs.
When you upload a photo, Instagram immediately shows it in your feed, but processing (resizing, compressing, tagging) happens asynchronously via message queues e.g: Kafka.Publish–Subscribe: When one event occurs, it is notified to all services that are subscribed. Eg: When a “Photo Uploaded” on Instagram, updates are sent to the Feed Service, Notification Service, and Search Index.
Eventual Consistency : Every activity eg: “like”, “comment”, “upload” is stored as an event for auditing. These events are synced between the caches, and hence sometimes your likes or comments might appear 1-2 seconds late.
Videos to Watch:
π️ Week 6 – Networking & Microservices
Protocols (HTTP/TCP/WebSockets): Different protocols are used for client-server communications. Eg: HTTP for browsing profiles, WebSockets for real-time likes/comments.
Microservices vs Monolith:
Monolith: Initially Instagram was a monolith, i.e. all its logic (login, posting, comments, notifications) lived in one single big codebase and ran as one giant program. This led to slower deployments, and if one part crashed everything crashed.
Microservice Archtecture: Now Instagram breaks the big app into many smaller, independent services(User, Post, Feed, Search, Notification), each having its independent deployment, code base and database.
API Gateway: It is a traffic controller for all the requests that come into Instagram’s backend. Instead of users talking directly to dozens of microservices (User, Feed, Notification, etc.), they talk to one single endpoint — the API Gateway, which then navigates them to these microservices.
Videos to Watch:
π️ Week 7 – High-Level Design Case Studies
Most Frequently asked Case Studies: Design → Instagram / Twitter feed, WhatsApp / Messenger, YouTube / Netflix streaming, URL Shortener (Bitly), Uber / Ola, Amazon / Flipkart, Notification service, Real-time chatbot
Videos to Practice HLD:
π️ Week 8 – Low-Level Design (LLD)
Understand Design Patterns
Creational: Singleton, Factory, Builder, Prototype
Structural: Adapter, Decorator, Proxy, Composite, Facade
Behavioral: Observer, Strategy, Command, State, Chain of Responsibility
Practice UML: Class, Sequence and Component diagrams
Most Frequently asked Case Studies: Parking Lot system, Elevator system, Movie Booking system, Splitwise, Logger system, Rate limiter, Cache design (LRU, LFU)
Videos to Practice LLD:
π️ Week 9 — Interview Prep
This is THE BEST Video for Interview Prep:
System Design Interview Prep – Striver × Gaurav Sen
Comments
Post a Comment