Monolith vs microservices: the short answer
A monolith is an application deployed as a single unit. A microservices architecture splits the application into independent services, deployed separately and communicating over the network. A modular monolith is a monolith whose business domains are separated by strict internal boundaries.
For most small and mid-sized companies and most business applications, the modular monolith is the right default: it delivers most of the clarity people are after without the operating cost of a distributed system. Microservices are justified when several teams need to ship independently, or when one part of the system has load or availability needs very different from the rest. They solve an organisation and scale problem, not a code quality problem.
Definitions
The monolith
All the code is built, tested and deployed together, usually on top of a single database. Modules call each other through function calls, inside the same process. The word is often used as a criticism. Wrongly: it describes a deployment model, not a level of quality.
Microservices
The reference description comes from James Lewis and Martin Fowler: an application built as a suite of small services, each running in its own process and communicating through lightweight mechanisms, often an HTTP API (Microservices). Their article adds characteristics that matter as much as the technical split: services organised around business capabilities, decentralised data management, infrastructure automation and design for failure.
The modular monolith
A single deployment unit, but modules with explicit boundaries: each domain (billing, catalogue, accounts) exposes a public interface, keeps its tables to itself and does not reach into the internals of the others. Shopify described this choice on its engineering blog: keep one codebase and one deployment while enforcing strict boundaries between domains, rather than pay the cost of microservices (Deconstructing the Monolith).
The distributed monolith
This is the outcome to avoid: services deployed separately but so dependent on each other that they have to be released together. You then carry the drawbacks of both models.
An honest comparison
| (Modular) monolith | Microservices | |
|---|---|---|
| Deployment | One unit, one pipeline; a release ships everything | One pipeline per service; independent releases if contracts are stable |
| Team size | Suits one team or a few coordinated teams | Makes sense when several autonomous teams each own their services |
| Operations cost | Low: few components to host and monitor | High: orchestration, monitoring, security and networking multiplied by the number of services |
| Data consistency | ACID transactions in a single database | One database per service; eventual consistency and compensating transactions |
| Debugging | One call stack, one log, easy local reproduction | Distributed tracing required, partial failures, harder to reproduce |
| Performance | In-memory calls; the whole application scales as a block | Network latency on every call; each service scales on its own |
| Technology freedom | One shared stack | A different stack per service is possible, with the maintenance cost that goes with it |
| Fault isolation | A memory leak can affect the whole application | A failure can stay local, provided it was designed for |
No column wins everywhere. Microservices buy independence (of deployment, of scaling, of teams) and pay for it in operational complexity.
The modular monolith as the default
Martin Fowler sums up his position in MonolithFirst. He reports two observations from the projects he has heard about: almost all the successful microservice stories started with a monolith that grew too big, and almost all the systems built as microservices from scratch ran into serious trouble. He notes that this view is not unanimous. In MicroservicePremium he adds that microservices carry a premium that only pays off on complex systems.
Two reasons explain those observations. First, at the start of a product the priority is to learn quickly what users need, and the overhead of a distributed system slows that learning down. Second, microservices only work if the boundaries between services are right and stable. Moving a responsibility from one service to another costs far more than moving code between two modules of a monolith. It is better to discover the right boundaries inside a monolith, where a mistake is cheap to fix.
In practice, a serious modular monolith rests on a few rules:
- one module per business domain, with a small public interface;
- tables that belong to one module and are read by no other;
- dependencies between modules checked automatically in continuous integration;
- internal events for exchanges where direct coupling is not needed.
A monolith structured this way is ready for a service to be extracted on the day a real need appears.
The real prerequisites of microservices
In MicroservicePrerequisites, Fowler lists what must be mastered before a first microservice system goes to production:
- Rapid provisioning: being able to bring up a new server in a matter of hours, which requires automation.
- Basic monitoring: detecting technical problems (errors, availability) quickly and, ideally, business anomalies, and being able to roll back.
- Rapid application deployment: an automated deployment pipeline to test and production environments.
These capabilities imply close collaboration between development and operations. Beyond a handful of services, you also need to trace a business transaction across several services and to practise continuous delivery. In concrete terms: a reliable CI/CD pipeline, centralised logs, metrics, distributed tracing and infrastructure described as code.
The last prerequisite is human. Conway's law, set out by Melvin Conway in "How Do Committees Invent?" (1968), states that organisations produce systems whose structure copies their own communication structure. Microservices owned by a single team of five bring no autonomy: they only add network boundaries inside a team that did not need them. Fowler points out that splitting into services goes hand in hand with long-lived teams organised around business capabilities.
If these prerequisites are not in place, start with them. A monolith benefits from them just as much.
Signals that justify extracting a service
- A very different load profile. A heavy workload (document generation, computation, bulk import) forces you to size the whole application for it.
- A different release pace. One module changes ten times more often than the rest, and every release puts the whole application at risk.
- Teams in each other's way. Several teams modify the same code, and merge conflicts and release queues pile up.
- An isolation requirement. A scope subject to specific security or compliance constraints is better isolated, to reduce the surface to audit.
- A real technology need. Part of the system belongs to another ecosystem, for example a computation or AI component in Python next to a PHP or Java application.
- Differentiated availability. A critical function must stay reachable even when the rest is under maintenance.
Conversely, "the code is hard to maintain" is not a signal. Badly structured code stays badly structured once spread across services, with the network added. The answer in that case is refactoring or incremental modernization, not a change of deployment architecture.
Migrating incrementally from a monolith
- Modularise first. Draw the boundaries inside the monolith and enforce them. If a module cannot be isolated in the code, it cannot be isolated on the network.
- Pick a loosely coupled first candidate. A service at the edge (notifications, PDF generation, search) lets you rehearse deployment and monitoring without touching the core.
- Separate the data before the code. The module stops sharing its tables; everything else goes through its interface. This is the longest step, and the one that decides success.
- Put a routing facade in place. The Strangler Fig pattern applies as is: a proxy sends part of the calls to the new service and the rest to the monolith.
- Shift traffic in steps and measure. Errors, latency, data consistency: compare before raising the share of traffic.
- Delete the replaced code from the monolith, then pause and assess before extracting the next service.
Nothing obliges you to go all the way. A modular monolith surrounded by two or three well-chosen services is a perfectly legitimate target architecture. Sam Newman devotes a whole book to these migrations, Monolith to Microservices, and also argues for the incremental approach over the rewrite.
The costs people forget
The network
A function call becomes a network call: slower, liable to fail, in need of securing. The fallacies of distributed computing, formulated at Sun Microsystems in the 1990s, list the false assumptions developers make: that the network is reliable, that latency is zero, that bandwidth is infinite. Every call between services therefore needs timeouts, retries, idempotency and handling of partial failure.
Distributed transactions
With one database per service, a business operation that touches several services no longer fits in one transaction. The most common pattern is the saga, documented by Chris Richardson: a coordinated sequence of local transactions, driven either by event choreography or by an orchestrator. Its drawbacks are well known: you have to write the compensating transactions that undo steps already committed, and the lack of isolation exposes you to anomalies between concurrent sagas. In the same way, a query that used to join three tables becomes a composition of calls between services.
The infrastructure bill
Each service brings its instances, often its own database, its load balancing, its logs, its metrics, and sometimes a message bus and an API gateway. The baseline consumption of a microservice system exceeds that of an equivalent monolith before it serves its first request. In the cloud this shows up directly on the invoice; we cover that sizing in architecting a PHP application on AWS, from MVP to scale.
Team time
Versioning API contracts, maintaining a local environment that starts ten services, coordinating a cross-cutting change, staying on call for a system with partial failures: none of that time is spent on the product.
Frequently asked questions
What is the difference between a monolith and microservices?
A monolith is deployed as a single unit and its modules call each other in memory. Microservices are deployed separately, each owns its data, and they communicate over the network. The difference is about deployment and operations, not about code quality.
What are the advantages and disadvantages of microservices?
Advantages: independent deployments, service-by-service scaling, team autonomy, fault isolation. Disadvantages: heavier operations, harder data consistency, distributed debugging, network latency and a higher infrastructure bill. The advantages only materialise if the automation and organisational prerequisites are in place.
What is a modular monolith?
It is an application deployed as one block but split into modules with strict boundaries, each with its own interface and data. It gives the readability of a domain-based split without the costs of a distributed system, and prepares the ground for extracting a service later.
When should you move from a monolith to microservices?
When a concrete signal appears: part of the system has a very different load profile or release pace, or several teams are blocking each other. You then extract that specific service, not everything. Without a signal of that kind, modularising the monolith is enough.
Are microservices faster than a monolith?
Not by nature. For the same work, an in-memory call is faster than a network call. Microservices do, however, let you scale the busiest part separately, which can improve how a system with very uneven needs behaves under load.
Conclusion
Choosing between a monolith and microservices is first of all an organisational question: how many teams, how much autonomy, what operational capabilities. For a small or mid-sized company, a well-kept modular monolith covers the great majority of needs and leaves the door open. Microservices have to be earned: they require an automated delivery chain, observability and teams able to own a service end to end. Between the two, extracting one or two services when a precise signal justifies it is often the most cost-effective decision.
To have your architecture assessed or to prepare a change, write to us at contact@your-digital-hub.com or see our legacy application modernization and cloud migration and hosting services. You can also describe your architecture project on our contact page.