categories.system-design Advanced

Saga Pattern for Distributed Transactions

AI Practice

How does the Saga pattern manage distributed transactions?

Problem

In microservice architectures, a business operation may span multiple services. Traditional 2PC is slow and causes locking issues.

Saga Pattern

Decompose a distributed transaction into a sequence of local transactions. On success, proceed to the next step. On failure, execute compensating transactions to roll back previous steps.

Two Implementations

Choreography

Services trigger each other via events, no central coordinator. Low coupling but hard to trace.

Orchestration

A central Saga Orchestrator coordinates all services, invoking each step and handling failures. Clear flow but adds central complexity.

Use Cases

  • E-commerce order flow (inventory, payment, shipping)
  • Cross-bank transfers
  • Travel booking (flight + hotel + car rental)

✦ AI Mock Interview

Type your answer and get instant AI feedback

Sign in to use AI scoring

Copyright © 2026 Wood All Rights Reserved · FE Interview Hub