Software Engineeringunpacked

Monolith vs microservices: what each one is, what microservices really cost, and which to start with

A monolith is one application built and deployed as a single unit, usually with one database. Microservices split the same application into small services that each run in their own process, talk over the network, own their own data and can be deployed and scaled on their own. Microservices buy independent deploys, strong boundaries and per-service scaling, and they pay for it with slower and less reliable network calls, data spread across services and much more to operate. That is why Martin Fowler suggests starting most new systems as a monolith and splitting it once the boundaries are clear.

Video · Monolith vs microservices: which should you start with? · 0:48

Monolith vs microservices, in one paragraph

Prefer to watch? The one-minute Short shows the core idea with diagrams; this guide goes further.

This is one of the first big choices in any backend project, and it is often made for the wrong reasons. This guide covers what each style really is, what microservices cost, and how to decide.

Picture a restaurant. A monolith is one kitchen where every dish is cooked: one team, one room, one set of rules. Microservices are a food court: each stall has its own cooks, its own fridge and its own opening hours. A stall can change its menu without asking the others, but now every combined order means walking between stalls.

That is the whole trade in miniature. The rest of this guide puts real software terms on it.

What is a monolithic architecture?

A monolith is an application built and deployed as a single unit. Inside, the code can be split into modules (users, orders, payments, search), but they all compile into one program, run in one process and usually share one database.

Martin Fowler and James Lewis describe it plainly in their 2014 article on microservices: a change to a small part of a monolith "requires the entire monolith to be rebuilt and deployed", and scaling means running more copies of the whole application.

That sounds like a drawback, and at a large size it is. At a small size it is a gift. A function call between two modules takes nanoseconds and never times out. A database transaction can update an order and its payment together, all or nothing. You have one thing to build, one thing to test, one thing to deploy and one place to look when something breaks.

What are microservices?

Microservices split one application into a suite of small services, each running in its own process. In Fowler and Lewis's definition, the services:

So the Orders service does not read the Payments tables. It asks the Payments service over the network, the same kind of request your browser makes when it loads a web page.

