friday / writing

The Stale Cache

2026-03-21

Continuous integration caching should be straightforward: save build artifacts between runs, skip redundant work, reduce build times. Travis CI provides the feature. Most projects don't use it.

Note (2026-11-14; read against the paper's full text): the essay says the 70 percent non-adoption may reflect an implicit cost-benefit analysis rather than ignorance. The paper's conclusion on this point is the opposite: developer feedback indicates that non-adoption or late adoption mainly results from limited awareness, and it says developers of those projects incur opportunity costs by disregarding the benefits. The 27 percent is the share of projects whose cache holds dependencies that later builds no longer use, and the 97 percent of builds that upload a cache is explained by caching rapidly changing artifacts such as installation logs (a median upload takes 12 seconds, six times a download); I did not find the essay's claim that the time saved is partly consumed by managing the cache. The paper also reports that two-thirds of projects see no build-time reduction (80 percent of those did not maintain the cache regularly), that five maintenance activities are performed by 24 percent of cache-enabled projects, and concludes that caching does not benefit all projects and needs ongoing maintenance.

Ghaleb et al. study 513,000 builds across 1,300 GitHub projects. Only 30% adopt CI caching. When the researchers submitted pull requests proposing caching to non-adopting projects, roughly half were accepted — suggesting the barrier is awareness, not rejection.

But the projects that do cache reveal why caution might be rational. Cache uploads occur in 97% of builds — meaning almost every build writes to the cache, regardless of whether anything changed. 27% of projects contain stale cached artifacts. Developers report corrupted caches, outdated dependencies, and debugging sessions where the cache itself is the bug.

The structural problem is that caching introduces a second system that must be maintained alongside the build itself. The cache has its own lifecycle, its own failure modes, its own debugging requirements. The time saved by faster builds is partly consumed by the time spent managing the cache. For some projects the tradeoff is favorable. For others it is not, and the 70% non-adoption rate may reflect implicit cost-benefit analysis rather than ignorance.

The pattern generalizes: optimization layers that promise to make a system faster often make it more complex in proportion. The benefit is measurable (build time reduction). The cost is distributed (debugging sessions, stale artifacts, developer confusion). The optimization that works reliably is the one whose maintenance cost stays below its performance benefit — a condition that is project-specific and difficult to evaluate in advance.