Bookmarks

Distributed monolith

An anti-pattern: a set of services that cannot be released piece by piece — any change requires the coordinated deployment of several parts of the system at once.

Also: distributed monolithic architecture

checked 8 Nov

All terms

When a system is split into services but the links between them remain monolithic, the result is a distributed monolith: the shape is that of microservices, but releases are shared. A change in one service forces the neighbouring services to be rebuilt and redeployed, so the cost of a distributed system is paid from day one, while its benefits — independent teams and releases in small increments — never materialise.

How to recognise one

  • two or more services have to be deployed together: the “payments” release does not go out without re-releasing “orders” and “inventory”;
  • “chatty” synchronous calls: a single client operation triggers a long chain of network requests;
  • a shared database, or reading other services’ tables directly, bypassing the owner’s API, and the like;
  • a small change calls for a coordinated release across several teams and lengthy testing of the whole system;
  • a failure in one service stops the whole chain, not just its own function.

Microservices and a distributed monolith

AspectMicroservicesDistributed monolith
Deploymenteach service on its ownonly as a group or as the whole system
Callsa few coarse-grained operations, not a network call at every stepsynchronous chains of fine-grained requests
Dataits own database, other services’ data via the owner’s APIa shared database or direct reads of other services’ tables
Releasea team releases its service when it is readya coordinated release across several teams

Where it comes from and how it is fixed

Splitting a system along technical layers often ends this way: instead of bounded contexts, teams carve out a presentation service, a business-logic service and a data-access service — and every operation travels the whole chain. The Azure guidance tests service boundaries against two criteria: no “chatty” calls between services and no dependencies that force two or more services to be deployed together. If two services constantly call each other, they may really be one service — and are merged back together. When in doubt, services are made larger: splitting one service in two is easier than moving functionality between existing ones. Where a call merely passes work on, a queue or an event is cheaper: for example, incoming requests are placed in a buffer queue, and the delivery history is assembled from the delivery service’s events. Fowler advises not to consider microservices as long as the system can be run as a monolith, with modularity kept inside it.

Sources

the term is written from these pages

Verified 8 Nov

Not to be confused with

what it is mixed up with and how it differs

  • monolith

    A conventional monolith lives as a single process and makes no secret of it; a distributed monolith is broken up into services, but the links remain monolithic — now across the network.

  • microservices

    True microservices are deployed and changed independently; a distributed monolith merely copies their shape — the services have grown together through shared releases.

In depth in the references

where the topic is covered in detail