Recall & Review
beginner
What is the Saga pattern in distributed transactions?
The Saga pattern breaks a large transaction into smaller steps, each with a compensating action to undo it if needed. It helps keep data consistent across services without locking resources.
Click to reveal answer
intermediate
How does Kafka help implement the Saga pattern?
Kafka acts as a message broker to send events between services. Each service listens for events, performs its step, and publishes the next event or a compensation event if something fails.
Click to reveal answer
beginner
What is a compensating transaction in the Saga pattern?
A compensating transaction is an action that reverses a previous step if the saga fails later. It helps undo partial changes to keep the system consistent.
Click to reveal answer
intermediate
What are the two main types of Saga implementations?
1. Choreography: Services communicate by producing and consuming events without a central coordinator. 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 and long waits by using asynchronous steps and compensations. It scales better and fits microservices' independent nature.
Click to reveal answer
What role does Kafka play in the Saga pattern?
✗ Incorrect
Kafka is used as a message broker to send and receive events that coordinate saga steps.
What is a compensating transaction?
✗ Incorrect
Compensating transactions undo previous steps to maintain consistency if the saga fails.
Which Saga implementation uses a central coordinator?
✗ Incorrect
Orchestration uses a central coordinator to direct saga steps.
Why is Saga pattern better than two-phase commit in microservices?
✗ Incorrect
Saga uses asynchronous steps and compensations, avoiding locks and fitting microservices.
In Saga, what triggers the next step in the transaction?
✗ Incorrect
Each service publishes an event to Kafka to trigger the next step.
Explain how the Saga pattern manages distributed transactions using Kafka.
Think about how services talk and undo work if needed.
You got /4 concepts.
Describe the advantages of using the Saga pattern over traditional two-phase commit in microservices.
Focus on why Saga suits distributed systems better.
You got /4 concepts.