CacheSifter: Sifting Cache Files for Boosted Mobile Performance and Lifetime

Yu Liang, Riwei Pan, Tianyu Ren, Yufei Cui, Rachata Ausavarungnirun, Xianzhang Chen, Changlong Li, Tei-Wei Kuo, Chun Jason XueFAST 2022 · OpenReview

TL;DR

Mobile devices are bogged down by cache files that degrade performance and shorten flash storage lifespan. This paper introduces CacheSifter, a novel framework that intelligently categorizes cache files using machine learning and manages them differently based on their predicted reuse, significantly reducing unnecessary writes and improving device responsiveness.

What Problem Does This Paper Address?

Mobile applications heavily rely on caching data locally to improve user experience by reducing latency and avoiding repeated network downloads. However, this practice leads to a massive accumulation of cache files on mobile devices. These files consume valuable storage space and, more critically, contribute to a high volume of write operations to the device's flash storage. Flash storage has a finite lifespan, and excessive writes accelerate wear, leading to premature failure. Furthermore, managing all cache files equally, regardless of their actual reuse patterns, is inefficient and can lead to performance degradation due to memory contention. Existing systems treat all cache files the same, which is suboptimal given that some files are used only once while others are frequently accessed.

Methods

CacheSifter tackles this problem by introducing a novel, lightweight, machine-learning-based approach to categorize cache files into three types:

  • Burn-After-Reading (BAR): Files that are unlikely to be reused after their initial access.
  • Transient: Files that are accessed frequently for a short period.
  • Long-living: Files that are accessed frequently over a long duration.

The core of CacheSifter is its online categorization engine. It uses two lightweight Multi-Layer Perceptron (MLP) models to classify files in real-time. The first phase categorizes files as BAR or non-BAR, and the second phase further distinguishes between Transient and Long-living files.

Based on these categories, CacheSifter employs different management strategies:

  • BAR files are immediately discarded to save space and reduce writes.
  • Transient files are kept in DRAM using a custom quasi-in-memory file system (QMFS) to ensure fast access during their active period, with an LRU-like eviction policy to manage memory pressure.
  • Long-living files are managed by the default Android system's LRU-based page cache, which eventually writes them to flash storage.

CacheSifter also incorporates user behavior adaptation by re-categorizing files if their access patterns change after re-download, and a safety mechanism (safe_list) to prevent the deletion of critical cache files.

Datasets

The paper does not explicitly mention pre-existing public datasets for training. Instead, the authors collected their own dataset by instrumenting the Android kernel on real mobile devices. This dataset comprises:

  • Access information (read/write counts and sizes) and file attributes (size, active period) for cache files.
  • Data collected from ten representative applications over 20 hours.
  • Data from the same applications used by different users to capture varied behaviors.
  • Data collected over three months to assess model retraining needs.
  • Data from different applications to evaluate generalization.

The authors also conducted experiments on two specific smartphones: a P9 and a Mate30.

Key Insights and Ideas

  • Cache file reuse is highly variable: Not all cache files are created equal; their access patterns differ dramatically, making a one-size-fits-all approach inefficient.
  • BAR files are a significant opportunity: A large majority (93% in their dataset) of cache files are BAR, meaning they can be safely discarded without impacting user experience or requiring re-download.
  • Lightweight ML is sufficient: A simple MLP model, trained offline and deployed online, can effectively categorize cache files with minimal overhead.
  • DRAM for Transient files is key: Keeping frequently accessed but short-lived files in DRAM significantly boosts performance and avoids unnecessary flash writes.
  • Kernel-level integration is crucial: Implementing CacheSifter directly in the kernel allows for efficient access to file system information without significant overhead or user-space complexity.

Key Results

  • Writeback Reduction: CacheSifter reduces cache file writebacks by an average of 62% (high-recall model) and 59.5% (high-accuracy model) on the P9 smartphone. On the Mate30, these numbers are even more impressive, reaching 88.3% and 85.5%, respectively.
  • I/O Performance Improvement: I/O intensive write performance is improved by an average of 18.4% (high-recall) and 25.5% (high-accuracy) on the P9.
  • Lifetime Improvement: The reduction in I/O leads to a potential lifetime improvement of mobile flash storage by an average of 113.7% to 120.8%.
  • Minimal Overhead: The memory overhead of CacheSifter is typically less than 12.5MB, and CPU time overhead is an average of 84ms per iteration (10 seconds).
  • User Experience: CacheSifter has a minimal impact on application framerates (FPS), with no noticeable negative effects observed.

Limitations and Future Work

  • Retraining: While the models showed good generalization over three months, retraining might be necessary if applications undergo significant updates or if user behaviors drastically change. The authors suggest reinforcement learning as an alternative to avoid frequent retraining.
  • Platform Independence: While the models trained on one platform (P9) worked well on another (Mate30), the authors acknowledge that parameters might need tuning for different device manufacturers or future generations of mobile devices due to variations in hardware and application behavior.
  • Misclassification Penalty: Although the high-recall model aims to minimize re-download penalties, misclassifications can still occur. The paper shows the re-download upper and lower bounds for optimized applications.
  • Future Work: The authors suggest that CacheSifter could be extended to other Internet of Things (IoT) systems or automotive systems. They also mention that a lightweight reinforcement learning method could be explored to avoid retraining.

Summary updated

BibTeX
@inproceedings{liang2022cachesifter,
  author = {Yu Liang and Riwei Pan and Tianyu Ren and Yufei Cui and Rachata Ausavarungnirun and Xianzhang Chen and Changlong Li and Tei-Wei Kuo and Chun Jason Xue},
  title = {{CacheSifter: Sifting Cache Files for Boosted Mobile Performance and Lifetime}},
  booktitle = {FAST},
  year = {2022},
  url = {https://openreview.net/forum?id=7xEeISj9bb},
}
Figure