Skip to content

Instantly share code, notes, and snippets.

@vishalzambre
Last active February 7, 2026 16:11
Show Gist options
  • Select an option

  • Save vishalzambre/9f5d46e5621a0845b64336d12df074bc to your computer and use it in GitHub Desktop.

Select an option

Save vishalzambre/9f5d46e5621a0845b64336d12df074bc to your computer and use it in GitHub Desktop.

🧠 System Design Fundamentals — Engineer Gist


1️⃣ Scalability

Meaning: Ability of system to handle growth (users, data, traffic).

Types

  • Vertical → Bigger machine
  • Horizontal → More machines (preferred)
flowchart LR
User --> LB
LB --> S1
LB --> S2
LB --> S3
Loading

2️⃣ Availability

Meaning: System is accessible when needed.

Example: 99.99% uptime = ~52 min downtime/year

flowchart LR
User --> Primary
Primary --> Backup
Loading

3️⃣ Reliability

Meaning: System works correctly over time (no data loss, correct results).

flowchart LR
User --> Service --> DB
DB --> BackupDB
Loading

4️⃣ Latency vs Throughput vs Bandwidth

Term Meaning
Latency Time for one request
Throughput Requests per second
Bandwidth Data transfer capacity
flowchart LR
User -->|"Latency"| Server
Server -->|"Throughput"| ManyUsers
Loading

5️⃣ Client-Server Architecture

flowchart LR
Client --> Server
Server --> Database
Loading

6️⃣ Databases

Persistent storage for data.

Types:

  • Relational
  • Key-value
  • Document
  • Graph
flowchart LR
App --> DB[(Database)]
Loading

7️⃣ SQL vs NoSQL

SQL NoSQL
Structured Flexible
ACID BASE
Joins Denormalized
flowchart LR
App --> SQLDB[(SQL DB)]
App --> NoSQLDB[(NoSQL DB)]
Loading

8️⃣ Load Balancing

Distributes traffic across servers.

flowchart LR
User --> LB
LB --> S1
LB --> S2
Loading

9️⃣ Load Balancing Algorithms

  • Round Robin
  • Least Connections
  • IP Hash
flowchart LR
LB --> S1
LB --> S2
LB --> S3
Loading

🔟 Caching

Store frequently accessed data in fast storage.

flowchart LR
User --> Cache
Cache --> DB
Loading

1️⃣1️⃣ Cache Invalidation

Hardest problem 😄

Strategies:

  • TTL
  • Write-through
  • Cache-aside
flowchart LR
App --> Cache
Cache --> DB
Loading

1️⃣2️⃣ CDN (Content Delivery Network)

flowchart LR
User --> CDN
CDN --> OriginServer
Loading

1️⃣3️⃣ DNS

Domain → IP resolution.

flowchart LR
Browser --> DNS
DNS --> ServerIP
Loading

1️⃣4️⃣ API Design

Principles:

  • Versioning
  • Idempotency
  • Pagination
  • Error codes

1️⃣5️⃣ REST APIs

flowchart LR
Client -->|GET/POST| REST_API
REST_API --> DB
Loading

1️⃣6️⃣ Authentication vs Authorization

AuthN AuthZ
Who are you What can you access

1️⃣7️⃣ Session vs Token Auth

flowchart LR
User --> Server
Server --> SessionStore
Loading
flowchart LR
User -->|JWT| Server
Loading

1️⃣8️⃣ OAuth / OAuth2 / OpenID Connect

  • OAuth → Authorization delegation
  • OAuth2 → Modern standard
  • OIDC → Identity layer on OAuth2

1️⃣9️⃣ JWT

flowchart LR
User --> AuthServer
AuthServer --> JWT
JWT --> API
Loading

2️⃣0️⃣ Rate Limiting

Protects system from abuse.

flowchart LR
User --> RateLimiter --> API
Loading

2️⃣1️⃣ Single Point of Failure (SPOF)

flowchart LR
User --> OnlyServer
Loading

2️⃣2️⃣ High Availability vs Fault Tolerance

HA FT
Minimal downtime Zero interruption

2️⃣3️⃣ CAP Theorem

Pick 2:

  • Consistency
  • Availability
  • Partition Tolerance

2️⃣4️⃣ Consistency Models

  • Strong
  • Eventual
  • Causal
flowchart LR
Node1 --> Node2
Node2 --> Node3
Loading

2️⃣5️⃣ Data Replication

flowchart LR
Primary --> Replica1
Primary --> Replica2
Loading

2️⃣6️⃣ Read Replicas

flowchart LR
App --> PrimaryDB
App --> ReadReplica
Loading

2️⃣7️⃣ Sharding

Split data across DBs.

flowchart LR
Router --> Shard1
Router --> Shard2
Router --> Shard3
Loading

2️⃣8️⃣ Data Partitioning

Horizontal → rows Vertical → columns


2️⃣9️⃣ Consistent Hashing

flowchart LR
Key --> HashRing
HashRing --> Node
Loading

3️⃣0️⃣ Denormalization

Store duplicate data for faster reads.


3️⃣1️⃣ Indexing

flowchart LR
Query --> Index --> Data
Loading

3️⃣2️⃣ Microservices Architecture

flowchart LR
API --> UserService
API --> OrderService
API --> PaymentService
Loading

3️⃣3️⃣ Monolithic Architecture

flowchart LR
Client --> Monolith --> DB
Loading

3️⃣4️⃣ Serverless Architecture

flowchart LR
User --> API_Gateway --> Lambda --> DB
Loading

3️⃣5️⃣ Event-Driven Architecture

flowchart LR
Producer --> EventBus --> Consumer
Loading

3️⃣6️⃣ Message Queues

flowchart LR
Producer --> Queue --> Worker
Loading

3️⃣7️⃣ Pub/Sub

flowchart LR
Publisher --> Topic
Topic --> Sub1
Topic --> Sub2
Loading

3️⃣8️⃣ Sync vs Async Communication

Sync

sequenceDiagram
Client->>Server: Request
Server-->>Client: Response
Loading

Async

sequenceDiagram
Client->>Queue: Job
Worker->>Queue: Pull Job
Worker-->>Client: Done later
Loading

⭐ Mental Model (If You Remember Only This)

Traffic → DNS → CDN → Load Balancer → App → Cache → DB → Replicas → Backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment