Explain how the Saga pattern manages distributed transactions and how you handle a failure in the middle of a multi-service workflow with compensating transactions.

Last updated 3 July 2026

  • A saga replaces a global transaction (no 2PC) with a sequence of local ACID transactions, one per service, each triggering the next.

  • On a mid-workflow failure, run compensating transactions in reverse (e.g. ReleaseInventory then CancelOrder). These are business-level undos like refunds, not DB rollbacks.

  • Make steps and compensations idempotent and persist saga state for crash recovery. Put non-compensatable steps last or use pending states, and accept eventual consistency.

  • https://developers.redhat.com/blog/2019/05/23/data-as-a-microservice-distributed-data-focused-integration
All Microservices interview questions