All jobs / Backend developer / Distributed Systems
Backend developer interview question · 1–3 years
Two services each keep a copy of a customer’s address and sync with events. A product manager asks whether the two are “always the same”.
What do you tell them, and what does it force on your code?
The strongest answer
That the two converge once the events are delivered, with no promised time bound — so handlers must be idempotent and tolerate repeats and reordering, and product decides what a user sees during the window
Why it works
Exactly — convergence without a deadline. Naming the user-visible window is the part product actually needs from you.
What a good answer covers
- It converges, with no time bound.
- Make every handler idempotent.
- Expect repeats and reordering.
- Decide what users see meanwhile.
Answers that fall short
- Close, but not the strongest: That they are the same within a second or so, because the events are normally delivered quickly
“Normally” is not a guarantee; the honest answer promises convergence, not a latency you cannot hold during an incident. - Weak: That eventual consistency means the data can be wrong, so we should avoid it and read from the owning service every time
It is not wrong, it is behind. Reading from the owner every time is a valid choice with its own cost: a hard dependency on its availability. - Red flag: I would have both services write to both databases in the same request, so they cannot diverge at all
Two writes in one request is the failure you were trying to avoid — one succeeds, one does not, and nothing retries.
Who gets asked this
More Distributed Systems questions
- The interviewer asks: “The replica is behind. Do you serve stale reads or error?” Strongest answer?
- The interviewer asks: “How do you publish an event only if the order row actually committed?” Strongest…
- The interviewer asks: “We need “all services succeed or none” across order, inventory and billing. What do…
- 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…