Video in progress
A big monolith written by one team is now being split among 8 teams. How do you define service and team boundaries?
I draw boundaries by business capability and data ownership, not by technical layer: things that change together stay together. Event storming and the history of what changes together in the code give candidate boundaries, and the team structure adapts to them, since Conway's law applies anyway.
📖 Answer
The most common mistake is splitting by noun or technical layer, like "User service" or "Notification service". The result: every feature touches 4 services and 4 teams have to agree. The monolith's difficulties stay, and you add a network on top: a distributed monolith.
How I work:
-
Business capabilities. Event storming with the business: "order placed", "payment went through", "courier assigned"... Groups form around the events, and these are bounded context candidates. A place where one word is used with different meanings ("customer" in sales and in billing) is a boundary signal.
-
Code history. Using
git log, see which files change together. If you split modules that always change together into two services, every release needs coordination. -
Data ownership. Every table has exactly one owner. If 6 modules write to
ordersin the monolith, you first have to gather those write paths into one module before splitting. -
Transaction boundaries. What must change together strictly is one service. If you split it, you pay the cost of sagas and eventual consistency; at each boundary I ask "is this worth it?".
-
Team load. A team owns one or several contexts, but a single context isn't split between two teams. The size criterion is the volume a team can understand and deploy independently, not the word "micro".
Practical steps:
- first modules inside the monolith: enforce boundaries between packages with ArchUnit or Spring Modulith. If a boundary is wrong, fixing it here is cheap;
- then split off the most independent and most frequently changing module first, so the benefit shows quickly;
- redrawing boundaries when the business changes is normal, so I write the reasoning in an ADR.
The success criteria: "how many teams must agree for one feature" and "can a team deploy without waiting for another". If those numbers don't improve, a higher service count means nothing.
Sign up to mark studied questions and save your progress.