State that outlives one processintermediate
Anything a later request needs — encryption keys, a session, a one-time code, a live connection — has to live where every replica can reach it, because the next request may land on any of them.
Password reset works half the time: the code is held in one pod’s memory and checked by whichever pod gets the next request. It also works as many times as you like. Store it where every pod can see it, for a limited time, for one use.
Codes live in Redis with an expiry, are consumed atomically and only once, under namespaced keys.
Published in full, before you start — every point is one of these and there is nothing else.
Anything a later request needs — encryption keys, a session, a one-time code, a live connection — has to live where every replica can reach it, because the next request may land on any of them.
A request that times out has not necessarily failed — you just did not hear back — so the client retries, and unless the write recognises that it has already happened the customer is charged twice.