System Design β‘ Recently updatedUpdated on Jun 30, 2026 β this content may still be evolving.
System Design Fundamentals (Student Level)
Core concepts youβll use in every system design interview. No PhD required β just clear thinking and real examples.
Scalability
What it means: Your system can handle more load (users, requests, data) by adding resources β without rewriting everything from scratch.
Two types:
| Type | What you do | Example | Limit |
|---|---|---|---|
| Vertical | Bigger machine (more CPU/RAM) | Upgrade VPS from 2GB β 8GB RAM | Hardware ceiling, single point of failure |
| Horizontal | More machines | 3 identical Node.js servers behind a load balancer | Needs stateless apps + load balancing |
Student framing: Your MERN capstone on one $5 VPS handles ~50 concurrent users fine. At 5,000 concurrent users, the database and single server become the bottleneck β youβd add caching, read replicas, or more app servers.
Scalability β performance: A fast app on one server isnβt scalable if adding users requires a redesign. Scalability is about growth path.
Interview line: βIβd start with a monolith on one server. When CPU hits 70% consistently, Iβd horizontally scale the API tier and add Redis for hot reads.β
Availability
What it means: The system stays up and serves requests β even when parts fail.
Key terms:
- Uptime: β99.9%β = ~8.7 hours downtime/year
- Redundancy: Multiple copies so one failure doesnβt take everything down
- Health checks: Load balancer pings servers; removes unhealthy ones
How students achieve availability (realistically):
- Deploy on managed platforms (Vercel, Railway, Render) with auto-restart
- Database backups + replication (most cloud DBs offer this)
- Donβt store sessions in server memory (use Redis or DB)
- Graceful error handling β one failed API call shouldnβt white-screen the app
Example: Two Express instances behind Nginx. If API-1 crashes, Nginx routes traffic to API-2. Users might see one slow request, not a total outage.
Latency
What it means: Time between a request and a response. Users feel latency above ~200ms on interactions.
Where latency comes from:
Browser β DNS lookup β TLS handshake β Network travel β Server processing β DB query β Response travel β Render
Typical numbers (rough):
- In-memory cache read: < 1ms
- Local DB query (indexed): 1β10ms
- Cross-region network: 50β150ms
- Unindexed DB scan on large table: 100msβseconds
How to reduce latency:
- Caching β donβt recompute or re-query whatβs already known
- CDN β serve static assets from edge locations near users
- Database indexes β match indexes to your query patterns
- Fewer round trips β batch API calls, use connection pooling
- Compression β gzip/Brotli for JSON and assets
Interview line: βThe feed endpoint is read-heavy. Iβd cache the first page per user in Redis with a 60-second TTL to cut p95 latency from 200ms to under 20ms on cache hits.β
CAP Theorem (Student Level)
The idea: In a distributed system, when a network partition happens (nodes canβt talk to each other), you must choose:
| Meaning | Student example | |
|---|---|---|
| C β Consistency | Every read gets the latest write | Bank balance must be exact |
| A β Availability | Every request gets a response (maybe stale) | Instagram like count can be slightly off |
| P β Partition tolerance | System works even if network splits | Assumed in any distributed setup |
You canβt have all three during a partition. Pick two:
- CP β Consistent but might reject requests (e.g., Zookeeper, some bank systems)
- AP β Available but data might be briefly inconsistent (e.g., DynamoDB-style, social feeds)
Does CAP apply to your single Postgres database? Not really β CAP is about distributed systems with multiple nodes.
Practical takeaway for interviews:
- Ask: βDoes this data need to be exactly right, or is eventually consistent OK?β
- Chat message order β strong consistency within a conversation
- View counts on a blog post β eventual consistency is fine
Load Balancing
What it does: Distributes incoming traffic across multiple backend servers.
βββββββββββ
Users ββββββββββββββΊβ LB β
ββββββ¬βββββ
βββββββββββββββΌββββββββββββββ
βΌ βΌ βΌ
[API-1] [API-2] [API-3]
Common algorithms:
- Round-robin β requests go to each server in turn (simple, fair)
- Least connections β send to server with fewest active connections
- IP hash β same client always hits same server (useful for sticky sessions)
Layer 4 vs Layer 7:
- L4 (transport): Routes by IP/port β fast, no HTTP awareness
- L7 (application): Routes by URL path, headers β can send
/apito API servers and/staticto CDN
Student tools: Nginx, HAProxy, AWS ALB, Cloudflare load balancing
Gotcha β sessions: If sessions live in server memory, users get logged out when LB sends them to a different server. Fix: store sessions in Redis or use JWT.
Gotcha β WebSockets: Need sticky sessions or a shared pub/sub layer (Redis) so messages reach the right server.
Caching
What it does: Stores frequently accessed data in fast storage so you donβt hit the slow path (usually the database) every time.
Cache layers (fast β slow):
Browser cache β CDN β Application cache (Redis) β Database
| Layer | What to cache | TTL example |
|---|---|---|
| Browser | Static assets (JS, CSS, images) | Long (days/weeks with cache busting) |
| CDN | Same static assets, globally | Long |
| Redis | API responses, sessions, hot data | Short (seconds to minutes) |
| DB query cache | Rarely needed if you have Redis | β |
Cache strategies:
- Cache-aside (lazy loading): App checks cache β miss β read DB β write cache
- Write-through: Write to cache and DB together (consistent but slower writes)
- TTL (Time To Live): Auto-expire cached data after N seconds
Cache invalidation (the hard part):
- Delete cache key when underlying data changes
- Short TTL for data that changes often
- Version keys:
user:123:profile:v2
Thundering herd: Cache expires β 1,000 requests hit DB at once. Fix: lock/mutex on rebuild, or stale-while-revalidate.
Interview line: βIβd cache the product catalog in Redis with a 5-minute TTL. On admin update, Iβd invalidate the specific product key, not the entire cache.β
CDN (Content Delivery Network)
What it does: Copies your static files to servers around the world. Users download from the nearest location (edge PoP).
User in Mumbai βββΊ Mumbai edge server (cached) ββ fast!
User in Mumbai βββΊ Origin server in US-East ββ slow (200ms+ extra)
What belongs on a CDN:
- JavaScript bundles, CSS, fonts
- Images, videos, PDFs
- Any file that doesnβt change per-user
What usually does NOT belong on a CDN:
- Personalized API responses (
/api/me) - HTML that varies by auth state (unless carefully configured)
Cache busting: Filenames with content hashes (app.a3f2b1.js) β new deploy = new filename = no stale cache issues.
Student reality: If you deploy on Vercel, Netlify, or Cloudflare Pages β you already use a CDN. Say that in interviews.
Example: React build uploaded to S3, served via CloudFront. A 2MB bundle downloads in 50ms from Singapore instead of 400ms from Virginia.
Quick Mental Math for Interviews
Interviewers sometimes ask rough estimates. Show your thinking:
| Assumption | Calculation |
|---|---|
| 1M daily active users | ~12 users/second average |
| Peak = 3x average | ~36 RPS |
| Each user views 20 pages/day | 20M page views/day |
| 500KB per page (with assets) | ~10TB/day bandwidth (CDN helps a lot) |
You donβt need exact numbers β show you can reason about scale.
Putting It Together: Student Checklist
Before ending any design answer, mention:
- Scaling path: vertical first, then horizontal
- Single point of failure: whatβs the weakest link?
- Caching: what would I cache and for how long?
- CDN: for static assets
- Monitoring: how would I know something broke? (error rate, latency, uptime)