System Design Interview — পরিচিতি
৪৫ মিনিটে massive system design — কীভাবে?
"Design Twitter for me" — interviewer বলে। ৪৫ মিনিট সময়। যে candidate শুরুতেই database schema আঁকতে শুরু করে — সে fail। যে structured approach নেয়, প্রশ্ন করে, trade-off আলোচনা করে — সে pass। এই chapter সেই framework শেখাবে।
কেন এই interview?
System design interview-এ company দেখে:
- Real-world ambiguous problem-এ structured thinking।
- Trade-off বুঝে decision।
- Communication ও collaboration।
- Production-grade thinking — scale, reliability, security।
- Senior-level role-এর core skill।
Typical Format
- Duration: ৪৫-৬০ minutes।
- Whiteboard / virtual board।
- Open-ended: "Design Instagram"।
- Discussion-based: Interviewer guide করেন।
- One main system: Sometime sub-questions।
7-Step Framework
1. Requirements (Functional + Non-functional)
2. Capacity Estimation
3. API Design / High-level
4. Data Model
5. High-Level Architecture
6. Detailed Design (component deep-dive)
7. Bottlenecks + Trade-offs
Step 1: Requirements (5-10 min)
প্রথমে clarify — interviewer-এর সাথে scope discuss।
Functional Requirements
- What features?
- "Design Twitter" → tweet, follow, timeline, search?
- Critical path identify।
Non-Functional Requirements
- Scale: DAU, requests/sec।
- Latency: Acceptable response time।
- Availability: 99.9%? 99.99%?
- Consistency: Strong vs eventual।
- Durability: Data loss tolerable?
💡 Tip: Interviewer-কে questions জিজ্ঞেস করতে ভয় পাবেন না। Clarification = strength।
Step 2: Capacity Estimation (5 min)
Numbers ground reality দেয়।
Common estimates
- DAU: Daily Active Users।
- QPS: Queries per second। Read/Write ratio।
- Storage: Per record × records × years।
- Bandwidth: Storage / time।
- Memory: Hot data cache।
উদাহরণ — Twitter
DAU: 200M
Tweets/day: 200M users × 2 tweets = 400M
Tweet QPS: 400M / 86400 ≈ 4,600 writes/sec
Read/write: 100:1 → 460K reads/sec
Storage/tweet: 280 chars + metadata ≈ 1KB
Daily storage: 400M × 1KB = 400GB/day
Yearly: 400GB × 365 = 146TB/year
Step 3: API Design (5 min)
External interface define।
POST /tweet
body: { text, mediaUrl }
returns: { tweetId, timestamp }
GET /timeline?userId=X&limit=20&cursor=Y
returns: { tweets[], nextCursor }
POST /follow
body: { followeeId }
Step 4: Data Model (5 min)
Core entities ও relationship।
User: { id, name, email, ... }
Tweet: { id, userId, text, timestamp, mediaUrl }
Follow: { followerId, followeeId, timestamp }
Timeline: { userId, tweetIds[] } -- denormalized
SQL or NoSQL discuss — trade-off।
Step 5: High-Level Architecture (10 min)
Box-and-arrow diagram।
[Client] → [LB] → [API Gateway]
↓
[Auth] [Tweet Service] [Timeline Service]
↓ ↓
[Tweet DB] [Cache] [Timeline DB]
↓
[Message Queue]
↓
[Fan-out Worker] → updates timelines
Step 6: Deep Dive (10-15 min)
Interviewer-এর interest অনুযায়ী এক component-এ গভীরে যান।
উদাহরণ: Timeline generation
- Pull (lazy): Read time-এ followee-দের tweet fetch + sort।
- Push (eager): Tweet-এর সময় followers-এর timeline-এ inject।
- Hybrid: Celebrity (millions follower) pull; normal user push।
Trade-offs discuss।
Step 7: Bottlenecks & Scale (5 min)
- Single point of failure identify।
- Hot spot (celebrity user) handle।
- DB sharding strategy।
- Caching layers।
- Replication, geo-distribution।
- Monitoring, alerting।
Do's ও Don'ts
✅ Do's
- Clarify before designing।
- Think aloud — communicate reasoning।
- Estimate numbers।
- Discuss trade-offs।
- Acknowledge what you don't know।
- Diagram clear।
- Iterate — start simple, add complexity।
❌ Don'ts
- Direct schema দিয়ে শুরু।
- Over-engineer — premature optimization।
- Buzzwords without understanding।
- Silent thinking — interviewer guess করতে পারে না।
- Ignore non-functional requirements।
- One-size-fits-all (e.g., "Use Kafka" for everything)।
Common Interview Questions
- URL Shortener (TinyURL, bit.ly)
- WhatsApp / Messenger
- Twitter / Instagram newsfeed
- Uber / Lyft ride matching
- Netflix / YouTube video streaming
- Web crawler
- Notification system
- Distributed cache (Redis)
- Search autocomplete
- Rate limiter
- Distributed file storage (Dropbox)
- Payment system
Preparation Resources
- Alex Xu's "System Design Interview" — most popular।
- Donne Martin's GitHub System Design Primer।
- Grokking the System Design Interview (Educative)।
- YouTube: System Design Interview (Mikhail Smarshchok)।
- Real engineering blog (Netflix, Uber, Airbnb engineering)।
- এই বই — System Design Bangla 😊।
Practice Strategy
- Concept ভালো বুঝুন (এই বই-র Part 1-4)।
- Famous case study study করুন (পরের ৫ chapter)।
- Mock interview — peer-এর সাথে practice।
- Real engineering blog পড়ুন।
- Different scale-এ same problem think করুন।
Common Mistakes
- Memorize one solution: Variations জানা চাই।
- Buzzword-driven: "Just use Kafka" — কেন?
- No trade-off: Every choice has cost।
- Over-confident: "I don't know" বলা OK।
- Ignoring scale: Numbers ground reality।
- Silent monologue: Communicate continuously।
Best Practices
- 5-10 famous case study-র design memorize না, বরং internalize।
- Building block-গুলো (cache, LB, queue, DB) deeply জানুন।
- Real production system-এর architecture পড়ুন।
- Mock interview রেকর্ড — feedback।
- Time management — প্রতি step-এ time stick।
📌 চ্যাপ্টার সারমর্ম
- System design interview = open-ended structured thinking।
- 7-step framework: Requirements → Estimate → API → Data → Architecture → Deep dive → Bottlenecks।
- Communicate, clarify, trade-offs আলোচনা।
- Memorize না — internalize building blocks।
- Practice mock interview essential।