System design concepts · Talking Over the Network

Monolith vs Microservices: Architecture Styles Explained

Microservices are an organisational tool disguised as a technical one. Choose the architecture that matches your team, not the one in the conference talk.

What you'll be able to explain
  • Compare monoliths, modular monoliths, microservices and serverless
  • Recognise the hidden costs of distribution
  • Draw service boundaries around business capabilities
  • Migrate safely with the strangler pattern
  • Justify an architecture choice in an interview

The spectrum

MonolithOne codebase, one deploy, one databaseModular monolithOne deploy, but strict internal modules with clear interfacesMicroservicesMany small services, each with its own data and deploy pipelineServerless functionsEvent-triggered functions; the platform runs and scales them
From one deployable to many. Moving right buys independence and costs complexity.
Monolith Modular monolith Microservices
Deploy All at once All at once Independently
Calls between parts Function calls (ns) Function calls Network calls (ms, can fail)
Data One DB, joins easy One DB, module-owned tables DB per service, no cross joins
Team fit 1–3 teams 2–8 teams Many autonomous teams
Scaling Whole app Whole app Per service
Biggest risk Big ball of mud Boundary erosion Distributed monolith

The price of distribution

Every network call that replaces a function call brings:

  • Partial failure: the other side may be slow, down, or half-done.
  • Latency: each hop adds milliseconds; a chain of 6 services adds up.
  • Consistency: no more single-database transactions across boundaries (2PC vs Saga vs Outbox Pattern).
  • Operations: N pipelines, N dashboards, N on-call rotations, versioned contracts.
  • Debugging: you need distributed tracing to follow one request (Observability).
Common trap

The distributed monolith: services that must be deployed together, share a database, or call each other synchronously in long chains. You pay all the costs of microservices and get none of the independence.

Drawing boundaries

Good boundaries follow business capabilities (catalog, ordering, payments, delivery), not technical layers (a "database service", a "validation service"). Tests for a good boundary:

  1. Can one team own it end to end?
  2. Does it own its data, with others accessing only through its API or events?
  3. Can it be deployed without coordinating with other teams?
  4. Do most changes stay inside it?
NETWORKAPI gatewaySERVICECatalogSERVICEOrdersSERVICEPaymentsSERVICEDeliveryDATABASECatalog DBDATABASEOrders DBDATABASELedger DBDATABASEDelivery DBQUEUE / LOGEvent busauthorizeOrderPlaced
Services aligned to business capabilities, each owning its data, connected by events.

Migrating: the strangler pattern

Rewriting a monolith from scratch almost always fails. Instead, strangle it:

  1. Put a proxy (gateway) in front of the monolith.
  2. Build one new capability as a service; route its paths to the new service.
  3. Move data ownership for that capability; sync via events or CDC during transition.
  4. Repeat, capability by capability, until the monolith is small or gone.