Memorize the order of magnitude — interviewers care that you know SSD is ~1000x slower than RAM, not the exact nanoseconds.
Operation
Latency
Notes
L1 cache reference
0.5 ns
Fastest memory access available
Branch mispredict
5 ns
CPU pipeline flush penalty
L2 cache reference
7 ns
~14x slower than L1
Mutex lock/unlock
25 ns
Contention makes this much worse
Main memory (RAM) reference
100 ns
~200x slower than L1
Compress 1 KB with Snappy
3 μs
Fast compression for real-time use
Read 1 MB sequentially from RAM
3 μs
RAM is fast for sequential access
SSD random read
150 μs
~1,500x slower than RAM
Read 1 MB sequentially from SSD
1 ms
SSDs excel at sequential reads
Network round trip (same datacenter)
500 μs
Assumes modern datacenter networking
HDD disk seek
10 ms
Mechanical latency — avoid random reads
Read 1 MB sequentially from HDD
20 ms
HDDs still viable for bulk sequential I/O
Network round trip (cross-continent)
150 ms
Speed of light is the bottleneck
TLS handshake
250 ms
1–2 round trips depending on version
DNS lookup (uncached)
~50 ms
Varies widely; caching helps enormously
TCP connection setup (3-way handshake)
~1.5x RTT
One and a half round trips
Key ratios to remember: RAM is ~1,000x faster than SSD. SSD is ~100x faster than HDD. Network within a datacenter is ~300x faster than cross-continent.
No database is “best.” The right choice depends on your access patterns, consistency requirements, team expertise, and operational budget. Picking a DB because it is trendy is a career-limiting move.
Default to REST for public APIs. Use gRPC for internal service-to-service communication where latency matters. Use GraphQL when clients have highly variable data needs. Use WebSockets only when you truly need server-push or bidirectional streaming.
Canary + feature flags is the gold standard for production deployments at scale. Roll out to 1% of traffic, monitor error rates and latency, then gradually increase.
Never roll your own auth for production systems. Use battle-tested libraries and standards. The most common security breaches come from custom authentication implementations.
Smallest deployable unit; one or more containers sharing network/storage
Deployment
Manages ReplicaSets; handles rolling updates and rollbacks
ReplicaSet
Ensures a specified number of pod replicas are running at all times
Service
Stable network endpoint that routes traffic to a set of pods
Ingress
HTTP/HTTPS routing rules from external traffic to internal services
ConfigMap
Injects non-sensitive configuration data into pods as env vars or files
Secret
Stores sensitive data (tokens, passwords) with base64 encoding
StatefulSet
Like Deployment but with stable pod identity and persistent storage
DaemonSet
Runs exactly one pod per node (logging agents, monitoring)
Job / CronJob
Runs a task to completion once (Job) or on a schedule (CronJob)
Namespace
Virtual cluster for isolating resources within the same physical cluster
PersistentVolume (PV)
A piece of storage provisioned in the cluster
PersistentVolumeClaim (PVC)
A request for storage by a pod
HorizontalPodAutoscaler
Scales pod count based on CPU, memory, or custom metrics
NetworkPolicy
Firewall rules controlling pod-to-pod and external traffic
Mental model: Deployments manage ReplicaSets, which manage Pods. Services give Pods a stable DNS name. Ingress gives Services an external URL. Everything else is configuration, storage, or scheduling.
Server is overloaded or in maintenance — temporary
504
Gateway Timeout
Upstream service did not respond in time
401 vs 403: 401 means “I don’t know who you are” (authentication). 403 means “I know who you are, but you can’t do this” (authorization). Getting this wrong confuses every frontend developer on the team.
How to reason about SLAs in system design interviews
Combining availability: If Service A (99.9%) depends on Service B (99.9%), the combined availability is at best 99.9% x 99.9% = 99.8%. Each dependency in the critical path multiplies downtime.Improving availability:
Redundancy: Run multiple replicas across availability zones.
Eliminate single points of failure: Every component in the critical path needs failover.
Graceful degradation: Serve cached/stale data instead of failing entirely.
Health checks + auto-restart: Detect and recover from failures automatically.
Rule of thumb: Most production web apps target three nines (99.9%). Banks and telecom target four to five nines. Achieving five nines requires automated everything — humans are too slow.
The formula: QPS = (DAU x actions per user) / 86,400. Peak QPS is typically 2x–5x the average. Always calculate peak, not just average — systems must handle bursts.
Daily storage = DAU x actions/user x size per actionMonthly storage = Daily x 30Yearly storage = Daily x 365Plan for 3–5 years of growth + replication factor (usually 3x)
Modifying existing code every time a new type appears
L — Liskov Substitution
Subtypes must be usable wherever their parent type is expected.
Subclasses that break parent behavior or throw unexpected errors
I — Interface Segregation
No client should be forced to depend on methods it does not use.
Fat interfaces where implementors stub out half the methods
D — Dependency Inversion
Depend on abstractions, not concretions.
Tightly coupled modules that cannot be tested or swapped
Mnemonics and practical examples
S — Single Responsibility:
Bad: A User class that handles authentication, database access, and email sending.
Good: Separate UserAuth, UserRepository, and EmailService classes.O — Open/Closed:
Bad: A giant if/else chain that grows every time you add a payment method.
Good: A PaymentProcessor interface with StripeProcessor, PayPalProcessor implementations.L — Liskov Substitution:
Bad: A Square that extends Rectangle but breaks when setWidth is called independently.
Good: Use a common Shape interface instead of inheritance.I — Interface Segregation:
Bad: A Worker interface with work(), eat(), sleep() — robots do not eat.
Good: Split into Workable, Eatable, Sleepable interfaces.D — Dependency Inversion:
Bad: OrderService creates new MySQLDatabase() directly.
Good: OrderService accepts a Database interface via constructor injection.
Dangerous commands to use with caution:git reset --hard, git push --force, and git clean -fd are destructive and cannot be undone easily. Always prefer --force-with-lease over --force when pushing, as it prevents overwriting teammates’ work.