System designInterview preparation
Advanced·Concept·2 min read

How do I handle partial failure across services?

Practice this question

Definition:

A cross-service workflow can partly succeed because each service commits independently. A saga coordinates local steps and compensating actions to recover when a later step fails. Compensation is a business recovery action, such as refunding a payment, and may not exactly erase every observable effect of the original action.

Key points:

  • Use local transactions and durable workflow state.

  • A saga uses compensating actions when later steps fail; compensation is not always an exact undo.

  • Reconcile uncertain external results before repeating actions such as payments or notifications.

  • Persist workflow progress and support reconciliation when a timeout leaves a step's outcome uncertain.

Interview point:

  • Describe both the success sequence and the failure after a particular committed step; “use transactions” is insufficient across arbitrary external APIs.
Adapted from 07_SYSTEM_DESIGN_ARCHITECTURE.md · “How do I handle partial failure across services?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.