Study Guide

SystemDesign

Cheat sheet + 20 flashcards covering REST, SQL vs NoSQL, caching, load balancing, CAP theorem, message queues, CDNs, and microservices.

12 concept areas 20 flashcards Track your score
Quick Reference

Cheat Sheet

Architecture

Client-Server Model

Clients request resources; servers respond. Clear separation: clients handle UI/UX, servers handle data and business logic.

HTTP is stateless — each request is self-contained. State must be stored server-side (DB, session) or client-side (JWT, cookies).

APIs

REST & HTTP Methods

GET read · POST create · PUT replace · PATCH partial update · DELETE remove

Idempotent: GET, PUT, DELETE (same result if repeated). POST is not.
RESTful: stateless, resource URLs, standard verbs, uniform interface.

HTTP Status Codes

Response Code Families

2xx Success: 200 OK, 201 Created, 204 No Content
3xx Redirect: 301 Moved, 304 Not Modified
4xx Client Error: 400 Bad Request, 401 Unauth, 403 Forbidden, 404 Not Found, 429 Rate Limited
5xx Server Error: 500 Internal, 503 Unavailable

Databases

SQL vs NoSQL

SQL: structured schema, ACID transactions, complex joins. Use for: financials, e-commerce, anything with relationships.

NoSQL: flexible schema, horizontal scale, high write throughput. Use for: logs, social feeds, catalogs, real-time data. Types: document, key-value, column, graph.

Performance

Caching

Store frequently accessed data in fast storage (Redis, Memcached) to reduce DB load and latency.

Cache-aside: check cache → miss → read DB → populate cache
Write-through: write to cache + DB simultaneously
Eviction: LRU (least recently used), LFU, TTL

Scalability

Load Balancing

Distributes traffic across servers to prevent overload.

Round-robin: equal turns
Least connections: send to least busy server
Consistent hashing: same client → same server (good for sessions & caches)

Horizontal scale requires stateless services.

Distributed Systems

CAP Theorem

A distributed system can guarantee only 2 of 3:

Consistency — all nodes see same data
Availability — every request gets a response
Partition Tolerance — works despite network splits

P is required in practice → choose CP or AP.

Async

Message Queues

Decouples producers from consumers asynchronously.

Queue: one message → one consumer (task distribution)
Pub/Sub: one message → all subscribers (fan-out/broadcasting)

Benefits: absorbs traffic spikes, retries on failure, enables parallelism. Tools: Kafka, RabbitMQ, AWS SQS.

Performance

CDN & Edge Caching

A CDN distributes static assets (images, JS, CSS, video) to edge servers geographically close to users.

Reduces latency, offloads the origin server, and improves availability.
Examples: Cloudflare, AWS CloudFront, Akamai, Fastly.

Databases

Indexing

An index (usually a B-tree) lets the DB find rows without scanning the full table.

Read: O(log n) with index vs O(n) without.
Trade-off: faster reads, slower writes, extra storage.
Index columns you frequently filter or sort by — not every column.

Security

Rate Limiting

Caps the number of requests a client can make per time window.

Prevents abuse, DoS attacks, and protects server capacity.
Return 429 Too Many Requests when limit exceeded.
Algorithms: token bucket (bursty allowed), leaky bucket (smooth output).

Architecture

Microservices vs Monolith

Monolith: single deployable unit. Simpler to build, test, debug. Start here.

Microservices: small, independent services with own data stores, communicating via APIs/messages. Benefits: independent scaling, team autonomy. Cost: distributed complexity, latency.

Practice

20 Flashcards

Card 1 / 20 Score: 0 / 0
Question

Answer

Space flip  ·  → next  ·  ← prev  ·  G got it  ·  R review

Your Score
0 / 20

← Back to Catalog Algo3DVerse · System Design Study Guide Start Lessons →