Lightweight Robust Size Aware Cache Management

Gil Einziger, Ohad Eytan, Roy Friedman, Benjamin Manes

TL;DR

This paper introduces a lightweight, size-aware extension to the popular W-TinyLFU cache admission policy to handle variable-sized data like videos and web images. By introducing a novel "Aggregated Victims" (AV) approach, the authors achieve hit-ratios competitive with complex, state-of-the-art algorithms while reducing CPU overhead by up to 3x.

What Problem Does This Paper Address?

Traditional cache management policies (like LRU or LFU) operate under a simple assumption: all cached items are the same size. This makes sense for low-level storage systems operating on fixed-size disk blocks. However, modern systems—such as Content Delivery Networks (CDNs), key-value stores, and object storage—deal with highly variable data sizes, ranging from tiny text documents to massive multi-gigabyte video files.

In these environments, being "size-oblivious" hurts performance. A single large, rarely-accessed file can evict dozens of popular small files. While size-aware policies exist (e.g., AdaptSize, LHD, LRB), they tend to be computationally heavy, relying on complex stochastic models or machine learning, making them impractical for high-throughput production systems. The authors set out to design a size-aware policy that is simple, fast, and highly effective.

Methods

The authors build upon W-TinyLFU, a highly efficient, size-oblivious caching architecture used in production libraries like Caffeine and Ristretto.

The core architecture uses a small "Window cache" for new items and a large "Main cache" for long-term storage, mediated by a TinyLFU admission filter.

W-TinyLFU Architecture

When items vary in size, admitting a single new item might require evicting multiple "victim" items to free up enough space.

The paper evaluates three ways to handle multiple victims:

  1. Implicit Victims (IV): Compares the new item's frequency against the first cache victim. If the new item is more frequent, it blindly evicts as many subsequent items as needed to free space.
  2. Queue of Victims (QV): Iteratively compares the new item against victims one by one. It evicts a victim if the new item is more frequent, but aborts the entire admission if it encounters a victim more popular than the new item.
  3. Aggregated Victims (AV) [Novel]: Instead of one-by-one comparisons, AV gathers a group of potential victims whose combined size matches the new item. It then compares the frequency of the new item against the cumulative frequency of the entire victim set.

To keep AV fast, they implement an Early Pruning Optimization: if the running sum of the victims' frequencies surpasses the new item's frequency mid-calculation, the process aborts early since the new item won't be admitted anyway.

Datasets

The policies were evaluated using extensive trace-based simulations across ten real-world datasets from four distinct environments:

  • MSR (1, 2, 3): Enterprise storage system traces.
  • SYSTOR (1, 2, 3): Virtual Desktop Infrastructure (VDI) storage traces.
  • CDN (1, 2, 3): Content Delivery Network deployments with massive file size variations.
  • TENCENT1: A large-scale photo service trace.

Key Insights and Ideas

  • The Power of Collective Value (AV): Comparing an incoming item to individual victims sequentially (like IV or QV) doesn't capture the big picture. Admitting a large item means losing all the space occupied by the victims. AV's approach of comparing against the sum of the victims' frequencies ensures that a new item is only admitted if it is truly more valuable than the collective group it replaces.
  • The "Cache Cleaning" Effect of QV: While QV underperforms in standard hit-ratio, it excels in byte hit-ratio (the total percentage of data bytes served from the cache). This happens because QV evicts less-frequent items during its evaluation process even if the new item is ultimately rejected. This effectively purges low-frequency clutter from the cache.
  • The Large-Cache Flaw in Probabilistic Policies: The authors discovered that policies like AdaptSize, which admit items with a probability inversely proportional to their size, fail to fully utilize very large caches. They reject large items even when the cache has plenty of free space, leaving valuable cache capacity wasted.

Key Results

  • Throughput & Speed: The AV policy with an early pruning optimization is a clear winner in computational efficiency. It operates in constant time $O(1)$ and runs up to 3x faster than the closest size-aware alternatives (like LHD and AdaptSize), making its CPU overhead comparable to standard, size-oblivious LRU.
  • Hit-Ratios: AV consistently achieved competitive or superior object hit-ratios across all ten real-world traces compared to complex state-of-the-art algorithms (GDSF, AdaptSize, LHD, LRB).
  • Byte Hit-Ratios: For bandwidth-heavy CDN workloads, the QV variant proved highly effective, closely trailing or matching machine-learning-heavy models (LRB) without the massive computational cost.

Limitations and Future Work

The primary limitation highlighted is the fundamental tension between optimizing for hit-ratio (maximizing the number of requests served) versus byte hit-ratio (maximizing the volume of data served from cache). AV wins on the former, while QV wins on the latter.

Additionally, the authors note that cache "slabbing" (dividing the cache into zones for similar-sized objects) is an orthogonal technique. A promising direction for future work is exploring how combining AV/QV with dynamic slabbing mechanisms could yield even higher performance.

Summary updated

BibTeX
@article{einziger2022lightweight,
  author = {Gil Einziger and Ohad Eytan and Roy Friedman and Benjamin Manes},
  title = {{Lightweight Robust Size Aware Cache Management}},
  journal = {ACM Trans. Storage},
  year = {2022},
  doi = {10.1145/3507920},
}
Figure