Level 06Foundations 30 min
Service Decomposition
Practical strategies for splitting a system into services: by capability, by subdomain, and via the Strangler Fig.
Decomposition strategies
There are two dominant strategies, both from microservices.io:
- Decompose by business capability — mirror what the business does: Order Management, Inventory, Customer Service, Billing. Stable over time because businesses rarely change what they do, only how.
- Decompose by DDD subdomain — classify subdomains as core (your competitive advantage), supporting, or generic (buy, don't build), and align services to them.
Rules of healthy boundaries
Whatever strategy you use, test each candidate boundary against these criteria:
- High cohesion — things that change together live together.
- Loose coupling — a service can change internals without breaking consumers.
- Data ownership — the service is the sole writer of its data.
- Team-sized — one two-pizza team can own it end to end.
- Independently valuable — it delivers a capability, not a technical layer (avoid 'entity services' like a bare CRUD 'User table service').
Common anti-patterns
Bad decomposition is worse than no decomposition — you pay distribution costs without gaining autonomy.
- Distributed monolith — services that must be deployed together. All the pain, none of the gain.
- Nanoservices — so fine-grained that overhead dwarfs functionality.
- Chatty services — one user action triggers a storm of synchronous calls between services (a sign the boundary cut through a cohesive workflow).
- Shared database — two services writing the same tables.
The Strangler Fig migration
You almost never rewrite a monolith big-bang. The Strangler Fig pattern (named by Fowler after vines that gradually envelop trees) migrates incrementally:
Put a routing facade (gateway) in front of the monolith
Pick one capability with clean seams
Build it as a service; route its traffic through the facade
Repeat capability by capability
Retire the monolith when nothing routes to it
Key takeaways
- Decompose by business capability or DDD subdomain — never by technical layer.
- Healthy boundaries: high cohesion, loose coupling, exclusive data ownership, team-sized.
- The distributed monolith is the worst outcome: distribution costs without autonomy.
- Migrate incrementally with the Strangler Fig pattern, never big-bang.
Knowledge check
Q1Multiple choice
What is a 'distributed monolith'?
Q2Scenario
Loading one product page triggers 14 synchronous calls across 6 services. What does this smell indicate?
Q3Multiple choice
In the Strangler Fig pattern, what role does the facade/gateway play?
Answer all questions to submit