Common Patterns
Just like with DSA problems, system design is just about learning patterns. Once you can identify a recurring challenge and know which patterns to apply to the given challenge, you become unstoppable in system design interviews.
7 system design patterns you should know ๐ก
๐ ๐ฃ๐๐๐ต๐ถ๐ป๐ด ๐ฅ๐ฒ๐ฎ๐น๐๐ถ๐บ๐ฒ ๐จ๐ฝ๐ฑ๐ฎ๐๐ฒ๐
- Your chat app needs instant message delivery to millions of users. You should start with HTTP polling, then upgrade to websockets at scale. Pub/Sub services decouple publishers from subscribers for heavy processing loads.
โณ ๐ ๐ฎ๐ป๐ฎ๐ด๐ถ๐ป๐ด ๐๐ผ๐ป๐ด-๐ฅ๐๐ป๐ป๐ถ๐ป๐ด ๐ง๐ฎ๐๐ธ๐
- When a user uploads a 4K video expecting instant feedback, you should return "Upload successful!" immediately, then queue encoding and CDN distribution. Workers process jobs independently while users stay engaged.
๐ ๐ ๐๐น๐๐ถ-๐๐๐ฒ๐ฝ ๐ฃ๐ฟ๐ผ๐ฐ๐ฒ๐๐๐ฒ๐
- When a user places an order requiring payment, inventory check, shipping, and email confirmation, any step can fail, requiring compensation like refunds or inventory release. You should use workflow systems like Temporal or AWS Step Functions to orchestrate steps with automatic retries and state persistence across failures.
๐ ๐๐ฒ๐ฎ๐น๐ถ๐ป๐ด ๐๐ถ๐๐ต ๐๐ผ๐ป๐๐ฒ๐ป๐๐ถ๐ผ๐ป
- When two users try booking the last concert ticket simultaneously, you need database locks, optimistic concurrency, or distributed coordination to prevent race conditions. You should start with single-database solutions before adding distributed complexity.
๐ ๐ฆ๐ฐ๐ฎ๐น๐ถ๐ป๐ด ๐ฅ๐ฒ๐ฎ๐ฑ๐
- Instagram users scroll through hundreds of photos but post once daily, so read traffic grows 10x-100x faster than writes. You should progress from database indexing to read replicas to caching layers like Redis and CDNs.
โ๏ธ ๐ฆ๐ฐ๐ฎ๐น๐ถ๐ป๐ด ๐ช๐ฟ๐ถ๐๐ฒ๐
- When your payment system processes millions of transactions per second, horizontal sharding distributes load across servers while batching reduces overhead. You should choose partition keys that distribute evenly.
๐ ๐๐ฎ๐ป๐ฑ๐น๐ถ๐ป๐ด ๐๐ฎ๐ฟ๐ด๐ฒ ๐๐น๐ผ๐ฏ๐
- When users upload gigabyte video files that would crush your servers, you should generate presigned URLs for direct client-to-storage uploads and serve through CDNs. Keep servers out of the data path.
These patterns often work together. A video platform uses Large Blobs (uploads), Long-Running Tasks (transcoding), and Realtime Updates (progress notifications).