Testing linear elastic caches
To verify that our principle holds in the true world, we performed intensive experiments utilizing two major sources:
Manufacturing workloads: We’ve got built-in our programs into Spanner. Public traces: To make sure that our outcomes usually are not particular to Google’s infrastructure, we examined towards a wide range of public cache traces from business benchmarks.
manufacturing workload
We developed a sensible algorithm that assigns a time-to-live (TTL) to cached pages for every web page request primarily based on web page entry patterns and prices. Spanner processes billions of requests per second, so this TTL prediction mannequin should be extremely light-weight. We selected a shallow resolution tree that may be translated into a number of strains of C++ code. The ensuing code can also be simple to interpret and supplies invaluable perception into workload traits. This mannequin predicts the optimum TTL for every web page by contemplating options akin to the scale of the information, the price of cache misses (if the information just isn’t in cache and the system should retrieve it from different slower programs akin to disk), and the kind of database operation being carried out.
We spent a number of months integrating elastic cache insurance policies into Spanner’s manufacturing servers. The outcomes have been considerably improved in comparison with customary fixed-size caches.
Reminiscence utilization: 15.5% discount. Cache misses: solely 5.5% enhance. Whole price of possession (TCO): roughly 5% discount.
Importantly, as a result of the algorithm was “cost-aware”, the small enhance in cache misses was focused on knowledge that was low-cost to fetch from storage, so the impression on precise I/O prices was negligible at 0.5%.
public hint
We additionally evaluated our elastic cache strategy utilizing a number of publicly obtainable cache traces. We used an optimized implementation of the Grasping Twin Measurement Frequency (GDSF) eviction algorithm (a generalization of the well-known LRU coverage that permits pages of various sizes) as a baseline coverage for a hard and fast cache dimension.
We thought-about 4 variations of elastic caching, relying on which ski rental algorithm you employ and whether or not you employ a machine studying mannequin. We didn’t implement a call tree for prediction as a result of the obtainable public traces shouldn’t have application-level options that can be utilized for coaching. As an alternative, we developed a easy studying technique that splits every hint in half and makes use of the primary half for coaching. For every particular person web page within the coaching hint, we calculated the optimum TTL for the web page that minimizes the general price of the coaching hint.
As a result of cache habits is dependent upon what’s initially within the cache, a standard observe often known as “warming up” makes use of a cache hint prefix to populate the cache however doesn’t measure precise efficiency. We warmed up all caches with someday’s price of requests from the second half of the hint, and used the remaining for testing and measurements. In the course of the check hint, if we encounter a web page that was considered throughout coaching, we set the TTL to the pre-calculated optimum TTL for that web page. In any other case, use a break-even coverage or a randomized coverage to set the TTL.


