All Products
Search
Document Center

Tair (Redis® OSS-Compatible):What is the default eviction policy of Tair?

Last Updated:Oct 31, 2024

If a Tair (Redis OSS-compatible) instance is out of memory, a data eviction (or removal) policy is triggered to ensure that the instance does not exceed its memory limit. The default policy is volatile-lru. This policy evicts the less recently used (LRU) keys from keys that have a time-to-live (TTL) configured. This topic describes the eviction policy of Tair (Redis OSS-compatible).

Modify the eviction policy of an instance

To modify the eviction policy of an instance, log on to the Redis console, click the instance ID on the Instances page to go to the Instance Information page, and then click Parameter Settings in the left-side navigation pane. For more information, see Configure instance parameters.

Available eviction policies

  • volatile-lru (default for Tair DRAM-based instances and Redis Open-Source Edition instances): evicts the LRU keys from keys that have a TTL configured regardless of whether the keys have expired.

  • noeviction (default for Tair persistent memory-optimized instances): does not evict keys to make space when the memory limit is reached, but returns errors for write operations.

  • volatile-lfu: evicts the LFU keys from keys that have a TTL configured.

  • volatile-random: randomly evicts keys from keys that have a TTL configured.

  • volatile-ttl: evicts the keys that have the shortest TTL from keys that have a TTL configured.

  • allkeys-lru: evicts the LRU keys from all keys.

  • allkeys-lfu: evicts the LFU keys from all keys.

  • allkeys-random: randomly evicts keys from all keys.

References

If the number of keys decreases, data may be cleared due to expiration. For information about the policies for clearing expired keys and methods to manually clear expired keys in Tair, see Clear expired keys in Tair.