Lesson 19 · Senior gRPC backend engineering
Retries, idempotency, and safe RPC design
Why resilience features can create correctness bugs unless the RPC meaning is safe enough to retry.
Your win: explain when retries help, when they duplicate side effects, and how to talk about idempotency as a gRPC API design property instead of a buzzword.
The problem: resilience and correctness can fight each other
A transport-level retry sounds helpful until the RPC sends an email twice, charges twice, or mutates state twice. That is why retry design is really RPC-semantics design.
The beginner version of this topic is “retries improve resilience.” The senior version is “retries are only helpful if repeating the call is still logically safe.” That one extra sentence is where most of the real engineering lives.
Three cases to separate
When an interviewer asks about retries, they are usually testing whether you can sort RPCs into these buckets instead of answering with one universal rule.
- Safe retries: read-only lookups or naturally idempotent writes
- Conditionally safe: writes guarded by idempotency keys, dedupe IDs, or business constraints
- Unsafe by default: side-effectful mutations with no deduplication story
Unavailable as an automatic "just retry" signal without checking whether repeating the call could repeat a side effect. The status code tells you something about transport or availability; it does not magically certify the business action as idempotent.Retry, deadlines, and idempotency thinking
Read the gRPC retry guides together with your own API semantics. Tooling can retry transport work; only the service contract can make that retry safe.
Check yourself (from memory)
Q1. The first question before enabling retries is…
Sources. gRPC Retry.