The spectrum
| 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:
- Can one team own it end to end?
- Does it own its data, with others accessing only through its API or events?
- Can it be deployed without coordinating with other teams?
- Do most changes stay inside it?
Migrating: the strangler pattern
Rewriting a monolith from scratch almost always fails. Instead, strangle it:
- Put a proxy (gateway) in front of the monolith.
- Build one new capability as a service; route its paths to the new service.
- Move data ownership for that capability; sync via events or CDC during transition.
- Repeat, capability by capability, until the monolith is small or gone.