Question

Difficulty: MediumImproving Database and Caching Efficiency

An educational technology (EdTech) platform delivers online exams to hundreds of thousands of concurrent students. The application's backend database is an Amazon RDS for PostgreSQL DB instance. During peak testing hours, the database experiences performance degradation, resulting in high query latencies and database connection exhaustion. Analysis reveals two primary bottlenecks: read-heavy queries for static exam questions and test structures, which are updated rarely; and a massive surge of write-heavy transactions when students submit their answers simultaneously. The Solutions Architect must optimize the database and caching efficiency. The caching layer must support replication and automatic failover to prevent database stampedes in the event of a cache node failure, and the write bottleneck must be mitigated while limiting the rate of concurrent database connections. Which two of the following actions should the Solutions Architect implement to meet these requirements? (Select TWO.)

  1. Implement Amazon ElastiCache for Redis in a Multi-AZ replication group to cache the static exam questions and test structures.Answer
  2. B
    Implement Amazon ElastiCache for Memcached in a multi-node cluster to cache the static exam questions and test structures, configuring it for automatic failover and replication across Availability Zones.
  3. Decouple the quiz submission process by sending student responses to an Amazon SQS queue, and configure an AWS Lambda function with reserved concurrency to poll the queue and write answers to the RDS database in batches.Answer
  4. D
    Modify the RDS for PostgreSQL DB instance to use a Multi-AZ deployment, and configure the application to route read queries for exam questions directly to the standby replica.
  5. E
    Decouple the quiz submission process by sending student responses to an Amazon SQS queue, and trigger an AWS Lambda function with unreserved concurrency to write each response to the RDS database immediately.

Answer

Implementing Amazon ElastiCache for Redis in a Multi-AZ replication group to cache the static exam questions, and decoupling the write-heavy quiz submissions using Amazon SQS and AWS Lambda with reserved concurrency to control the database write rate.
To offload the database from read-heavy static exam questions under high-availability constraints, the Solutions Architect should implement Amazon ElastiCache for Redis in a Multi-AZ replication group. Unlike Memcached, Redis supports replication and automatic failover, ensuring that a node failure does not drop the entire cache and overwhelm the backend database. To address the write-heavy quiz submissions, using an Amazon SQS queue to decouple the workload and an AWS Lambda function configured with reserved concurrency ensures that the database receives writes at a controlled, batched pace, avoiding connection pool exhaustion.

Step-by-Step Solution

1
Evaluate the caching requirements for the read-heavy workload.
Identify that the cache requires replication and automatic failover to prevent database stampedes upon node failure.
Amazon ElastiCache for Redis supports replication, Multi-AZ, and automatic failover, making it the appropriate choice compared to ElastiCache for Memcached.
2
Address the write-heavy bottleneck and connection exhaustion issue.
Introduce an Amazon SQS queue to buffer incoming quiz submissions and decouple the synchronous writes.
Buffering write requests prevents immediate spikes from overwhelming the database.
3
Configure the consumer to write to the RDS database safely.
Use an AWS Lambda function with reserved concurrency to pull from the SQS queue and write to the database in batches.
Batching reduces the total transaction rate, and reserved concurrency limits the number of concurrent connections the Lambda function can open to the RDS database.

Key Concept

Improving Database and Caching Efficiency using ElastiCache Redis for replicated cache reads and SQS with Lambda reserved concurrency for decoupled write rate-limiting.
Estimated Time:3m 0s
Rate this question