0
0
Kafkadevops~5 mins

Saga pattern for distributed transactions in Kafka - 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 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?
AMessage broker to pass events between services
BDatabase to store all transactions
CLoad balancer for microservices
DAuthentication service
What is a compensating transaction?
AA step that confirms the transaction
BAn action that reverses a previous step if needed
CA database commit operation
DA service that starts the saga
Which Saga implementation uses a central coordinator?
ATwo-phase commit
BChoreography
COrchestration
DEvent sourcing
Why is Saga pattern better than two-phase commit in microservices?
AIt avoids resource locking and scales better
BIt locks resources longer
CIt uses synchronous calls only
DIt requires a single database
In Saga, what triggers the next step in the transaction?
AA database trigger
BA manual user action
CA timer
DAn event published to Kafka
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.