Soru

Zorluk: OrtaImplement Azure Cache for Redis Configuration and Data Patterns

A web application for a news outlet uses Azure Cache for Redis to store articles. The articles fall into two main categories:

1. Breaking news stories, which receive a high volume of read requests shortly after publication, but traffic drops to zero within 2424 hours.
2. Evergreen features, which receive a steady, low-volume stream of read requests consistently over several months.

All cached articles are configured with a Time-to-Live (TTL) value. Under high load, the cache memory limit is reached. You need to configure an eviction policy that retains the evergreen features (consistently accessed over time) and prioritizes evicting breaking news stories whose traffic has subsided, even if those stories were accessed more recently than some evergreen features.

Which eviction policy should you choose?

  1. A
    volatile-lru
  2. B
    volatile-ttl
  3. volatile-lfuCevap
  4. D
    noeviction

Cevap

The volatile-lfu eviction policy.
The volatile-lfu policy evicts keys with an expire set (TTL) that have the lowest access frequency counter. This ensures that evergreen articles, which accumulate a high frequency of access over time, are preserved, while breaking news articles that are no longer being frequently accessed are evicted first, even if they were accessed more recently than some evergreen articles.

Adım Adım Çözüm

1
Identify key characteristics of the cached items.
All items have a Time-to-Live (TTL) set. Breaking news has high initial but short-lived access. Evergreen content has low but continuous access over time.
Knowing whether keys have a TTL determines whether to use a volatile or allkeys policy. Analyzing access patterns determines whether Least Recently Used (LRU) or Least Frequently Used (LFU) is appropriate.
2
Compare LRU and LFU algorithms.
LRU evicts keys that haven't been accessed for the longest time. LFU evicts keys with the lowest total access frequency counter.
Since breaking news articles may have been accessed recently but have lower overall frequency once they go cold, LRU would mistakenly keep them and evict the consistently accessed evergreen articles.
3
Select the correct policy targeting keys with TTL.
volatile-lfu is selected.
Since all keys have a TTL configured and we want to preserve high-frequency keys (evergreen content), volatile-lfu is the correct choice.

Anahtar Kavram

Least Frequently Used (LFU) eviction policies in Azure Cache for Redis configuration
Bu soruyu puanla