Flashcard Deck · 20 cards · Public

System Design - Distributed Systems, Load Balancing & High Availability

Master high-yield system design concepts for software engineering interviews, including CAP/PACELC theorems, load balancing, caching strategies, database sharding, and message queues.

Cards in this deck

(20 cards)

Preview terms and definitions before starting your study session.

#1
Term
Consistent Hashing
Definition
A distributed hashing scheme that maps both servers and keys to a virtual ring (hash space to ).
  • Key Benefit: Adding or removing a server node requires remapping only keys on average (where is the number of keys and is the number of servers).
  • Virtual Nodes: Uses multiple virtual positions per physical server to ensure uniform data distribution and prevent hotspots.
#2
Term
Load Balancing Algorithms
Definition
  • Round Robin: Distributes requests sequentially across servers.
  • Weighted Round Robin: Routes traffic based on assigned server capacity/weight.
  • Least Connections: Directs traffic to the server with the fewest active connections (ideal for long sessions).
  • IP Hash: Maps client IP to a server using a hash function, ensuring session persistence (sticky sessions).
#3
Term
Layer 4 vs. Layer 7 Load Balancing
Definition
  • Layer 4 (Transport Layer): Routes traffic based on IP address and TCP/UDP ports without inspecting packet payloads. Highly efficient and fast (e.g., HAProxy in TCP mode).
  • Layer 7 (Application Layer): Routes traffic based on application data such as HTTP headers, cookies, or URL paths. Enables smart routing, SSL termination, and content-based caching (e.g., NGINX, AWS ALB).
#4
Term
Database Replication: Primary-Replica vs. Multi-Primary
Definition
  • Primary-Replica (Master-Slave): Writes go to the primary node and are replicated to read-only replicas. Solves read scalability but write capacity remains limited to the primary.
  • Multi-Primary (Master-Master): Multiple nodes accept write operations. Improves write availability, but requires complex conflict resolution algorithms (e.g., Vector Clocks, Last-Write-Wins).
#5
Term
Database Sharding
Definition
A horizontal partitioning technique where a single database dataset is split across multiple separate database instances using a Shard Key.
  • Pros: Handles massive write/read throughput beyond a single server's limits.
  • Cons: High complexity; makes cross-shard joins, distributed transactions, and dynamic re-sharding difficult.
#6
Term
Cache-Aside (Lazy Loading)
Definition
1. Application checks the cache for data.
2. If Cache Hit: Returns data directly.
3. If Cache Miss: Reads data from the database, writes it to the cache, and returns it to the client.
  • Pros: Cache only contains requested data; handles cache node failures gracefully.
  • Cons: Cache miss penalty on initial read; potential data staleness if DB writes bypass the cache.
#7
Term
Write-Through vs. Write-Back (Write-Behind) Cache
Definition
  • Write-Through: Data is written simultaneously to both the cache and the underlying database. Guarantees consistency and durability, but increases write latency.
  • Write-Back (Write-Behind): Data is written immediately to the cache, and asynchronously flushed to the database at defined intervals.
  • Pros: Extremely low write latency and high throughput.
  • Cons: Risk of data loss if the cache node crashes before flushing to storage.
#8
Term
Content Delivery Network (CDN): Pull vs. Push
Definition
  • Pull CDN: Cache servers fetch content from the origin server on-demand when a user requests it for the first time. Low setup effort; efficient for high-traffic sites.
  • Push CDN: Origin server actively uploads new or updated content directly to CDN edge nodes before requests arrive. Ideal for static, infrequently changing assets or critical system updates.
Showing 8 of 20 cards in this deck.
Study All Now

Related Flashcard Sets

Explore similar study materials created by the community

Browse community decks