nerdexam
Google

PROFESSIONAL-CLOUD-DATABASE-ENGINEER · Question #164

You are using Memorystore for Redis to cache frequently accessed data and improve your application's performance. Recently, your application is experiencing sudden spikes in latency when interacting…

The correct answer is C. Scale the Memorystore instance to a larger memory size. Scaling the Memorystore instance to a larger memory size is the correct solution. 'Evicted keys' messages in Redis indicate that the cache has run out of memory and is forcibly removing keys to make room for new ones, according to the configured eviction policy. This causes…

Optimizing database performance

Question

You are using Memorystore for Redis to cache frequently accessed data and improve your application's performance. Recently, your application is experiencing sudden spikes in latency when interacting with the Memorystore for Redis instance. Upon checking the logs, you discover a high number of "evicted keys" messages. You want to reduce the occurrences of latency spikes and their impact on the application. What should you do-

Options

  • AIncrease the time to live (TTL) value of all the keys within the cache.
  • BRedeploy your application to the same zone as the Memorystore instance.
  • CScale the Memorystore instance to a larger memory size.
  • DEnable read replicas. Deploy additional read replica instances to distribute read workloads.

How the community answered

(51 responses)
  • A
    6% (3)
  • B
    4% (2)
  • C
    80% (41)
  • D
    10% (5)

Explanation

Scaling the Memorystore instance to a larger memory size is the correct solution. 'Evicted keys' messages in Redis indicate that the cache has run out of memory and is forcibly removing keys to make room for new ones, according to the configured eviction policy. This causes latency spikes because the application must then fetch evicted data from the slower backing database. Increasing the available memory reduces evictions, keeping more keys in cache and stabilizing latency. Increasing TTL values (A) would cause keys to persist longer, which exacerbates the memory pressure and leads to even more evictions - the opposite of what is needed. Redeploying the application to the same zone (B) reduces network latency slightly but does not address the root cause of memory exhaustion. Enabling read replicas (D) distributes read load across replicas, which can help with throughput but does not fix evictions caused by insufficient total memory capacity.

Topics

#Memorystore for Redis#Caching#Performance Tuning#Troubleshooting

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DATABASE-ENGINEER Practice