home
post
distributed "transactions" in microservices

Distributed "Transactions" in Microservices

Nov 26, 2023
1 min
4 charts

Transactions in microservices are not possible, because of the distributed nature of microservices. Though you can implement compensation mechanisms to handle failures in multiple microservices calls for one business action. There are patterns to handle this situation:

  • 2 Phase commit - pattern to check, wether microservice is able to write with this data before actually making the 'writing'.
  • Choreography-based saga - Multiple 'write' calls, where microservices are called in the chain. Each subsequent call of microservice knows how to rollback or compensate the 'write' call. This type of saga is easier to implement. It is More decoupled, than orchestration based saga. However, it is harder to grasp the whole business process.
  • Orchestration-based saga - This pattern implies, that you have an "orchestrator" microservice. It will calls different microservices and knows how to compensate fail 'write' call. The business process is easier to understand from the saga implementation. However, it introduces domain coupling on different microservice domains.

! what is worth mentioning: Do not implement sagas. Saga introduces complexity to your microservices (both book authors have the same opinion).

! ACID is not supported in the microservices

Microservices, 2nd edition by Sam Newman

Fundamentals of Software Architecture: An Engineering Approach 1st Edition by Mark Richards (Author), Neal Ford

Related Posts
© 2025 buzzchart.info