It is a story about a brave team who took the decision of taking over the parallel-run pattern among others and afforded to introduce and handle a multi-master system as a temporary step in a refactoring process.
6. smart insurance distribution
What is the biggest challenge?
● Aggregates related to organizations (core customer data) has to be redesigned to support
future use cases
● Show must go on: we have no possibility to freeze the development process for other
teams
Extract the organization data without freezing other teams
7. smart insurance distribution
What is the biggest challenge?
● What makes it harder:
○ core customer data is used by multiple clients (services), finding and addressing all of them requires substantial
efforts
● What makes it easier:
○ refactored data structures are critically required now only for 1 upcoming usecase (a 3rd party integration)
○ the rest of the system can migrate to the new data structures gradually as aligned with the product changes in
our roadmap
Extract the organization data without freezing other teams
8. smart insurance distribution
So, we have the following requirements for the refactoring
● Do not freeze the development
● Allow new use case implementation
● Make little to no changes to the monolith
● Single entrypoint
13. smart insurance distribution
What refactoring pattern did we choose?
13
R1 R2 R3 R4
Strangler Fig
Branch By Abstraction
Parallel Run
14. smart insurance distribution
Whatʼs the problem with multi-master ?
● ~1.5 person/year implementation cost in our case
● High potential for inconsistencies
● Non-zero risk of data corruption
● Expensive maintenance
Itʼs highly complicated to implement
15. smart insurance distribution
Why donʼt we afraid of multi-master and data-conflict?
- Data transaction rate is relatively low
- Most of crucial changes are handled by workflow and its orchestrator
- Temporary solution
- Monitoring & Alerting
- Release planning
- Domain Driven Design adoption
- Eventual Consistency Layer
-
16. smart insurance distribution
How Domain Driven Design helps us?
● Domain modeling and ubiquitous
language development
● Clear, understandable model that
reflects reality
● Single entrypoint and business
rules encapsulated in Aggregates
● Align and sync data via Domain
Events publishing
17. smart insurance distribution
How to sync data stored in different structures?
● Domain Events in the new systems
● Change Data Capture (CDC) for the
old one
● Align and sync data via Eventual
Consistency Layer
24. smart insurance distribution
CDC - good not only for ETL pipelines
● Easy to setup
● Single source of truth
● Reflects atomic changes
● No changes in Legacy Code Base
● Auditability
● Batch or Real-Time publish (Cron, Pullers, etc.)
-
25. smart insurance distribution
Eventual Consistency Layer
● Keeps data consistent across contexts. Eventually
● Encapsulate knowledge
● Handles changes order, can lock data if needed
● Contains consistency-fix/consistency-check endpoints
● Contains consistency-check job
● Audit
-
30. smart insurance distribution
Practical insights
● Monitoring & Auditability
● Do not trust your data
● Prepare a QA strategy
● Ensure the solution you choose is supported on your hosting, vm, cloud etc.
-