47 topics
Microservice Patterns
Proven solutions for communication, data consistency, resilience and messaging between services — each one simulated so you can see why it exists.
Reliability & resilience
Circuit Breaker
Stop calling a dependency that is failing, fail fast instead, and probe carefully until it recovers — so one broken service cannot drag down everything that calls it.
PatternsRetry
Transparently repeat a failed call when the failure is likely temporary — with backoff, jitter and a strict limit, so retries heal glitches instead of amplifying outages.
PatternsTimeout
Put an upper bound on how long you wait for any remote call, so one hanging dependency cannot quietly hold every thread, connection and user request hostage.
PatternsBulkhead
Split resources into isolated compartments so one slow or failing dependency can exhaust only its own share — and everything else keeps working.
PatternsRate Limiting
Cap how many requests a client may make per unit of time to protect services from bursts and abuse — and pick the algorithm whose behaviour at the edges you can live with.
PatternsFallback
When a dependency fails, answer with something useful instead of an error — a default, a cached value or a reduced feature — so a non-essential failure never breaks an essential page.
PatternsBackpressure
When a consumer cannot keep up, push the problem back to the producer — bounded queues and 429 Retry-After — instead of buffering in memory until the process dies and takes accepted work with it.
PatternsLeader Election
When work must be done by exactly one of many identical instances — a scheduled job, a coordinator, a single writer — let them elect a leader with an expiring lease, and fence out a leader that comes back from the dead.
PatternsScheduler Agent Supervisor
Run a multi-step distributed workflow with three roles: a scheduler that drives the steps, agents that do the remote work, and a supervisor that finds steps that stalled or failed and retries or compensates them.
PatternsCommunication
API Gateway
Give clients one entry point that routes requests to the right service and handles authentication, rate limiting and response aggregation in one place.
PatternsSynchronous vs Asynchronous Communication
Calling services one after another couples their availability and latency; publishing events decouples them. See when each style fits — and what asynchrony costs.
PatternsPublish/Subscribe
Publish an event once and let any number of independent subscribers receive their own copy — new consumers can be added without touching the producer.
PatternsRequest/Reply over Messaging
Get an answer back through a message broker: send a request with a reply address and a correlation id, match replies as they arrive, and decide what a missing reply means.
PatternsService Discovery
Instances come and go with every deploy, crash and scale event. Service discovery keeps callers pointed at the instances that exist right now — from the client side via a registry, or from the server side via a load balancer.
PatternsAsynchronous Request-Reply
For work that takes seconds or minutes, answer at once with 202 Accepted and a status URL, do the work in the background, and let the client poll or be notified — instead of holding a connection open until something times out.
PatternsData management
Saga
Keep data consistent across services without a distributed transaction: run a sequence of local transactions and, when one fails, undo the completed ones with compensating actions.
PatternsTransactional Outbox
Save a business change and the event announcing it in the same database transaction, then publish the event from that table — so you never lose an event or publish one for a change that rolled back.
PatternsDatabase per Service
Give each service exclusive ownership of its data, so teams change schemas and scale storage independently — and one service's heavy queries cannot take down another.
PatternsCQRS
Separate the model that changes data from the model that reads it, so each can be designed and scaled for its job — and learn to live with read models that are slightly behind.
PatternsEvent Sourcing
Store every change as an immutable event and derive current state by replaying them — gaining a full audit trail and time travel, at the cost of replay time that snapshots must keep in check.
PatternsMessaging
Idempotent Consumer
Make processing a message twice have the same effect as processing it once, because every practical message broker will, sooner or later, deliver the same message more than once.
PatternsDead Letter Queue
Park messages that keep failing in a separate queue after a few attempts, so one poison message cannot block or burn a consumer forever — then fix the cause and redrive them.
PatternsCompeting Consumers
Let several identical workers pull from the same queue so throughput scales with the number of workers — and understand what you give up: ordering, and exactly-once processing.
PatternsQueue-Based Load Leveling
Put a queue between a bursty producer and a system that cannot scale, so the system works at a steady pace it can sustain while the queue absorbs the peaks.
PatternsPriority Queue
Let urgent work overtake routine work in a queue — with priority lanes or separate queues and consumers — so a batch flood never makes interactive users wait, without starving the batch forever.
PatternsClaim Check
Keep large payloads out of the message bus: store them in blob storage and send only a small token that points to them, so the broker stays fast, cheap and within its size limits.
PatternsPipes and Filters
Break a multi-step processing job into independent filters connected by queues (pipes), so each step can be scaled, deployed and diagnosed on its own — and a slow step is visible as a growing queue in front of it.
PatternsObservability & operations
Health Checks
Let the platform ask each instance "can you serve traffic?" so dead or warming instances are taken out of rotation — without building a health check that takes down the whole fleet.
PatternsDistributed Tracing
Follow one request through every service it touches as a tree of timed spans, so you can see exactly which hop made it slow or failed — something averages and per-service logs cannot show.
PatternsCentralized Logging
Ship every service's logs to one searchable place as structured events that carry a correlation id, so one failed request can be followed across all the services and instances it touched.
PatternsMetrics and Monitoring
Measure every service with a few standard signals — RED for requests, USE for resources — and alert on symptoms users feel, not on every cause you can think of.
PatternsArchitecture
Event-Driven Architecture
Build systems where services announce facts as events and others react. Learn the difference between event notification and event-carried state transfer, and what each costs.
PatternsBackend for Frontend (BFF)
Give each client experience — web, mobile, partners — its own thin backend that shapes data for that screen, so clients make one call instead of many over slow networks.
PatternsStrangler Fig
Replace a monolith piece by piece: put a routing facade in front of it, move one capability at a time to a new service, shift traffic gradually — and keep rollback one switch away.
PatternsMicroservices Architecture
Build a system as small services that are deployed, scaled and owned independently — and pay for it with network calls, partial failures and operational overhead.
PatternsModular Monolith
One deployable with strong internal module boundaries: the simplicity and speed of a monolith, structured so modules can be extracted into services later — when a real need appears.
PatternsService Decomposition
Where to draw service boundaries: by business capability, not by technical layer — and not so fine that every request becomes a fan-out of synchronous calls, a distributed monolith.
PatternsSidecar and Ambassador
Run cross-cutting networking — retries, timeouts, circuit breaking, TLS, metrics — in a helper process next to the application, so every service gets it without changing its code. A fleet of sidecars is a service mesh.
PatternsAnti-Corruption Layer
Put a translating façade between a new system and a legacy one, so the legacy model, protocols and quirks stay on the other side — and so you can cache, batch and protect the legacy system on the way.
PatternsUI Composition
Build pages from fragments owned by different teams — assembled on the server or in the browser — and give optional fragments their own deadlines, so one slow team cannot make the whole page slow.
PatternsSecurity
Valet Key
Give clients a short-lived, narrowly scoped token to read or write one resource directly in storage, so large transfers bypass your servers without handing out real credentials.
PatternsGatekeeper
Put a dedicated, minimal-privilege host in front of trusted services to validate and sanitise every request, so attacks and junk are rejected cheaply at the edge and the services holding secrets are never directly exposed.
PatternsFederated Identity and Access Tokens
Delegate sign-in to an identity provider and pass signed access tokens between services, so applications never handle passwords and can verify who the caller is locally — even when the identity provider is briefly down.
PatternsTesting & delivery
External Configuration Store
Keep settings, feature flags and secrets out of the deployable artefact, in a central store the application reads at runtime — so one image runs everywhere and a bad setting is fixed in seconds, not with a redeploy.
PatternsConsumer-Driven Contract Testing
Let each consumer publish the exact parts of an API it relies on, and make the provider's build verify them — so breaking changes are caught in CI instead of in production, without slow end-to-end test environments.
PatternsDeployment Patterns
Several services per host, one per VM, one per container, or serverless functions: how each packs, isolates and scales services — and why serverless trades idle cost for cold starts.
PatternsMicroservice Chassis and Service Template
Give every service the same production-ready foundation — logging, metrics, tracing, health checks, config, timeouts — through a shared chassis library and a template for new services, so safe defaults are the default.
Patterns