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).