Question

Difficulty: HardHigh-Performing Content Delivery and Caching Solutions

A company hosts a financial reporting application on AWS. The application uses Amazon EC2 instances behind an Application Load Balancer (ALB) to query an Amazon RDS for PostgreSQL database. Users run complex, repetitive SQL queries that retrieve historical transaction records. During month-end reporting cycles, the database CPU utilization reaches 100%100\%, leading to query timeouts and slow response times. The database records are updated only once per day. Which architectural solution should a solutions architect implement to resolve the database bottleneck with the lowest latency?

  1. A
    Configure an Amazon CloudFront distribution in front of the Application Load Balancer, and set the cache behavior minimum, maximum, and default TTLs to 00 on the API path.
  2. B
    Migrate the transaction tables to Amazon DynamoDB in Provisioned Capacity Mode, designing the primary partition key with a monotonically increasing timestamp.
  3. Deploy an Amazon ElastiCache for Redis cluster. Configure the application to implement a cache-aside pattern to check the cache before querying the database, and write query results to the cache.Answer
  4. D
    Attach an Amazon Elastic File System (Amazon EFS) volume using General Purpose performance mode to the RDS database instance to share cached query runs.

Answer

Deploy an Amazon ElastiCache for Redis cluster, and configure the application to check the cache before querying the database, writing query results to the cache (cache-aside pattern).
The correct answer provides an in-memory caching layer (Amazon ElastiCache for Redis) directly in front of the RDS database. Implementing the cache-aside pattern ensures that repetitive, resource-intensive queries are served from memory with sub-millisecond latency. This completely offloads the database from processing redundant queries, resolving the 100%100\% CPU utilization bottleneck.

Step-by-Step Solution

1
Analyze the workload characteristics and bottlenecks.
The workload consists of complex, repetitive SQL queries on data that is only updated once per day, causing 100%100\% CPU utilization on the RDS PostgreSQL database.
Since the queries are identical and run repeatedly, caching the results will prevent the database from executing the same complex SQL queries repeatedly.
2
Select the appropriate caching technology.
Amazon ElastiCache for Redis is selected to cache PostgreSQL database query results at the application layer.
ElastiCache provides sub-millisecond in-memory storage suitable for relational database query results, unlike CloudFront which caches HTTP traffic at edge locations.
3
Implement the caching pattern in the application logic.
Configure the cache-aside (lazy loading) pattern: application checks ElastiCache first; on a cache miss, it queries RDS PostgreSQL, populates the cache with a daily TTL, and returns the result.
This guarantees that subsequent repeated queries within the day bypass the database completely, resolving the CPU bottleneck.

Key Concept

Database query caching using ElastiCache to offload complex relational query execution from Amazon RDS.
Rate this question