Bird
Raised Fist0
HLDsystem_design~5 mins

Saga pattern for distributed transactions in HLD - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the Saga pattern in distributed transactions?
The Saga pattern breaks a large transaction into smaller, independent steps. Each step has a compensating action to undo it if needed. This helps keep data consistent across multiple services without locking resources.
Click to reveal answer
beginner
How does the Saga pattern handle failures in a distributed system?
If a step fails, the Saga pattern runs compensating actions for all previous successful steps to undo their effects. This rollback keeps the system consistent without needing a global lock.
Click to reveal answer
intermediate
What are the two main types of Saga execution?
1. Choreography: Each service listens for events and triggers the next step. 2. Orchestration: A central coordinator tells each service what to do next.
Click to reveal answer
intermediate
Why is the Saga pattern preferred over distributed two-phase commit in microservices?
Saga avoids locking resources for long times, improving availability and scalability. It fits well with microservices by allowing each service to manage its own data and rollback independently.
Click to reveal answer
beginner
What is a compensating transaction in the Saga pattern?
A compensating transaction is an action that reverses the effect of a previous step in the Saga. It is used to undo changes when a later step fails.
Click to reveal answer
What does the Saga pattern primarily help with in distributed systems?
AImproving UI responsiveness
BEncrypting data between services
CMaintaining data consistency without locking resources
DReducing network latency
Which of the following is NOT a type of Saga execution?
AChoreography
BReplication
CNone of the above
DOrchestration
In the Saga pattern, what happens if a step fails?
ACompensating transactions undo previous steps
BThe failed step is retried infinitely
CThe entire system shuts down
DNothing, the failure is ignored
Why is Saga pattern better than two-phase commit for microservices?
AIt improves availability and scalability
BIt locks resources longer
CIt requires a central database
DIt uses synchronous calls only
What is the role of a compensating transaction?
ATo log transaction details
BTo speed up the transaction
CTo encrypt data
DTo reverse a previous step if needed
Explain the Saga pattern and how it manages distributed transactions.
Think about how to keep data consistent without locking everything.
You got /4 concepts.
    Describe the difference between Saga choreography and orchestration.
    Compare who controls the flow of steps.
    You got /3 concepts.