Soru

Zorluk: OrtaImproving Database and Caching Efficiency

A real-time multiplayer gaming platform utilizes an Amazon RDS for MySQL Multi-AZ DB instance to store player profile states, matchmaking rankings, and session metadata. During peak tournament events, players experience significant latency when loading profiles and waiting for matchmaking. Database monitoring indicates that DB instance CPU utilization exceeds 90% due to read-heavy traffic, primarily querying static player stats that do not change during a session. The system architecture requires a caching layer that can scale horizontally, support multi-AZ replication for high availability, and persist cached session summaries so they do not need to be rebuilt from the database if a cache node fails. Which solution should a solutions architect implement to improve database efficiency while meeting these performance and availability requirements?

  1. A
    Configure Amazon RDS Read Replicas for the MySQL DB instance. Direct the game client to route update queries to the primary instance and player profile reads to the Multi-AZ standby instance to reduce read latency.
  2. Deploy an Amazon ElastiCache for Redis cluster with Multi-AZ and automatic failover enabled. Configure the application to query the Redis cluster first, and retrieve the data from the database only on a cache miss.Cevap
  3. C
    Deploy an Amazon ElastiCache for Memcached cluster with nodes distributed across multiple Availability Zones. Configure the application to implement a cache-aside architecture for profile reads and write player data to both the database and the cache.
  4. D
    Submit a request to AWS Support to pre-warm the Application Load Balancer to handle read latency spike thresholds. Configure the application servers to cache player profiles locally in EC2 instance memory.

Cevap

Deploy an Amazon ElastiCache for Redis cluster with Multi-AZ and automatic failover enabled. Configure the application to query the Redis cluster first, and retrieve the data from the database only on a cache miss.
The correct solution is to deploy an Amazon ElastiCache for Redis cluster with Multi-AZ and automatic failover enabled. Unlike Memcached, Amazon ElastiCache for Redis supports data persistence (using RDB or AOF) and replication with automatic failover. Implementing a cache-aside pattern on Redis offloads the read-heavy queries from the RDS DB instance and ensures that if a cache node fails, the data is preserved or recovered via replication, preventing a database overload.

Adım Adım Çözüm

1
Identify the performance bottleneck and access patterns.
The database CPU utilization is high due to read-heavy traffic querying static player profile data that remains unchanged during sessions.
This establishes that the read queries can be safely cached to offload traffic from the primary database.
2
Evaluate the persistence and replication requirements of the caching layer.
The application requires horizontal scaling, high availability (Multi-AZ replication with automatic failover), and persistence of cached session summaries.
This determines that Memcached is unsuitable because it does not support persistence or replication/failover, meaning Redis must be used.
3
Verify database replication limits.
Confirm that RDS Multi-AZ standby instances are passive and cannot serve read traffic directly.
This eliminates options attempting to route read traffic directly to the Multi-AZ standby instance.
4
Implement the cache-aside design pattern using ElastiCache for Redis.
Configure the application to query Redis first and only fall back to the RDS database upon a cache miss, writing the fetched data back to Redis.
This ensures optimal cache hit ratios and database read offloading.

Anahtar Kavram

Distinguishing caching engine capabilities (ElastiCache for Redis vs. Memcached) to support persistence and replication requirements.
Bu soruyu puanla