Ch. 10 · Microservices

Microservice Sagas and Compensation Limits

Microservice Sagas and Compensation Limits. Learn the reasoning, a practical example, common mistakes and an interview exercise.

~2 min readintermediateupdated Oct 3, 2026

A saga sequences local transactions and compensating actions. Compensation is a business action, not a perfect rewind of history.

Before you start

You should understand HTTP, database transactions and the difference between one process and independently failing services. Draw the participants and message direction before choosing a pattern. Include timeout, duplicate delivery and recovery in the model instead of considering only successful requests.

The practical goal is to reason through this situation: Cancelling a reserved shipment differs from undoing a shipment already dispatched. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.

Step-by-step walkthrough

Step 1: List local steps

Record each participant’s action and failure outcome.

Step 2: Identify irreversible points

Reservation cancellation differs from reversing a dispatched shipment.

Step 3: Plan recovery

Specify compensation, retries and manual handling when reversal is incomplete.

Worked scenario

Cancelling a reserved shipment differs from undoing a shipment already dispatched.

An order reserves stock, charges payment and dispatches a parcel. Failure before dispatch may permit releasing stock and refunding payment. After dispatch, recovery may require a return process, fees and support intervention. Calling all of those actions ‘rollback’ hides their different business consequences.

Common mistake

A refund may restore money but cannot erase external consequences or fees.

Verify the behavior

Fail each step and assert the documented compensation or manual-recovery state.

Interview exercise

Design failed checkout recovery.

Answer and reasoning

State reversible steps, irreversible points and manual recovery paths before choosing choreography or orchestration.

Continue learning

Compare the scenario with the Microservices interview questions and test your understanding with the Microservices MCQs. For terminology and implementation details, consult the reference material.

More in Microservices

read ✓Microservices · hard

Microservices Anti-Corruption Layer

Protect a service's domain model from a foreign or legacy model with a translation layer at the boundary.

~2 min readread →
read ✓Microservices · hard

Microservices API Versioning and Evolution

Evolve service APIs without breaking consumers using additive changes, explicit versioning and consumer-driven contracts.

~2 min readread →
read ✓Microservices · hard

Microservices Backend for Frontend

Use a per-client BFF to aggregate services and shape responses, without letting it become a shared god service.

~2 min readread →
esc