Consolidating Microservices Gone Wrong
Splitting a monolith is hard. Merging microservices back? Harder.
The plan:
- 10 tiny services doing related things
- Merge into 3 domain services
- Estimated: 6 weeks
The reality:
- Duration: 6 months
- Hidden async dependencies everywhere
- 3 different message queue patterns
- Schema incompatibilities
- Race conditions that only manifested at scale
What we discovered:
- Service A expected JSON, Service B sent XML
- Service C had undocumented caching assumptions
- Two services owned the same data concept differently
- Nobody knew the full dependency graph
Lessons:
- Document service contracts obsessively
- Maintain a live dependency graph
- Consolidation is a rewrite, not a refactor
- Consider the Strangler Fig pattern in reverse
Lesson: Splitting is (somewhat) reversible. The cost of reversal compounds with time.