Cache Evicting
Cache Evicting Overview
As the storage space used by Alluxio is limited, the Cache Evicting feature evicts old data through several strategies to ensure that there is enough storage space to cache new data.
There are two different ways Alluxio will evict its cache:
Evict on Writing
Background Asynchronous Evicting
Evict on Writing
Evict on writing is to synchronously check and eliminate the cached data when writing pages in Alluxio. The eviction will be triggered when Alluxio is about to write a page that would cause the total cache to exceed the storage capacity.
Cache Evictors
Alluxio provides the following five evictors to evict cached data:
LRUCacheEvictor
(default): LRU cache eviction policyFIFOCacheEvictor
: FIFO cache eviction policyLFUCacheEvictor
: LFU cache eviction policy. Pages are sorted in bucket order based on logarithmic count. Pages inside the bucket are sorted in LRU order.NondeterministicLRUCacheEvictor
: LRU with non-deterministic cache eviction policy. Uniformly evict elements in the LRU tail.TwoChoiceRandomEvictor
: Two Choice Random client-side cache eviction policy. It selects two random page IDs and evicts the one least-recently used.
The worker cache and client cache have separate properties to define their respective evictor. For example, the following configuration in alluxio-site.properties
sets LRUCacheEvictor
for both worker and client-side caches.
Background Asynchronous Evicting
Eviction on writing will degrade performance dramatically if there is insufficient cache space. Background asynchronous evicting aims at evicting cached data asynchronously beforehand to avoid evicting cached data during a write operation.
To enable the background asynchronous evicting feature, add the following configurations to alluxio-site.properties
:
By setting the above configuration, Alluxio will create a background thread that checks if the page cache space reaches the high water mark threshold. Once this condition is triggered, it will evict cached pages until the low water mark threshold is reached. The background thread will check periodically defined by the check interval property.
REST API for Updating Configurations Dynamically
Alluxio provides the following REST APIs for users to set and get async eviction configurations dynamically:
Enable async eviction and update the related parameters
Disable async eviction
Get the current async eviction parameters
Last updated