SFSENFORGEENGINEERING
← Engineering Journal
Architecture

The Distributed Monolith Anti-Pattern and How to Escape It

Many teams split their monolith into services without splitting the data model. The result is a distributed monolith — worse than both architectures it tried to replace.

2024-11-22
10 min
SenForge Engineering
Share

The distributed monolith is one of the most common outcomes of a microservices migration done wrong. It has all the operational complexity of distributed systems and none of the independence that makes microservices worth the cost.

How It Happens

The pattern emerges when teams decompose application code into services but leave the data model intact. Services share a database, call each other synchronously across service boundaries, and deploy in lockstep. The codebase is physically split across repos, but the system behaves like a monolith — a deployment to one service requires coordinating with three others.

If you cannot deploy service A without coordinating with service B, you do not have microservices. You have a distributed monolith.

The Symptoms

Distributed monoliths are recognisable by their symptoms: shared database tables across service boundaries, synchronous HTTP chains where Service A calls B calls C to handle a single request, deployment pipelines that require multiple services to release together, and integration test suites that must run the entire system to test any part of it.

The Escape Path

The exit requires three parallel workstreams. First, data decomposition: each service must own its data. This means migrating shared tables to service-private schemas and eliminating cross-service database joins. Second, async communication: synchronous call chains must be replaced with event-driven patterns — domain events published to a message broker, consumed asynchronously by downstream services. Third, contract testing: once services stop calling each other synchronously, contract tests replace integration tests as the primary correctness signal.

None of this is fast. The escape from a distributed monolith is measured in quarters, not sprints. But the organisations that invest in it gain the deployment independence and fault isolation that microservices actually promise.