Soru

Zorluk: OrtaApplication Caching and Session State Management

A developer is designing a web application hosted on AWS Lambda that connects to an Amazon RDS PostgreSQL database. The application must store transient user session data that expires after 24 hours, and it must also cache frequent, read-heavy queries from the RDS database to reduce latency and database load.

Which two options should the developer choose to meet these requirements? (Select TWO.)

  1. Store user session data in Amazon DynamoDB with a partition key of UserId and enable Time to Live (TTL) to automatically delete expired sessions.Cevap
  2. Implement Amazon ElastiCache for Redis to cache database query results from the Amazon RDS instance using a lazy-loading strategy.Cevap
  3. C
    Store the transient user session state in AWS Systems Manager Parameter Store as SecureString parameters to allow global sharing across all sessions.
  4. D
    Retrieve user session data from Amazon DynamoDB using the Scan operation with a filter expression on UserId to avoid configuring a primary partition key.
  5. E
    Cache session data within the AWS Lambda function's global execution context memory to guarantee session persistence across all concurrent users.

Cevap

Store user session data in Amazon DynamoDB with a partition key of UserId and enable Time to Live (TTL), and implement Amazon ElastiCache for Redis to cache database query results from the Amazon RDS instance using a lazy-loading strategy.
The correct combination is storing session data in Amazon DynamoDB with a partition key of UserId and enabling Time to Live (TTL), and implementing Amazon ElastiCache for Redis to cache database query results using a lazy-loading strategy. Storing session state in Amazon DynamoDB is a standard, highly scalable architecture pattern. Since the sessions expire in 24 hours, DynamoDB TTL automatically deletes expired items at no cost, saving write capacity. For the relational database queries, Amazon ElastiCache for Redis acts as a high-performance caching layer that drastically reduces load on the Amazon RDS instance.

Adım Adım Çözüm

1
Analyze session state requirements.
The session data is transient, needs to expire after 24 hours, and requires fast read/write operations.
Choosing DynamoDB with TTL meets the durability and automatic expiration requirements cost-effectively.
2
Analyze database caching requirements.
Frequent, read-heavy query results from a relational database (RDS PostgreSQL) need to be cached.
An in-memory cache like Amazon ElastiCache for Redis is designed for this use case and supports lazy-loading to dynamically populate the cache on demand.

Anahtar Kavram

Caching database query results with ElastiCache and managing transient session states with DynamoDB TTL.

Alternatif Yöntem

Instead of ElastiCache for Redis, self-hosting Redis on Amazon EC2 could be used, but this adds administrative overhead and does not align with AWS managed database/caching best practices.
Tahmini Süre:2m 0s
Bu soruyu puanla