skip to content

One store holds recomputable page fragments alongside leases and deduplication records under a single ceiling and removal policy. What is wrong, and what would you do?

level: principalimportance: should knowfreq 30%

answer

  1. one policy, several populations
  2. blast radius differs per entry kind
  3. separate tiers beat clever tuning
  4. eligibility, not order
  5. removals per minute is a loss rate

basics

~20 s

One removal policy applies to every entry, but the blast radius of a removal differs per population: a fragment costs a refetch, a lease costs mutual exclusion. Separate the populations, or use eligibility so the irreplaceable entries are never candidates.

solid answer

~40 s

The defect is that the store ranks entries and the business does not. Whatever family is configured applies to the whole candidate set, so the posture that is right for fragments - remove freely, a near-miss costs one refetch - is the posture that silently destroys a lease. The strongest remedy is separation: two stores, each with its own ceiling and posture, so neither population can consume the other's memory. Where one tier is unavoidable, use the eligibility axis instead of the order axis - lifetimes on the disposable population, no lifetime on the irreplaceable entries, lifetime-only removal configured - then watch the eligible share, because eligibility exhaustion turns the ceiling into failed writes. Either way, decide explicitly which failure you prefer, and verify what your store actually supports.

go deeper

for a junior

Take away the core idea: losing an entry that can be rebuilt from a database is an inconvenience, and losing one that exists nowhere else is lost data, even though the store did the same thing in both cases.

for a middle

Say why one policy cannot serve both populations, and name the eligibility axis as the lever that distinguishes them rather than reaching for a different removal family.

for a senior

Describe what you would observe before deciding: memory attributed per population, removals per minute, and the share of entries carrying a lifetime, with an alert that fires before the ceiling rather than at it.

for a principal

Argue the trade in both directions. Failing writes protects data and sheds load onto callers; removing protects availability and quietly costs correctness. State which one this system should prefer and what evidence would change your mind.

## The mismatch A removal policy is a property of the store, or at best of an entry's eligibility marking. Criticality is a property of the data. When one keyspace holds several populations, one policy is applied to all of them, and the policy that is correct for the cheapest population is applied to the most expensive one. The same mechanism produces three different failures: | entry removed | what it costs | who notices | |---|---|---| | a recomputable fragment | one extra fetch and some latency | nobody, until the origin is hot | | a lease held by a worker | two workers act as though each holds it | whatever the lease protects | | a deduplication record | a retried request is processed twice | whoever receives the duplicate effect | No tuning of the order axis addresses this. A better ranking removes a better fragment and a better lease. ## Why it is usually invisible until it is not A mixed tier behaves perfectly while it has headroom, because removal never fires. The populations also grow at unrelated rates: the fragments grow with traffic, the leases with concurrency, the deduplication records with retention. So the first time the tier reaches its ceiling is typically long after the design decision, under load, and the symptom is not a memory alert but a correctness incident somewhere else entirely - a duplicated side effect, or two workers in the same critical section. ## The remedies, strongest first 1. **Separate the populations into separate stores.** Distinct ceilings, distinct postures, distinct failure domains. This is the only arrangement in which the fragment workload cannot consume the memory the leases need, and it is worth real operational cost. Its price is another thing to run, another connection pool, and another tier to watch. 2. **Use the eligibility axis, not the order axis.** If one tier is unavoidable, attach lifetimes to the disposable population, leave the irreplaceable entries without one, and configure the store for lifetime-only removal. Removal then lands entirely on entries the application marked as expendable. This depends on the store supporting the restriction at all, and it has its own failure: when nothing is eligible, the ceiling shows up as writes that cannot be served. 3. **Bound the irreplaceable population by design.** The entries you refuse to lose must not be allowed to grow without limit, or remedy 2 converts one failure into another. Cap what is retained and keep the permanent share small enough that the expendable pool can always absorb pressure. 4. **Choose the failure you prefer, explicitly.** Failing writes while reads continue is the honest posture when correctness dominates: it is loud, it is visible to callers, and it degrades service rather than data. The reverse argument is legitimate too - a tier whose job is to absorb load for a fragile origin may be better off removing something than refusing, and a lost lease that can be re-acquired may genuinely be cheaper than a stalled request path. What is not legitimate is having never made the choice. ## What a principal-level answer adds - **A measurement, not an estimate.** Attribute the resident memory to each population rather than reasoning about it, and know the share of the ceiling each one holds before choosing a posture. - **An alert that fires before the ceiling, not at it.** The useful signals are removals per minute and the eligible share, not just bytes: on a tier holding irreplaceable state, a removal rate *is* a data-loss rate, and it should page someone whether or not memory has moved. - **A named blast radius per population.** Being able to say what one removal costs for each kind of entry is what converts this from a configuration discussion into a design one. ## Do not assume the mechanism you are used to The options above depend on capabilities that vary across this class of store: - Whether there is a choice of removal family at all, or one fixed behaviour. - Whether removal can be restricted to entries carrying a lifetime. - Whether the store has a ceiling concept, or simply grows until the machine intervenes - in which case the operating system chooses what dies, and it chooses the whole process. - Whether removal ranks over the whole keyspace or within the fixed-size block class that needs room. - What the **default** is, which is the setting most tiers are actually running. So the design step is to verify the posture of the store in front of you, state it, and only then argue the arrangement. Presenting one store's defaults as the model is how a design review approves an arrangement that the deployed store does not implement. ## The short version One ceiling plus one policy means one blast radius for entries with very different values. Split the tier if you can; if you cannot, make the irreplaceable entries ineligible, keep them small, watch the eligible share, and write down which failure you chose at the ceiling.

  • Why is separating the populations stronger than configuring one tier carefully?
    Because a shared ceiling means the populations compete for memory no matter how the policy is set: fragment traffic can consume the headroom the leases need, and a policy cannot un-consume it. Separate stores give each population its own ceiling and its own posture, so a bad day in one cannot become a correctness incident in the other.
  • If you keep one tier, what do you watch to know it is still safe?
    The share of resident entries that are eligible for removal, the removal rate itself, and memory attributed per population. A rising removal rate on a tier holding irreplaceable entries is a data-loss rate, and a falling eligible share predicts that the ceiling will next appear as failed writes rather than as removals.
  • When is removing silently the better posture than failing the write?
    When the tier exists to shield a fragile origin and every entry is reconstructible, so a removal costs latency while a failed write costs availability. It is also defensible where the irreplaceable state is cheaply re-acquired, such as a lease a worker can take again. It stops being defensible the moment a removal can cause a duplicate effect.

saying these in an interview costs you the question

  • Tunes the removal family to protect irreplaceable entries.
  • Assumes a larger ceiling removes the need to choose a posture.
  • Treats every removal as costing only an extra fetch.
  • Thinks one shared tier is always cheaper than two.
  • Watches memory alone and never the removal rate.
  • Assumes the deployed store supports restricting eligibility.