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:

TypeWhat you doExampleLimit
VerticalBigger machine (more CPU/RAM)Upgrade VPS from 2GB β†’ 8GB RAMHardware ceiling, single point of failure
HorizontalMore machines3 identical Node.js servers behind a load balancerNeeds 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:

  1. Caching β€” don’t recompute or re-query what’s already known
  2. CDN β€” serve static assets from edge locations near users
  3. Database indexes β€” match indexes to your query patterns
  4. Fewer round trips β€” batch API calls, use connection pooling
  5. 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:

MeaningStudent example
C β€” ConsistencyEvery read gets the latest writeBank balance must be exact
A β€” AvailabilityEvery request gets a response (maybe stale)Instagram like count can be slightly off
P β€” Partition toleranceSystem works even if network splitsAssumed 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 /api to API servers and /static to 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
LayerWhat to cacheTTL example
BrowserStatic assets (JS, CSS, images)Long (days/weeks with cache busting)
CDNSame static assets, globallyLong
RedisAPI responses, sessions, hot dataShort (seconds to minutes)
DB query cacheRarely 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:

AssumptionCalculation
1M daily active users~12 users/second average
Peak = 3x average~36 RPS
Each user views 20 pages/day20M 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)

Next: frontend-system-design.md or backend-system-design.md