Question

Difficulty: HardImproving Database and Caching Efficiency

A software-as-a-service (SaaS) collaboration platform uses an Amazon RDS for PostgreSQL DB instance to manage user workspaces, active tasks, and team permissions. During peak business hours, the database experiences severe performance degradation, with CPU utilization exceeding 90% and query response times increasing significantly.

A database analysis reveals two main contributors to the bottleneck:
1. A massive volume of repetitive, read-only queries from application servers fetching static team permission configurations.
2. Exhaustion of database connection limits due to thousands of transient AWS Lambda functions frequently opening and closing connections to verify user session tokens.

The session token verification data changes dynamically and must be cached with high availability. The cache must support replication and automatic failover across multiple Availability Zones to prevent user session loss if a primary cache node fails.

Which architecture should a solutions architect implement to address these performance bottlenecks while meeting the high availability requirements?

  1. Deploy an Amazon RDS Proxy between the Lambda functions and the PostgreSQL database to manage connection pooling, and implement an Amazon ElastiCache for Redis replication group with Multi-AZ enabled to cache the team permission rules and user session tokens.Answer
  2. B
    Deploy an Amazon RDS Proxy between the Lambda functions and the PostgreSQL database to manage connection pooling, and implement an Amazon ElastiCache for Memcached cluster to cache the team permission rules and user session tokens.
  3. C
    Enable Multi-AZ deployment on the Amazon RDS for PostgreSQL DB instance, route the read-only queries for the team permission rules to the standby replica, and configure AWS Lambda reserved concurrency to limit the database connection count.
  4. D
    Deploy an Amazon ElastiCache for Memcached cluster with automatic replication across multiple Availability Zones to cache the team permission rules and user session tokens, and configure the Lambda functions to use an RDS Read Replica for database connection pooling.

Answer

Deploy an Amazon RDS Proxy between the Lambda functions and the PostgreSQL database to manage connection pooling, and implement an Amazon ElastiCache for Redis replication group with Multi-AZ enabled to cache the team permission rules and user session tokens.
The correct solution uses Amazon RDS Proxy to pool database connections from the AWS Lambda functions, solving the connection exhaustion problem. It also uses an Amazon ElastiCache for Redis replication group with Multi-AZ enabled, meeting the replication and automatic failover requirements to ensure that cached session tokens survive node failures.

Step-by-Step Solution

1
Address the connection limit exhaustion caused by transient compute resources.
Introduce Amazon RDS Proxy to pool and share database connections from the AWS Lambda functions.
Lambda functions scale rapidly and open many short-lived connections, which easily exhausts database connection limits. RDS Proxy keeps database connections open and multiplexes the incoming traffic.
2
Select the correct caching engine based on high availability and replication requirements.
Choose Amazon ElastiCache for Redis over ElastiCache for Memcached.
The scenario requires session data to survive cache node failures through replication and automatic failover across multiple Availability Zones. Redis supports replication groups and Multi-AZ failover, whereas Memcached is a non-replicated cache.
3
Evaluate the read-scaling mechanism for database queries.
Avoid routing read traffic to the RDS Multi-AZ standby.
RDS standby replicas in a Multi-AZ deployment are passive and cannot serve read traffic. Offloading read queries requires a caching layer (like Redis) or dedicated Read Replicas.

Key Concept

Database connection pooling and cache replication strategies
Estimated Time:2m 30s
Rate this question