githubEdit

Trade-offs Cheat Sheet

Quick decision guide for senior/staff engineer level system design interviews

Core Trade-off Categories


Consistency vs Availability

Decision Framework:

Strong Consistency (CP in CAP)

Eventual Consistency (AP in CAP)

Interview Answer Template:


Latency vs Throughput

Metric
Definition
Optimization

Latency

Time to complete single request

Caching, CDN, faster algorithm

Throughput

Requests handled per second

Horizontal scaling, async processing

Trade-off Scenarios:

Optimize for Latency

Optimize for Throughput

Example:


SQL vs NoSQL

Decision Matrix

Factor
SQL
NoSQL

Data Structure

Structured, relational

Flexible, nested

Scalability

Vertical (scale-up)

Horizontal (scale-out)

Transactions

ACID

Eventually consistent (some support ACID)

Schema

Fixed, requires migrations

Schema-less, dynamic

Queries

Complex JOINs

Limited joins, denormalize

Use Case

Complex queries, relational

High scale, flexible schema

SQL: Use When

NoSQL: Use When

Polyglot Persistence (Use Both!)


Synchronous vs Asynchronous

Synchronous

Pros: Simple, immediate feedback Cons: High latency if blocked, poor scalability

Asynchronous

Pros: Better scalability, non-blocking Cons: Complexity, eventual consistency

Hybrid Approach


Push vs Pull

Push Model

Pull Model

Hybrid: Long Polling


Horizontal vs Vertical Scaling

Vertical Scaling (Scale Up)

Horizontal Scaling (Scale Out)

Real-World Strategy


Normalization vs Denormalization

Normalization (SQL Philosophy)

Denormalization (NoSQL Philosophy)


Caching Strategies

Cache-Aside (Lazy Loading)

Write-Through Cache

Write-Behind (Write-Back)


Message Queues

When to Use Message Queues

SQS vs Kafka vs RabbitMQ

Feature
SQS
Kafka
RabbitMQ

Type

Simple queue

Distributed log

Message broker

Throughput

Moderate

Very high

Moderate

Ordering

FIFO (optional)

Per partition

Yes

Retention

14 days max

Configurable (days/TB)

Until consumed

Use Case

Simple async jobs

Event streaming, logs

Complex routing


API Design

REST vs GraphQL vs gRPC

Factor
REST
GraphQL
gRPC

Protocol

HTTP/1.1

HTTP/1.1+

HTTP/2

Data Format

JSON

JSON

Protocol Buffers

Use Case

Public APIs

Flexible clients

Internal microservices

Performance

Moderate

Moderate

High (binary)

Caching

Easy (HTTP)

Hard

No HTTP caching


Summary: Key Interview Questions

"Why did you choose...?"

  • SQL vs NoSQL: "I chose SQL because we need ACID transactions for payment processing"

  • Sync vs Async: "Async because video processing takes minutes, can't block user"

  • Push vs Pull: "WebSockets for chat because real-time is critical"

  • Cache Strategy: "Write-through because we can't tolerate stale pricing data"

Always explain trade-offs!

Last updated