All jobs / Engineering manager / tech lead
Engineering manager / tech lead interview question · 3–5 years
Placing an order touches inventory, payment and shipping services. How do you keep them consistent without one transaction?
The strongest answer
A saga: a sequence of local transactions with a compensating action for each step — reserve stock, charge, book shipping; if booking fails, refund and release; orchestrated by a coordinator or choreographed by events, with every step idempotent and the state persisted
Why it works
Right. Compensation, persisted state, idempotent steps.
What a good answer covers
- Local transactions with compensations.
- Orchestrated or choreographed.
- State persisted.
- Every step idempotent.
Answers that fall short
- Close, but not the strongest: A distributed transaction across the three databases
Two-phase commit across services is fragile and slow; rarely available. - Weak: Call the three services in order and roll back by hand if one fails
Hand rollback without persisted state loses track on a crash. - Red flag: Merge the three services so one transaction covers them
A merge might be right, but it is not a consistency design.
Who gets asked this
- Backend developer
- Full-stack developer
- DevOps / SRE / cloud
- Data engineer
- Data science / ML / AI
- Engineering manager / tech lead
- Solutions / cloud architect
- AI engineer