All jobs / Backend developer / Distributed Systems
Backend developer interview question · 3–5 years
The interviewer asks: “We need “all services succeed or none” across order, inventory and billing. What do you reach for?” Strongest answer?
The strongest answer
A saga: a sequence of local transactions with compensations if a later step fails. Two-phase commit across microservices is rarely available and couples availability to every participant.
Why it works
Exactly. Sagas trade atomicity for explicit compensations and a state machine you can operate. That's the 2026 default across service boundaries.
What a good answer covers
- Across services: saga + compensation.
- 2PC is rarely the tool you have.
- Don't collapse services just to COMMIT.
- Every step has a failure story.
Answers that fall short
- Close, but not the strongest: A distributed XA transaction so it behaves like one database.
XA/2PC across HTTP services is slow, brittle, and often not supported by the brokers and DBs you actually run. Don't design the interview answer around it. - Weak: One shared database for all three services so we can COMMIT.
A shared DB to “make 2PC easy” undoes the service boundary. If you wanted one transaction, maybe you wanted one service. - Red flag: Ignore failures in billing — finance will notice.
Skipping billing is silent revenue loss. Compensation or a retry queue with an owner — not hope.
Who gets asked this
More Distributed Systems questions
- The interviewer asks: “Consumers are slow. The publisher is fast. What do you do?” Strongest answer?
- The interviewer asks: “A message fails every time. The consumer keeps retrying. What now?” Strongest answer?
- Order-status events for the same order are arriving out of order at the consumer. The topic has twelve…
- The interviewer asks: “The user saves a profile then immediately GETs it from another region and sees the old…
- The interviewer asks: “A dependency is failing. How do you stop your service from dying with it?” Strongest…
- The interviewer asks: “The outbox publisher crashed after sending but before marking sent. What happens?”…
- The interviewer asks: “Recommendations are down. Checkout still needs to work. What do you do?” Strongest…
- The interviewer asks: “We're adding a search index. Can the API write DB and Elasticsearch in one request?”…