0
0
Kafkadevops~20 mins

Saga pattern for distributed transactions in Kafka - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Saga Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the primary purpose of the Saga pattern in distributed systems?
Choose the best explanation for why the Saga pattern is used in distributed transactions.
ATo replicate data synchronously across all services to avoid inconsistencies.
BTo lock all resources across microservices until the entire transaction completes to ensure atomicity.
CTo coordinate a sequence of local transactions with compensating actions to maintain data consistency without locking resources.
DTo batch all operations into a single monolithic transaction for performance.
Attempts:
2 left
💡 Hint
Think about how distributed systems avoid long locks and still keep data consistent.
Architecture
intermediate
2:00remaining
Which Kafka component is best suited to implement the Saga pattern's event coordination?
Select the Kafka component that helps orchestrate and communicate the sequence of events in a Saga.
AKafka Connect to synchronize databases directly without event handling.
BKafka Schema Registry to store transaction logs.
CKafka Streams to batch process unrelated data without event ordering.
DKafka Topics to publish and subscribe to events representing transaction steps and compensations.
Attempts:
2 left
💡 Hint
Think about how services communicate asynchronously in a Saga.
scaling
advanced
2:30remaining
How does the Saga pattern scale when handling thousands of distributed transactions concurrently?
Choose the best explanation of how Saga pattern scales in a Kafka-based microservices environment.
ABy replicating the entire Saga state machine on every microservice instance to avoid coordination.
BBy partitioning Kafka topics and processing events in parallel, allowing independent Sagas to run concurrently without interference.
CBy batching all transactions into one large event to reduce overhead.
DBy serializing all transactions through a single Kafka partition to maintain strict order.
Attempts:
2 left
💡 Hint
Consider how Kafka partitions help parallelize event processing.
tradeoff
advanced
2:30remaining
What is a key tradeoff when using the Saga pattern compared to traditional two-phase commit (2PC)?
Select the option that best describes a tradeoff of Saga pattern usage.
ASaga provides eventual consistency but sacrifices immediate atomicity and may require compensating transactions.
BSaga guarantees immediate atomicity but requires locking all resources during the transaction.
CSaga eliminates the need for compensating transactions by using distributed locks.
DSaga reduces network overhead by batching all operations synchronously.
Attempts:
2 left
💡 Hint
Think about consistency guarantees and how compensations work.
estimation
expert
3:00remaining
Estimate the maximum throughput of a Saga-based system using Kafka with 10 partitions, each processing 1000 events per second, assuming each Saga requires 5 events.
Calculate the maximum number of Saga transactions the system can handle per second.
A2000 Saga transactions per second
B5000 Saga transactions per second
C500 Saga transactions per second
D10000 Saga transactions per second
Attempts:
2 left
💡 Hint
Divide total event processing capacity by events per Saga.