Interview Notes Search

Hello InterviewQuick Reference

Full Article

Key Technologies

Core Database

Store Choice

Pick one core DB

Use one DB you know; most interviewers do not need an explicit SQL vs NoSQL comparison.

Use Postgres for product

Recommended relational default for product designs; ACID properties help data integrity.

Use DynamoDB for infra

Recommended NoSQL default for infrastructure designs; widely accepted with broad features.

Relational Tools

SQL Joins combine tables for queries but can become bottlenecks, Indexes speed queries and support multi-column and specialized forms, and RDBMS Transactions make grouped operations atomic.

  • SQL Joins : Combine tables for queries; minimize them because joins can be a major bottleneck.
  • Indexes : Speed queries; relational DBs support many, multi-column, geospatial, and full-text indexes.
  • RDBMS Transactions : Group operations atomically so either all succeed or all fail.

NoSQL Scaling

Consistent Hashing and Sharding distribute NoSQL data across many servers.

  • Consistent Hashing : Distribute NoSQL data across many servers using consistent hashing.
  • Sharding : Distribute NoSQL data across many servers using sharding.

Use S3 for large blobs

Default if no experience; store images, videos, and files outside the database.

Keep metadata in DB

Store URL pointers in Postgres or DynamoDB; avoid S3 as the primary database.

Use presigned URLs

Client uploads or downloads directly with temporary access; server records status.

Chunk large uploads

Multipart upload resumes failures and can upload chunks in parallel.

Edge Routing

API Gateway

Default for nearly all product designs; routes requests and handles auth, rate limits, logging.

Load Balancer

Use instead of an API Gateway for persistent connections like websockets, or for flexible routing and lower downstream connection load.

L4 Load Balancer

Use for persistent connections like websockets.

L7 Load Balancer

Use otherwise for flexible routing and lower downstream connection load.

Async Processing

Async Fit

Use queues for async work

Buffer bursts and distribute work to worker pools at their own pace.

Don't queue low-latency sync

Strong latency constraints like < 500ms will likely break if a queue is added.

Use streams for replay

Retain data for a configurable period so consumers can re-read by position or time.

Use streams for event sourcing

Store changes as events; replay for audit, rollback, or reconstruction.

Delivery Controls

Backpressure slows or rejects producers when queues are overwhelmed, Dead Letter Queues store unprocessable messages for debugging and auditing, and Scaling with Partitions partitions queues or streams by key to keep related messages or events together.

  • Backpressure : Slow or reject producers when queues are overwhelmed; capacity shortfalls cannot be hidden forever.
  • Dead Letter Queues : Store messages that cannot be processed for debugging and auditing.
  • Scaling with Partitions : Partition queues or streams by key so related messages/events stay together.

Coordination

Lock Usage

Distributed Lock

Hold a resource across systems for a short time.

Ticket During Checkout

Use it for a resource such as a ticket during checkout.

Lock Expiry

Lock Expiry

Set locks to expire.

Crashes

Use expiry, e.g. 10 minutes, so crashes do not leave resources locked.

Deadlock Prevention

Deadlocks

Avoid lock acquisition from far-flung code.

Infrastructure

Avoid lock acquisition from infrastructure so prevention is recognizable.

Caching

Cache Placement

Distributed Cache stores expensive data in memory to reduce database queries and lower latency, while CDN caches content near users and can serve static assets, dynamic content, and API responses.

  • Distributed Cache : Store expensive data in memory to reduce DB queries and lower latency.
  • CDN : Cache content near users; works for static assets, dynamic content, and API responses.

Cache Consistency

Expire Cached Data

Expire cached data when the database changes, like an event venue update.

Update Cached Data

Update cached data when the database changes, like an event venue update.

Write-Through Cache

Write through to the datastore rather than only writing the cache first.

Write-Back Cache

Write to cache first and datastore asynchronously; faster writes but possible data loss.