The article also names a few habits that come with the style: the team that builds a service also runs it in production (Amazon's "you build, you run it"), the logic lives in the services while the network just carries messages ("smart endpoints and dumb pipes"), and every service must expect its neighbours to fail.

Monolith vs microservices: the differences at a glance

Monolith Microservices
Deploy the whole app at once each service on its own
Scale copy the whole app scale only the busy services
Calls between parts in memory, fast, never lost over the network, slower, can fail
Data usually one shared database each service owns its data
Consistency transactions across modules eventual consistency between services
Technology one language and framework can differ per service
Teams everyone in one codebase one team per service
Operations one thing to run and watch many services, pipelines and dashboards
Debugging one stack trace a request crosses many services

Neither column is "better". The left one is simpler; the right one is more flexible, at a price.

Why teams choose microservices

Fowler's 2015 article on microservice trade offs lists three real benefits.

Strong module boundaries. In a monolith, nothing stops one module from reaching into another's internals, and over the years the code tends to tangle. A service boundary is hard to cross by accident: the only way in is the API. Fowler notes this matters most for larger teams.

Independent deployment. A small service is quicker to build, test and release. The Payments team can ship five times a day without waiting for the Search team, and a bad release is more likely to break one feature than the whole product.

Technology diversity. Each service can use the language, framework or database that suits it best, and upgrade its libraries on its own schedule.

There is also independent scaling: if search gets ten times the traffic of checkout, you can run ten copies of Search and two of Checkout instead of ten copies of everything.

The real costs of microservices

The same article is just as clear about the costs. They are easy to underestimate, so take them one by one.

Distribution. A call that used to be a function call is now a network request. It is much slower, and it can fail or hang. Every caller needs timeouts, retries and a plan for when the other service is down. Keeping a connection open, as a WebSocket does, saves the setup time but not the risk. A page that touches six services is only as fast as the slowest one, and only works if all six answer.

Distributed data. Once each service owns its database, you lose the simple transaction that updated an order and its payment together. Fowler points out that strong consistency is very hard in a distributed system, so most teams accept eventual consistency: for a moment, Orders may say "paid" before Shipping knows about it. Your code and your users have to live with that window.

Operational complexity. Many services, each deployed often, need automated pipelines (the kind you build with GitHub Actions), central logs, metrics, tracing and alerts. Fowler's words are that you need a mature operations team to run them. Testing changes too: you now need checks that services still agree on their APIs, the contract tests described in our guide to types of software testing.

Wrong boundaries are expensive. Moving a function between two modules is a refactor. Moving it between two services means changing two APIs, two deployments and maybe migrating data. Draw the lines in the wrong place and you get a "distributed monolith": all the costs of microservices, and services that still have to be released together.

Monolith first: when a monolith is the better start

In his 2015 note MonolithFirst, Martin Fowler reports a pattern he kept seeing. Almost all the successful microservice stories started with a monolith that grew too big and was broken up, and almost every system he heard of that was built as microservices from scratch ended up in serious trouble.

His reasons are practical:

  1. Speed matters most at the start. A new product needs to learn quickly whether anyone wants it. The extra work microservices demand, which he calls the microservice premium, slows that learning down.
  2. You do not know the boundaries yet. The right split only becomes clear after you have built and used the system for a while. Inside a monolith, fixing a wrong boundary is cheap.

He is careful to call the evidence thin and to mention people who disagree, and he describes a middle path: start with a few coarse services instead of many small ones. But as a default for a small team and a new product, a well structured monolith, with clear modules that talk through clean interfaces, is the safer bet. Those clean interfaces are exactly what makes a later split possible.

A monolith is usually the right choice when:

Microservices start to earn their cost when many teams keep blocking each other in one codebase, when parts of the system need very different scaling or release speeds, and when you already have the automation to run many services well.

How to move from a monolith to microservices

If the monolith does grow too big, do not rewrite it all at once. Fowler describes the strangler fig approach, named after a vine that grows around a tree until it can stand on its own:

  1. Pick one part with a clear boundary and real pressure behind it, for example image processing or notifications.
  2. Build it as a separate service, with its own data, next to the monolith.
  3. Route the matching requests to the new service, and remove the old code from the monolith.
  4. Repeat, one piece at a time, only while splitting keeps paying off.

Each step ships value on its own, and you can stop at any point. Many healthy systems end up as a monolith plus a handful of services, and that is a perfectly good place to stop.

The same "small steps, one boundary at a time" thinking shows up in AI systems too: a multi agent system is only worth its coordination cost when one agent truly cannot do the job.

The short version

Sources: Martin Fowler and James Lewis, Microservices (2014) · Martin Fowler, Microservice Trade Offs (2015) · Martin Fowler, MonolithFirst (2015) · Martin Fowler, Strangler Fig Application

FAQ

What is the difference between a monolith and microservices?

A monolith is one application deployed as a single unit, so any change means rebuilding and redeploying the whole thing. Microservices split the application into small services that each run in their own process, communicate over the network (often HTTP), manage their own data and can be deployed and scaled independently.

Are microservices better than a monolith?

Not in general. Microservices help large teams ship independently and scale parts of a system separately, but they add network latency, partial failures, eventual consistency and a lot of operational work. For a small team or a new product, a well structured monolith is usually faster to build and easier to run.

Should I start with a monolith or microservices?

Martin Fowler's MonolithFirst advice is to start with a monolith, even if you expect to need microservices later, because early on you do not yet know where the right service boundaries are, and moving code between services is far harder than moving it between modules.

What are the disadvantages of microservices?

Calls between services cross the network, so they are slower and can fail; data lives in many databases, so keeping it consistent is hard; and you need automated deployment, monitoring and an experienced operations team to run many services that change often.

How do you move from a monolith to microservices?

Gradually. Pull out one well understood part with a clear boundary, run it as a service next to the monolith, route its traffic to the new service, and repeat. Martin Fowler calls this the strangler fig approach, after the vine that slowly grows around a tree.