[reference] — from the roadmap.sh system-design roadmap. The infrastructure patterns that make a microservices architecture actually workable — the machinery you inherit the moment you split a system across the network.
The problem: coordination at a distance
Split one app into dozens of services and you create new problems the monolith never had: how do services find each other? how do clients avoid knowing the internal topology? how do cross-cutting concerns get handled without duplicating them in every service? These patterns answer those.
Service Discovery
Services scale up/down and move (new instances, failures, k8s reschedules), so their addresses aren’t fixed. Service discovery lets a service find the current healthy instances of another by name rather than a hardcoded IP:
- Server-side — the caller hits a load balancer that knows the instances (k8s Services work this way).
- Client-side — the caller queries a service registry (Consul, etcd, Eureka) and picks an instance itself.
The registry is kept current by health checks. This is what makes “call the payment service” resolve to a live instance despite constant churn — and it relies on distributed-systems machinery underneath.
API Gateway
The single entry point for external clients (from load balancing): it routes to the right service and centralizes cross-cutting concerns — authentication, rate limiting, TLS, logging — so each service doesn’t reimplement them. Two related patterns:
- Gateway aggregation — combine multiple service calls into one client response (so the client makes one request, not six).
- Gateway offloading — move shared functionality (auth, SSL) into the gateway.
Keep the gateway thin (routing + cross-cutting only) — business logic in the gateway recreates a monolith and a bottleneck.
Backends for Frontends (BFF)
Instead of one API serving all clients, give each client type (web, mobile, third-party) its own gateway/backend tailored to its needs — the mobile BFF returns lean payloads, the web BFF returns richer ones. Avoids the compromise of a one-size-fits-all API (the over/under-fetching problem GraphQL also addresses). Relevant to your full-stack work where one product has web + mobile clients (Arete).
Sidecar & Ambassador
Deploy a helper alongside each service (in the same pod) to handle infrastructure concerns, so the service code stays focused on business logic:
- Sidecar — a companion container adding capabilities (logging, config, TLS, metrics) without changing the service. The basis of a service mesh (an Envoy sidecar per service handling all networking — mTLS, retries, observability — transparently).
- Ambassador — a sidecar specifically for outbound calls (proxying/managing connections to external services).
Leader Election
When multiple instances of a service run for availability but only one should perform a task at a time (a scheduled job, a coordinator), they must agree on a leader — and re-elect if it dies. This is a consensus problem, and you almost never implement it by hand: you lean on a coordination service (etcd, ZooKeeper, or the platform) that provides it. It’s the bridge where microservices patterns meet distributed-systems theory.
Cross-cutting: observability
The pattern that makes microservices operable: because a request now spans many services, you need distributed tracing (a request/trace ID threaded through every hop), centralized logging, and per-service health endpoints — or debugging becomes impossible. This isn’t optional the way it is in a monolith; it’s the price of admission.
The honest summary
These patterns are powerful, but note what they represent: a whole platform of complexity that a monolith gets for free (in-process calls need no discovery, one process needs no gateway, one app needs no distributed tracing). That’s the real cost of microservices (when to adopt them) — you’re signing up to build and run all of this. Managed platforms (Kubernetes, service meshes) provide much of it, which is exactly why they exist.
Related
- Monolith / Microservices / Serverless — whether to take this on at all
- Orchestration (devops) — the platform that provides these
- Consensus — the theory under service discovery & leader election
Software engineering
Infrastructure & security
Computer science
Hardware & engineering