Skip to content
System Design Lab
Microservice Patterns

Microservices 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.

Intermediate 4 min read· Updated 2026-11-18

What you will learn

  • Explain what microservices buy: independent deployment, scaling and ownership.
  • See the cost: network latency, partial failure and more moving parts.
  • Recognise why unguarded synchronous calls spread failures.
  • Decide when microservices are worth it — and when a monolith is better.

Overview

A food court has separate stalls: the noodle stall can change its menu, hire staff or close for renovation without affecting the pizza stall. A single big restaurant kitchen is simpler to run — but if it closes for renovation, nobody eats.

In a microservices architecture each business capability runs as its own service with its own codebase, deployment pipeline and data, owned by one team. Services talk over the network (HTTP, gRPC, events). The gains are organisational and operational: teams ship independently, services scale independently, and a fault can stay contained. The cost is that every interaction is now a distributed system problem.

Run it

80% of traffic browses the catalog, 20% checks out. A redeploys the monolith; B redeploys only the payment service; C makes the payment provider very slow with no timeouts. Compare the four tiles for browse and checkout.

Loading simulation…

Monolith vs microservices

MonolithMicroservices
DeployEverything togetherPer service, many times a day
ScaleThe whole applicationOnly the busy service
Calls between partsIn-process, nanoseconds, never failNetwork, milliseconds, can fail or hang
DataOne database, ACID transactionsDatabase per service, sagas, eventual consistency
OperationsOne thing to run and observeMany pipelines, dashboards, on-call rotations
FitsSmall teams, unclear domain, early productMany teams, clear boundaries, different scaling needs

What you need before it works

Each service deploys on its own
# payment-service/.github/workflows/deploy.yml — no other service is rebuilt or restarted
on:
  push:
    branches: [main]
    paths: ["payment-service/**"]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: ./gradlew :payment-service:test :payment-service:bootBuildImage
      - run: kubectl rollout restart deployment/payment -n shop   # rolling, other services untouched

Trade-offs

BenefitsCosts
DeliveryTeams deploy independently and often.Cross-service changes need versioned contracts and coordination.
ReliabilityFailures can be contained to one capability.Only with resilience patterns — otherwise failures cascade through synchronous calls.
CostScale only the parts under load.More infrastructure, tooling and operational skill.

Production considerations

  • Prefer asynchronous events for things that do not need an immediate answer.
  • Keep call chains short; a request touching ten services is a design smell.
  • Version APIs and events; never break consumers without notice.
  • Give each service one owning team, its own runbook and its own alerts.

Further reading

Related topics