Existential Cache

Photo by Bob Brewer on Unsplash

Existential Cache

🤔

·

1 min read

A common use for a cache is to front a database, in order to improve latency, throughput or both. If the use case depends on these improved characteristics in order to survive, then we say that the cache is existential.

In other words, the use case ceases to exist if the cache is down. This can be due to excessive throughput hitting the database, thus taking it down as well. Or it could be due to the clients being incapable of operating efficiently enough when too many requests are served slowly (e.g. due to threads being tied up too long and thus causing backpressure).

This risk can be mitigated to some extent by always reading from both the database and the cache (rather than only on cache misses), thus ensuring that the database must be provisioned for full throughput, but this doesn’t guarantee that clients can gracefully sustain degraded latency.

If a cache is existential, then the uptime of the end-to-end architecture equals:

db_uptime * client_uptime * cache_uptime

Where cache_uptime means the proportion of time where the cache hit ratio remains above the level required for the use case to survive.

A non-existential cache, on the other hand, provides the more favorable end-to-end uptime of:

db_uptime * client_uptime

Do you leverage existential caches in your architectures?

Â