The dangerous cache failure is sometimes a quick answer to a question whose answer has already changed.

An asynchronous worker at Meta once could not see data written during the web request that started its job. The worker retried; sustained replication lag kept the data invisible; retries filled execution queues until a content enforcement system went down. Meta's researchers describe the episode in their 2025 paper on bounded staleness. They do not give its date, duration, or number of affected users. The important sequence is clear: a successful write was followed by reads too old for the work that depended on it.

That is an outage even if the cache servers answer promptly and their hit rate looks excellent. The failure is in the service's meaning: a read omits a fact the next operation needs. How does a performance optimization acquire the power to break correctness, and which consistency guarantee is worth its cost? The answer begins with the contract between a write and every place that can answer a later read.

A cache hit can be an incorrect success

A typical cache-aside service reads from a cache first, fetches from a database on a miss, and populates the cache with the result. After a database write, it deletes the cached entry so the next read will fetch a fresh value. Facebook's 2013 account of its memcache architecture describes this pattern and its reason for using deletes: they can be repeated safely. The database remains authoritative, but the application usually acts on the cached answer.

The separation creates two distinct ways to be wrong. Lag means a write has not yet reached a replica or cache. If delivery is healthy, the discrepancy eventually closes; if the consumer needs the write immediately, that delay can still cause an outage. Divergence means an invalidation was lost, mishandled, or overtaken by an older cache fill. Without a repair path or expiration, the wrong answer can persist indefinitely. Meta documents a production bug in which a cache entry combined old metadata with the newest version number; an error handler then failed to evict it because the version appeared current. Consistency tracing revealed the interleaving.

Even a single cache and database can race. Consider a hypothetical record whose value is 42:

  1. A reader misses the cache and begins fetching 42 from the database.
  2. A writer commits 43 and sends an invalidation to the cache.
  3. The delayed read of 42 arrives after the invalidation and fills the empty cache.

The database now contains 43 while subsequent readers can receive 42. A short time-to-live (TTL) limits how long that particular entry survives, assuming expiration works and a later read reaches an up-to-date source. It does not prevent the stale read before expiry. Nor does it help if the miss refills from a replica that is itself behind. Meta describes this out-of-order fill and invalidation in its cache consistency analysis; its earlier memcache paper explains how a per-key lease can reject a fill whose permission was invalidated by a write.

Version checks can also reject old data, but their scope matters. A cache that evicts an entry may lose the version against which it would compare a late fill. A version attached to one record cannot, by itself, prove that a query assembled from several records or indexes reflects a single coherent point in time. These are protocol questions, not settings on a TTL slider.

Specify the read that must see the write

“The cache must be consistent” is too broad to guide a design. The useful question is which completed writes a particular read must observe. A public product page might tolerate a briefly old description. A customer who has just changed a setting reasonably expects the next screen to show the change: read-your-writes. A background job that requires the row created by its triggering request needs that row before it can proceed. A decision about a permission or an authoritative checkout price may need to bypass a cache altogether if the application cannot prove the copy is current. AWS's caching guidance makes the same distinction for prices displayed during browsing and at checkout.

These requirements lead to different designs. For a tolerant read, a TTL and asynchronous invalidation may provide an acceptable freshness window, provided the team measures the window in production. For read-your-writes, the client can carry a write version or session token and accept a cached response only if it is at least that new. Facebook's FlightTracker paper describes a related approach: recent-write metadata travels with reads, and an entry that may be too old becomes a “consistency miss.” The system pays for a slower path only when the cheap answer cannot satisfy the caller's requirement.

For a bounded-staleness target, the architecture must detect when the ordinary replication stream falls behind and decide what to do then. Meta's Skybridge research adds a separate stream of recent-write information so a cache can identify potentially stale entries and refill them. In its reported evaluation, the proportion of writes visible within two seconds rose from 99.993 percent with the existing pipeline to 99.99998 percent with Skybridge's fail-closed reads. Those figures describe Meta's measured workload and the paper's checking method, not a universal guarantee that every read completes in two seconds. When freshness cannot be established, failing closed can trade availability for correctness; failing open can preserve a response while risking stale data. The right choice belongs to the operation, not to the cache fleet as a whole.

The recovery path can create a second incident

Once stale data is suspected, deleting every cache entry is tempting. It also sends the next wave of reads to the backing store. A cache that normally shields a database from most traffic can turn a broad purge into a surge of misses, higher latency, and another availability problem. The 2013 Facebook paper treated stale fills and miss storms together: its leases controlled which reader could repopulate a key and reduced concurrent work on hot keys. That design is evidence for coordinating refills, not a claim that every application needs Facebook's protocol.

An incident response should first locate the broken visibility boundary. Is the write uncommitted, the replica behind, the invalidation queue stalled, or a particular key incorrectly filled after invalidation? The answer determines whether a targeted eviction can repair the state, whether the application must read from an authoritative source for affected operations, or whether it must stop processing until the write becomes visible. A broad purge before fixing a lagging source can simply refill the cache with old values. If targeted bypasses are necessary, they need capacity limits; the database may be unable to serve the whole cached workload directly.

The same distinction belongs in monitoring. Hit rate, cache latency, and HTTP success rate say little about whether answers reflect committed writes. Track the time from commit to visibility at each read path, invalidation delivery and backlog, replica lag, and the rate of reads rejected because a cached version is too old. Sample comparisons against the authoritative store can reveal mismatches, but those checks cost capacity and must account for writes occurring during the comparison. Meta's Polaris system rechecks suspicious entries at multiple timescales to distinguish temporary lag from persistent inconsistency. The most useful alert is tied to the application's freshness promise: for example, how often a dependent worker cannot see the write that launched it.

There is no single “safe TTL” for all this state. Expiration bounds some stale entries while increasing misses; fast invalidation shortens ordinary delay while adding a delivery path that can fail; session-aware reads cost metadata and sometimes an upstream fetch; authoritative reads cost latency and database capacity. The engineering decision is to spend those costs where a stale answer changes the outcome, then measure the visibility promise as carefully as response time. A cache becomes a consistency outage when the system keeps answering but stops answering with the state its callers are entitled to see.

References