Skip to main content
Engineering Patterns β€’ Reusable Decisions7 Reviewed Patterns

Architectural Decision Patterns

Connect recurring system design problems to proven structural solutions. Evaluate problem fit, operational trade-offs, failure modes, and alternatives.

Performance & Cachingcanonical

Cache-Aside & Read-Through Pattern

Mitigating high database latency under read-heavy workloads while maintaining consistency.

Structural Solution Shape

Caching stores high-frequency read data in fast RAM instead of slow disk/network databases. Redis achieves sub-millisecond QPS by operating a single-threaded event loop paired with OS epoll I/O multiplexing, completely eliminating thread locking contention.

Problem Fit & Applicability Criteria
  • βœ“Read-heavy workloads (>80% reads, <20% writes).
  • βœ“Session storage, rate-limiting counters, and leaderboards.
Core Trade-Off: Concurrency Model
PRO: Single thread avoids deadlocks, lock contention, and OS context switching overhead.CON: Long-running O(N) operations (e.g. KEYS *) block all concurrent clients.
Primary Failure Mode: Cache Stampede (Thundering Herd)

Use probabilistic early expiration (XFetch algorithm) or distributed lock mutex (SETNX).

Traffic Shaping & Resiliencycanonical

Token Bucket Rate Limiting Pattern

Preventing service degradation and cascading resource exhaustion under sudden bursts of incoming client traffic.

Structural Solution Shape

Rate limiting controls the incoming request rate per client or IP address to prevent server overload, DDoS attacks, and resource starvation.

Problem Fit & Applicability Criteria
  • βœ“Public API endpoints exposed to third-party developers.
  • βœ“Authentication / login routes.
Core Trade-Off: Algorithm Selection
PRO: Token bucket permits bursts while keeping average throughput predictable.CON: Sliding window log requires more memory.
Primary Failure Mode: Race Condition in Counter

Execute Redis Lua scripts for atomic counter updates.

Membership & Filteringcanonical

Probabilistic Membership Testing (Bloom Filter)

Eliminating expensive authoritative database round-trips for non-existent keys with zero false negatives.

Structural Solution Shape

Hash Tables & Probabilistic Bloom Filters provides core foundational patterns in Algorithms & Data Structures. Achieve O(1) constant time lookups and test set membership with zero false negatives using space-efficient Bloom filters.

Problem Fit & Applicability Criteria
  • βœ“High-scale enterprise production systems in Algorithms & Data Structures.
  • βœ“Performance-critical services requiring predictable latency bounds.
Core Trade-Off: Complexity vs Resilience
PRO: Higher fault tolerance and clear separation of concerns.CON: Adds initial architectural setup overhead.
Primary Failure Mode: Misconfiguration Overhead

Use observability metrics and automated canary validation.

Traffic Shaping & Resiliencycanonical

Circuit Breaker Fault Isolation Pattern

Failing fast and isolating cascading downstream service latency before exhaustion of connection pools.

Structural Solution Shape

Circuit Breakers monitor remote service call failure rates. If downstream failures exceed a threshold (e.g. 50%), the breaker trips to OPEN, instantly returning fallback responses instead of stalling threads.

Problem Fit & Applicability Criteria
  • βœ“Microservice HTTP calls to third-party APIs.
  • βœ“Database connection attempts.
Core Trade-Off: Resilience vs Freshness
PRO: Prevents thread pool exhaustion and cascading crashes.CON: Returns degraded fallback data while OPEN.
Primary Failure Mode: Flapping Circuit

Add evaluation sliding window size and recovery cooldown timeouts.

Distributed Storage & Partitioningcanonical

Horizontal Database Sharding Pattern

Scaling relational storage throughput and capacity beyond the physical constraints of a single database node.

Structural Solution Shape

Sharding splits a monolithic database into independent database nodes (shards). Each row is routed to a shard based on a shard key.

Problem Fit & Applicability Criteria
  • βœ“Tables exceeding 1TB or 50,000 write QPS.
  • βœ“Global multi-region data residency compliance.
Core Trade-Off: Cross-Shard Joins
PRO: Infinite storage & write throughput scaling.CON: Cross-shard SQL joins and distributed transactions are extremely slow.
Primary Failure Mode: Hotspot Shard

Salt shard keys or use composite keys (user_id + date).

Concurrency & Coordinationcanonical

Distributed Locking with Fencing Tokens

Enforcing mutual exclusion across distributed stateless workers accessing shared non-atomic resources.

Structural Solution Shape

Distributed Locking & Redlock Algorithm provides core foundational patterns in Security & Distributed Concurrency. Synchronize atomic operations across distributed nodes using Redis SETNX, TTL fencing tokens, and Redlock consensus.

Problem Fit & Applicability Criteria
  • βœ“High-scale enterprise production systems in Security & Distributed Concurrency.
  • βœ“Performance-critical services requiring predictable latency bounds.
Core Trade-Off: Complexity vs Resilience
PRO: Higher fault tolerance and clear separation of concerns.CON: Adds initial architectural setup overhead.
Primary Failure Mode: Misconfiguration Overhead

Use observability metrics and automated canary validation.

Storage Engines & Internalscanonical

Log-Structured Merge-Tree (LSM) Write Buffering

Optimizing high-throughput sequential write ingestion without stalling on random disk seeks.

Structural Solution Shape

B-Trees vs LSM-Trees Storage Engines provides core foundational patterns in Algorithms & Data Structures. Compare B+ Tree read-optimized node layouts against LSM-Tree append-only SSTable write buffers.

Problem Fit & Applicability Criteria
  • βœ“High-scale enterprise production systems in Algorithms & Data Structures.
  • βœ“Performance-critical services requiring predictable latency bounds.
Core Trade-Off: Complexity vs Resilience
PRO: Higher fault tolerance and clear separation of concerns.CON: Adds initial architectural setup overhead.
Primary Failure Mode: Misconfiguration Overhead

Use observability metrics and automated canary validation.

Learning Journeys & Roadmaps

Need an ordered sequence for a specific engineering goal?

Generate an end-to-end learning path with prerequisites based on your target role or topic.

Explore Learning Roadmaps β†’