Courseiva
Development with AWS ServicesmediumMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A company runs a web application on EC2 instances behind an Application Load Balancer. The application uses sessions stored in an ElastiCache Redis cluster. Recently, users have been experiencing session timeouts and errors. The developer notices that the Redis cluster is running out of memory. What should the developer do to resolve this issue?

⚠ Common exam trap

It's easy for candidates to confuse eviction policies with TTL-based expiration, thinking that increasing session timeouts (Option A) or reducing application instances (Option C) will solve memory pressure, when in fact only a proper eviction policy directly addresses out-of-memory errors in Redis.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Enable the 'allkeys-lru' eviction policy in the Redis parameter group.

Enabling the 'allkeys-lru' eviction policy in the Redis parameter group allows Redis to automatically evict the least recently used keys when memory is full, preventing session timeouts and errors caused by out-of-memory conditions. This policy is specifically designed for use cases like session storage where losing old sessions is acceptable to free memory for new ones.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Increase the session timeout in the application configuration.

    Why it's wrong here

    Increasing the session timeout in the application configuration would cause session data to persist in Redis for a longer duration. This directly leads to an *increase* in memory consumption, as more active or recently active sessions remain stored, rather than reducing it. Consequently, this action exacerbates the memory pressure on the Redis cluster instead of alleviating it.

  • Enable the 'allkeys-lru' eviction policy in the Redis parameter group.

    Why this is correct

    Enabling the 'allkeys-lru' eviction policy in the Redis parameter group is the correct approach for managing memory pressure. This policy instructs Redis to automatically remove the least recently used (LRU) keys from *all* keys in the dataset when the configured `maxmemory` limit is reached. This proactive memory management ensures that the cache can free up space for new data, preventing out-of-memory errors and maintaining application performance.

  • Reduce the number of EC2 instances behind the load balancer.

    Why it's wrong here

    Reducing the number of EC2 instances behind the load balancer primarily affects the application's compute capacity and the overall request volume directed towards the backend. While it might indirectly reduce the *rate* of new data being written to Redis, it does not address the existing memory footprint of the Redis cluster itself. This action is a scaling adjustment for the application tier, not a direct solution for managing Redis memory utilization or evicting stale data.

  • Migrate from Redis to a Memcached cluster.

    Why it's wrong here

    Migrating from Redis to a Memcached cluster would not inherently resolve memory usage issues, as Memcached also operates as an in-memory key-value store with finite memory limits. While Memcached is often simpler and purely a cache, it still requires proper sizing and management to prevent out-of-memory conditions. This option merely swaps one caching technology for another without directly implementing a strategy to manage the cache's memory footprint, such as an eviction policy.

Visual reference

Client Recursive Resolver Root DNS (13 root servers) TLD DNS (.com, .org, …) Authoritative example.com query IP addr answer

About these practice questions

Courseiva writes every DVA-C02 question from scratch — 724 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.