Microservices create challenges for data consistency and integrity that necessitate changes in the transaction processing and data patterns used by them.
Traditional systems rely on two-phase commit and XA protocols that use synchronous communication, locking of resources, and recovery via rollback (or commit as the case may be). While this provides strong consistency and isolation it does not scale well in a microservices environment due to the latency of held locks and, therefore, is suitable for only a small subset of such use cases (generally those with lower throughput requirements)
The saga pattern uses asynchronous communication and local resources only (no distributed locks) and recovery via compensating actions. This scales well and so is well suited for long running transactions in a microservices environment. Additional application design considerations are necessary, however, for read isolation and compensation logic and debugging can be difficult. Read the complete article here
For regular information become a member in the Developer Partner Community please register here.