Programming
We provide developers and engineers the guides and tutorials they...
Search
We provide developers and engineers the guides and tutorials they...
Content is king. It's not just about how you're going to write, b...
Looking for an engaging connection with thousands of other people...
Monolith vs microservices compared: deployment, scaling, team autonomy, data and failure modes, the modular monolith, and why some teams move back.
Quick answer: A monolith is one application, built and deployed as a single unit, usually with one database. Microservices split the system into many small services, each owning its own data, deployed independently and talking over the network. Microservices let large organisations ship and scale parts of a system independently, but they add the full difficulty of distributed systems: network failures, data consistency, and far more operational work. Companies move to microservices when a monolith slows many teams down, and some move back when the overhead outweighs the benefit. For most teams, a well-structured monolith is the right starting point.
Martin Fowler and James Lewis's article Microservices gave the style its common definition:
| Monolith | Microservices | |
|---|---|---|
| Deployment | One unit; everything ships together | Each service ships on its own |
| Calls between parts | In-process, fast, reliable | Over the network, slower, can fail |
| Data | One database, ACID transactions | A database per service, eventual consistency |
| Scaling | Scale the whole app | Scale individual services |
| Technology | One stack | Mixed, per service |
| Team fit | One team or a few | Many autonomous teams |
| Local development | Run one thing | Run or mock many things |
| Debugging | One stack trace | A trace across many services |
| Operational overhead | Low | High |
The underlying force is organisational. Conway's law observes that systems tend to mirror the communication structure of the organisations that build them. Microservices are as much a way to structure teams as to structure software.
Every function call that becomes a network call inherits the problems described in why distributed systems are hard:
Small teams often find they have traded a code organisation problem for an infrastructure problem.
The worst outcome is splitting the code into services without achieving independence:
This has all the costs of microservices and none of the benefits. It usually comes from splitting by technical layer, or drawing boundaries before the domain was understood.
Several well-known engineering teams have publicly described consolidating services back into fewer, larger ones. The common reasons:
Moving back is not failure. It reflects that the right architecture depends on the organisation's size and the problem's shape, and both change.
You can get much of the benefit of clear boundaries without the network:
A modular monolith is easier to operate and gives you well-defined seams. If one module later needs independent scaling or its own team, it can be extracted into a service with far less risk. Fowler's Monolith First argues exactly this: start with a monolith, and split it only once you understand where the boundaries belong.
Stay with (or start with) a monolith if:
Consider microservices if:
If you split, do it gradually:
Not inherently. They solve problems of scale in teams and traffic, and create problems of complexity. Many successful products run on monoliths.
Big enough to own a complete business capability and be run by one team. Size in lines of code is not the measure.
A single deployable application with strongly enforced internal module boundaries. It offers clear structure without distributed-system overhead.
They can, but it couples them tightly: a schema change can break several services. Each service owning its data is a core principle of the style.
Monolith versus microservices is a trade between simplicity and independence. A monolith keeps everything in one place and easy to reason about. Microservices let many teams move separately, at the price of distributed complexity. Start simple, keep modules clean, and split only when a specific, real pain justifies it.