Reusable design patterns for distributed systems.
The app checks the cache first and loads from the database only on a miss — the default caching strategy.
Command Query Responsibility Segregation splits the write model from the read model, letting each be optimized independently and often synced via events.
A saga coordinates a distributed transaction as a sequence of local transactions, each with a compensating action to undo work on failure — via choreography or orchestration.
Wrap calls to a failing dependency in a breaker that trips open after repeated failures, fails fast, and probes for recovery — preventing cascading failure.
Isolate resources like thread pools and connection pools into partitions so a failure or overload in one area cannot sink the entire system.
Publishers emit events to a topic and subscribers consume them independently, decoupled through a broker so producers and consumers never know each other.
Persist state as an append-only log of immutable events; current state is derived by replaying events, giving a full audit history and time-travel.
Automatically retry transient failures using exponential backoff with jitter, bounded attempts, and idempotent operations to avoid duplicate side effects.
Write the business change and an outbox row in one local transaction, then relay outbox rows to the broker — solving the dual-write problem reliably.
Every write updates both the cache and the database synchronously, keeping the cache always fresh at the cost of higher write latency.
Writes go to the cache and are acknowledged immediately, then flushed to the database asynchronously — fast writes at the risk of loss on crash.