A belief that does the rounds in architecture discussions: “If we break the monolith into microservices, our teams will become independent.” It sounds reasonable. It is also false often enough that there is a name for what happens when it fails: the distributed monolith.
Let us take the belief apart.
Independence is a property of dependencies, not of deployment units
A service boundary is a network boundary. It says nothing about whether the pieces on either side can change separately. If service A cannot be released without simultaneously releasing service B, then you have two deployable artefacts and one unit of change. You have a monolith whose method calls have been replaced by HTTP calls.
That is the definition worth remembering: a distributed monolith is a system split into services that still have to be changed, tested, and deployed together. It carries all the costs of distribution (latency, partial failure, harder debugging, more infrastructure) and almost none of the benefits.
Symptoms you can check this week
You do not need a diagram to spot one. Look for these:
- Releases are coordinated. Someone maintains a spreadsheet or a calendar that says “deploy order-service, then payment-service, then notification-service, in that sequence”.
- A small feature change touches three or four repositories and needs three or four pull requests merged together.
- Several services read and write the same database tables. One team’s schema change breaks another team’s service.
- A single user request passes synchronously through a long chain of services, and if any one is down, the whole feature is down.
- Integration testing needs the entire fleet running together in one environment, because individual services cannot be verified alone.
- A shared library holds business models, and every service must upgrade it at the same time.
One or two of these may be tolerable. If most are true, you are in distributed monolith territory.
How teams end up here
The usual route is splitting by technical layer or by noun rather than by business capability. A “user service”, an “order service”, a “product service”, and a “validation service”, cut up because the old code had those folders. But real business operations, like placing an order, cut across all of them. Every meaningful change now involves every service.
The second route is the shared database. It is the easiest shortcut: services stay separate in code but keep using the one PostgreSQL schema. The database becomes the hidden contract. Nobody can rename a column without a company-wide announcement. This is the single most common cause I would point to, though I cannot give you a statistic for it.
The third is synchronous chaining. If a customer-facing request calls service A, which calls B, which calls C, availability multiplies. Suppose each service is up 99.9% of the time. Three in sequence give about 99.7% (0.999 cubed is roughly 0.997), and six give about 99.4%. Add retries at every hop, and a brief problem in the last service can amplify into a flood of traffic. The numbers look small, but 99.4% means around 52 hours of unavailability a year, compared with about 8.8 hours at 99.9%.
Fixing it: start with the boundaries, not the code
The remedy is rarely “more services” or, surprisingly, “fewer services”. It is better boundaries. Roughly in order of payoff:
First, give each service ownership of its own data. Other services ask for it through an API or receive events, but never reach into its tables. This is slow, painful work in an existing system; do it one table at a time, and expect a period where data is copied.
Second, re-draw boundaries around business capabilities, using ideas such as bounded contexts from Domain-Driven Design. A good boundary is one where most changes stay inside it. If two services always change together, ask honestly whether they are one service.
Third, replace synchronous chains with asynchronous messaging wherever the business allows. Does placing an order really need to wait for the email service? Publish an event and let it be consumed later. Where a synchronous call is unavoidable, set timeouts, and put a limit on retries.
Fourth, make interfaces versioned and backward compatible, so a provider can deploy without forcing consumers to deploy at the same moment. Contract tests, where a consumer’s expectations are checked against the provider’s build, replace the need for a giant shared test environment.
Merging back is allowed
Here is the unpopular opinion: sometimes the right fix is to merge services back together. If five services are always deployed as one and owned by one team of six people, a well-structured single application, a modular monolith, would be simpler, faster, and cheaper to run. In 2023, an Amazon Prime Video team published an account of moving one video-monitoring workload from a distributed design back to a single process and reporting a large reduction in cost; the lesson people took was not “microservices are bad”, but that the unit of deployment should match the unit of change.
A simple test before splitting anything: can this piece be built, tested and released by one team without asking another team’s permission, and does it still work if its neighbours are down for ten minutes? If the answer to both is yes, a separate service might earn its keep. If not, keep it inside the same codebase and put the effort into clean modules instead. You can always split later; splitting a tangle is much harder than extracting a clean module.
Independence, in the end, is something you design through ownership of data, stable contracts and tolerant communication. A network cable between two pieces of code supplies none of it.
Leave a Reply