A read your service expected to hit returns nothing - how do you decide whether it expired or was forced out, and what changes next?
answer
- the miss carries no reason
- age against the lifetime given
- trickle versus burst
- rule out delete, restart, wrong copy
basics
~20 sA read that finds nothing carries no reason, so the verdict is indirect: the entry's age against the lifetime it was given, the tier's forced-removal count over the same window, and whether unrelated entries went at once.
solid answer
~50 sThe store will not tell you from the read - a miss looks the same whichever removal happened, and the entry is no longer there to interrogate. So the verdict is built from three pieces of evidence: the **arithmetic**, whether the entry was older than the lifetime it was written with; the **forced-removal count** over the same window, where zero rules pressure out and non-zero makes it live; and the **shape of the loss**, since deadlines arrive scattered by write time while a bout of pressure takes many unrelated entries at once. Rule out the causes that are neither first: an explicit delete, a write that never landed, a restart, or a copy that has not got the write. The verdict points somewhere different: expiry sends you to the lifetimes and the access pattern, a forced removal to what is live at once against how much the tier holds.
go deeper
Know that a miss looks identical however the entry went, and that the first questions are simple ones: did the write succeed, is the key the same, and how old was the entry.
Walk the evidence in order - the entry's age against its lifetime, the tier's forced-removal count over the window, then the shape of the loss - and say what each piece rules in or out.
Show that the verdict changes what you do: lifetimes and access patterns on one side, what is live at once on the other, plus the realisation that any flow relying on the entry being present is now suspect.
Treat the ambiguity as a design input. If the two removals cannot be told apart reliably on this tier, say what may be entrusted to it at all and what the contract with consuming teams promises about entries going early.
## A miss carries no reason On stores of this class, a read that finds nothing returns the same answer whether the deadline passed, the store took the entry for room, another caller deleted it, or it was never written. The entry is gone, so there is nothing left to inspect: a caller can ask for an entry's **remaining lifetime** while the entry exists, but after it is gone there is no record to read. Every diagnosis here is therefore circumstantial, and the skill is knowing which circumstances actually discriminate. ## The evidence that discriminates 1. **The arithmetic on the entry itself.** How old was the entry, and what lifetime was it written with? If its age exceeds the lifetime, expiry is a sufficient explanation and no capacity story is needed for this entry. If it was comfortably inside, expiry is ruled out and something else took it. 2. **The tier's forced-removal count across the same window.** If the store never had to make room during the window, it forced nothing out, and pressure is excluded - provided the counter covers the window and the node that served the read. If it moved, pressure becomes a live candidate for the entry in question, although it does not prove this particular entry was one of the ones taken. 3. **The shape of the loss.** Entries reach their deadlines scattered according to when they were written and how long a lifetime each got, so ordinary expiry looks like a steady trickle. A bout of pressure tends to look like a burst - several unrelated entries, written at different times with different lifetimes, all missing across the same short interval. 4. **An announcement, where the store emits one.** Some stores can emit a message when an entry is reclaimed. Treat a received announcement as evidence, and treat silence as nothing at all: the emission is best-effort, it happens when the reclaim happens rather than when the deadline passed, and not every store has the feature. 5. **What the write actually did.** Confirm the write succeeded, went to the key the reader is asking for, and carried the lifetime it was supposed to carry. A surprising share of these investigations end here. ## Removals that are neither Before reaching for either verdict, exclude the causes that are not removals by the store at all: - an explicit delete by another caller or an operator; - a write that failed, or that landed under a different key than the read constructs; - a restart of the node, which for a volatile tier may mean it came back empty; - a read served by a copy of the tier that has not received the write yet; - an entry whose value was replaced by a write that also reset or cleared its lifetime, so it went earlier or later than expected. ## What each verdict changes | Verdict | What it means | What you do next | |---|---|---| | Expiry | The application asked for this removal, and got it | Re-examine whether the lifetime matches the access pattern, and whether the caller assumed a deadline moves on access when the store does not move it | | Forced removal | The store could not fit a write and chose an entry to give up | Ask what is live at once against how much the tier holds, and re-examine any correctness that assumed an entry would still be there | | Neither | Nothing was removed on the store's initiative | Look at the write path, the key construction, the restart history, and which copy answered the read | The distinction earns its keep in the second row. A forced removal is not only a capacity fact; it invalidates an assumption. Any flow that wrote something and expected to find it later must now be read as a flow that can find nothing, and that is usually a bigger finding than the missing entry that started the investigation. ## Where the evidence is weak Be honest about the limits of this diagnosis, because they are what separate a useful verdict from a confident wrong one: - **Counters differ.** Stores book an entry that was already past its deadline when the room was needed under different names, so the two counts are not always cleanly disjoint. - **Announcements are unreliable by design.** They are best-effort and late relative to the deadline, so they can confirm a removal but never rule one out. - **The window may not line up.** A counter read per node, or aggregated over an interval longer than the incident, can hide exactly the movement you are looking for. - **Both can be true.** An entry can be past its deadline *and* the tier can be under pressure. In that case time is a sufficient explanation for the entry, while the pressure remains a separate finding about the tier that is worth its own follow-up. The strongest version of the answer in an interview is usually the honest one: state the evidence you would gather, state which conclusion each piece supports, and say plainly that a miss on its own supports none of them.
- Can an announcement from the store settle which removal happened?Only partly. Where a store emits one, a received announcement is useful evidence, but it is best-effort and emitted when the reclaim happens rather than when the deadline passed, and some stores emit nothing at all. So its arrival tells you something and its absence tells you nothing.
- The write and the read went to different copies of the tier. Does that change the diagnosis?Yes. A read served by a copy that has not yet received the write finds nothing without anything having been removed, so it belongs in the neither category. Establish which copy answered before attributing the miss to a deadline or to pressure.
- The forced-removal count is non-zero, but the entry was also past its deadline. Which verdict wins?For that entry, time is a sufficient explanation and the investigation of the miss stops there. The non-zero pressure count remains a separate finding about the tier and deserves its own follow-up, since it means other entries are being given up whether or not this one was.
saying these in an interview costs you the question
- A read that misses tells you why the entry is gone
- Anything missing from the tier must have expired
- Silence from announcements proves nothing was removed
- Adding memory is the fix whichever verdict you reach
- If the deadline had not passed, someone must have deleted it