sys-d
// distributed systems lab
Fixed Window CounterSliding Window LogSliding Window CounterToken BucketLeaky Bucket
Circuit BreakerRetry with BackoffTimeout WrapperBulkheadHedged RequestsFallback Strategy
LRU CacheLFU CacheTTL CacheCache AsideWrite-Through/BackCache StampedeBloom Filter
Round RobinWeighted Round RobinLeast ConnectionsIP HashingConsistent Hashing
In-Memory QueuePub/Sub BrokerAt-Most-OnceAt-Least-OnceDead Letter QueueConsumer GroupsPartitioned Log
Distributed LockLeader ElectionHeartbeat MonitorService RegistryService Discovery
Primary-ReplicaRead/Write QuorumVector ClocksCRDT Counters
Two Phase CommitThree Phase CommitSimplified Raft
Key-Value StoreAppend-Only LogWrite Ahead LogSSTableLSM Tree
Metrics CollectorHistogramStructured LoggerTrace ID Propagation
JWT ValidationAPI Key ValidationIdempotency KeyHMAC Verification
v1.0 · MIT
resilience

Resilience Patterns

Patterns that help distributed services degrade gracefully under failure, preventing cascading outages.

// concept

In distributed systems, failures are inevitable. Resilience patterns protect your system by detecting failures early, isolating them, and recovering automatically — rather than letting a single failing component take down the entire service.

Circuit Breaker

Prevent cascading failures by switching between CLOSED, OPEN, and HALF_OPEN states based on failure thresholds.

Retry with Backoff

Automatically retry failed operations with exponentially increasing delays and optional jitter to avoid thundering herds.

Timeout Wrapper

Race an async operation against a deadline — if it takes too long, abort and fail fast instead of waiting forever.

Bulkhead

Isolate concurrent workloads with execution slots and a bounded queue — prevent one overwhelmed resource from starving others.

Hedged Requests

Fire duplicate requests after a delay and use whichever responds first — tame tail latency by racing redundant calls.

Fallback Strategy

Chain alternative providers to gracefully degrade — try primary, then secondary, cache, and finally a static default.