Hard1 markMultiple Choice
Domain 4.2: Design an application architectureDomain 4Application ArchitectureMicroservicesDesign Patterns

AZ-305 · Question 46 · Domain 4.2: Design an application architecture

You are designing a microservices architecture for a travel booking system.

A single user action (booking a vacation) requires updating data across three independent microservices: Flight Booking, Hotel Booking, and Car Rental. Each microservice has its own database. If the Flight and Hotel bookings succeed, but the Car Rental fails, the entire transaction must be rolled back to maintain data consistency.

Which distributed transaction pattern should you implement?

Answer options:

A.

Saga pattern with Compensating Transactions

B.

Two-Phase Commit (2PC)

C.

Command Query Responsibility Segregation (CQRS)

D.

Circuit Breaker pattern

How to approach this question

Identify the problem: distributed transactions across independent databases. The modern microservices solution is the Saga pattern.

Full Answer

A.Saga pattern with Compensating Transactions✓ Correct
Saga pattern with Compensating Transactions
In a microservices architecture where each service has its own database, traditional ACID distributed transactions (like Two-Phase Commit) create tight coupling and performance bottlenecks. The Saga pattern is the recommended approach. A saga is a sequence of local transactions. If a local transaction fails (e.g., Car Rental), the saga executes a series of compensating transactions that undo the changes made by the preceding local transactions (canceling the Flight and Hotel).

Common mistakes

Choosing Two-Phase Commit. While it works in monolithic relational databases, it is highly discouraged in microservices due to locking and scalability issues.

Practice the full Azure Solutions Architect Expert AZ-305 Practice Exam 1

55 questions · hints · full answers · grading

More questions from this exam