Site Reliability Engineer Interview Question

How do you make a write endpoint safe to retry?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Give the client an idempotency key, store it alongside the result of the first successful write, and return that stored result on any repeat. Enforce uniqueness at the database level so concurrent duplicates collide instead of double writing. Scope keys per customer, expire them after a sensible window, and use the natural business key such as an order id as the deduplication anchor whenever one exists.

Why interviewers ask this

Every retry policy is dangerous without idempotency, so this question tests whether you can close the loop. Interviewers look for the database level uniqueness constraint, because application level checks lose the race under concurrency. Strong answers also handle the in flight case: what the second request should do while the first is still running.

How to structure your answer

  • Introduce the idempotency key and where it comes from.
  • Store key, request fingerprint, and response together in one transaction.
  • Enforce uniqueness in the database so races fail loudly.
  • Say what happens on a repeat while the first call is still in flight.
  • Mention key scoping and expiry.

Example answer

Spoken example, first person

The client generates an idempotency key, usually a UUID, and sends it as a header. Server side I keep a table keyed on customer id plus that key with a unique constraint, and I write the key and the response in the same transaction as the business write. A repeat then hits the unique constraint or finds the stored row and just replays the original response, so retries are free. Two details matter. First, the uniqueness has to live in the database, because if you do a select then an insert, two concurrent retries will both pass the check. Second, you have to decide what to do when the second request arrives while the first is still running. We returned 409 with a Retry-After rather than blocking, which kept our connection pool healthy. I also store a hash of the request body so that reusing a key with different content is rejected instead of silently returning the wrong answer.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • What do you return if the same key arrives with a different payload?
  • How long would you retain idempotency keys, and why?
  • How does this work when the write spans two services?

Related site reliability engineer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot