Medium System Design Microservices
How do you handle transactions across microservices?
Answer
Challenges: no single ACID database, network failures, partial failures. Patterns: Saga (sequence of local transactions with compensating actions - choreography or orchestration), Two-Phase Commit (2PC - coordinator ensures all-or-nothing, but blocking and slow), Event Sourcing + CQRS (events as truth, eventual consistency). Best practices: design for eventual consistency when possible, use idempotent operations, implement compensating transactions, track transaction state. Avoid distributed transactions when possible through service boundaries.
IIT Certified
Master These Concepts with IIT Certification
175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.
Relevant for Roles
Software Engineer Systems Architect Backend Developer