Skip to content

Use Cases

Find patterns by the kind of system you're building.

Web APIs & Microservices

Building a REST/gRPC service? These patterns keep it reliable under load.

ScenarioPatternsReal Example
Protect against downstream outagesCircuit Breaker + Retry with BackoffNetflix Hystrix wraps every HTTP client call
API rate limitingRate LimiterStripe allows burst of 25, refills at 25/sec
Request middleware (auth, logging, tracing)Middleware ChaingRPC interceptors, Koa.js onion model
Service discoveryRegistryConsul, etcd service registration
Load distribution across nodesConsistent HashingHAProxy, groupcache key distribution
Prevent overloadBackpressure + Batch ProcessingNode.js stream piping, Kafka consumer groups

Databases & Storage

The patterns behind PostgreSQL, Redis, LevelDB, and every serious storage engine.

ScenarioPatternsReal Example
Crash recoveryWAL + CheckpointingPostgreSQL: WAL + periodic checkpoint
Write-heavy workloadLSM Tree + Bloom FilterLevelDB/RocksDB: memtable → SSTable + bloom skip
Range queries on diskB+ TreePostgreSQL btree index, SQLite
Concurrent reads/writesMVCCPostgreSQL tuple versioning, etcd revisions
Data integrity verificationMerkle TreeZFS block checksums, Git object store
Sorted key mergeMerge Iterator + Min HeapLevelDB compaction
Delete without immediate removalTombstoneCassandra tombstones, LevelDB deletion markers
In-memory sorted setSkip ListRedis ZADD/ZRANGE sorted sets
In-memory cacheLRU CacheRedis LRU eviction, Go groupcache
Event ordering without clocksLogical Clocketcd Raft log, DynamoDB version vectors

Frontend & UI Frameworks

React, Vue, and browser engines use these patterns every frame.

ScenarioPatternsReal Example
Virtual DOM diffingDiff / Patch + BitmaskReact reconciler: diff tree, apply minimal patches
Responsive renderingCooperative SchedulingReact Scheduler: yield every 5ms to stay under 16ms
Frame-safe state updatesDouble BufferingReact Fiber: workInProgress ↔ current tree swap
Avoid unnecessary re-rendersDirty FlagReact shouldComponentUpdate, Chromium layout
State managementObserver + State MachineRedux subscribe, XState finite states
Priority-based task schedulingMin HeapReact Scheduler priority queue

Distributed Systems

Patterns for systems that span multiple machines.

ScenarioPatternsReal Example
Consensus logWAL + Logical Clocketcd Raft: append-only log with term/index
Partition-tolerant routingConsistent HashingAmazon DynamoDB, Cassandra ring
Replicated stateState Machine + WALRaft: replicated state machine via log
Conflict-free replicationLogical Clock + TombstoneCRDTs, Dynamo-style last-write-wins
Data synchronizationMerkle TreeCassandra anti-entropy repair
Message-driven architectureActor Model + BackpressureAkka cluster, Erlang/OTP
Build/deploy pipelinesDependency Graph + Batch ProcessingCargo build graph, pnpm workspace

Runtime & Memory Management

How Go, CPython, V8, and game engines manage memory and execution.

ScenarioPatternsReal Example
Reduce GC pressureObject Pool + Free ListGo sync.Pool, Linux SLUB allocator
Phase-based allocationArena AllocatorRust bumpalo, Go arena (experimental)
Deterministic cleanupReference CountingCPython refcount, Rust Rc/Arc
String deduplicationInterning + FlyweightRust compiler symbol interning, Python small int cache
Efficient cloningCopy-on-WriteLinux fork(), Rust Cow<T>
Work distribution across coresWork StealingGo runtime P/M/G scheduler, Tokio
I/O multiplexingEvent Loop + Ring Bufferlibuv (Node.js), Redis single-thread
Thread-safe countersSemaphoreLinux kernel semaphores, Go x/sync

Compilers & Language Tools

Patterns used in LLVM, V8, rustc, and the Vue/React compilers.

ScenarioPatternsReal Example
AST traversalVisitorLLVM InstVisitor, Vue compiler transforms
Dynamic dispatchVtableCPython tp_* slots, Rust dyn Trait
Symbol tablesInterning + Trierustc Symbol interning
IR transformationsIterator + Diff / PatchRust Iterator adapters, tree-sitter edits
Type representationTagged UnionV8 tagged pointers, PyTorch TensorImpl
Plugin systemsRegistry + Middleware ChainBabel plugins, webpack loaders

Networking & Protocols

ScenarioPatternsReal Example
Connection state trackingState MachineLinux TCP state machine (SYN_SENT → ESTABLISHED → ...)
IP routingTrieLinux LC-trie for IPv4 FIB
Packet bufferingRing BufferLinux sk_buff, DPDK ring
Flow controlBackpressure + Rate LimiterTCP flow control, Nginx limit_req
DNS resolutionTrie + LRU CacheDomain name lookup + response cache

Released under the MIT License.