Soru

Zorluk: KolayApplication Caching and Session State Management

A developer is building a web application and wants to store user session data externally. The application requires a solution that natively supports automatically deleting expired session items after a specified period of time to keep costs low and limit storage growth, without requiring custom deletion code. Which AWS service and feature should the developer use to meet these requirements?

  1. A
    AWS Lambda execution context global variables
  2. Amazon DynamoDB with Time-to-Live (TTL) enabledCevap
  3. C
    Amazon Systems Manager Parameter Store with secure strings
  4. D
    Amazon DynamoDB with a nightly application cron script that executes a Scan operation to delete expired sessions

Cevap

Amazon DynamoDB with Time-to-Live (TTL) enabled is the best solution for storing session state and automatically purging expired items without custom code.
Amazon DynamoDB is a fully managed NoSQL database service that provides single-digit millisecond latency at scale. It includes a native Time-to-Live (TTL) feature that allows developers to define a timestamp attribute on items. Once the current time passes the timestamp, DynamoDB automatically deletes the item within a few days without consuming provisioned throughput, eliminating the need to write custom cleanup code.

Adım Adım Çözüm

1
Identify the data storage requirements.
The application needs external, high-speed, key-value session storage with automatic deletion of expired records.
This determines which database types and features are appropriate.
2
Evaluate the deletion requirement.
Amazon DynamoDB offers a native Time-to-Live (TTL) feature that automatically deletes expired items based on an epoch timestamp attribute without using provisioned read/write capacity.
This avoids the need to build and maintain custom cleanup scripts or cron jobs.
3
Compare against alternatives.
Other options such as Lambda context storage or Parameter Store do not support automatic expiration or high-throughput session state workflows, and manual DynamoDB Scan operations are inefficient.
This confirms that the native TTL feature in DynamoDB is the most cost-effective and scalable choice.

Anahtar Kavram

Storing session state externally in Amazon DynamoDB and leveraging its native Time-to-Live (TTL) feature to automate cleanup of expired records.

Alternatif Yöntem

For session data with sub-millisecond requirements that require advanced data structures, Amazon ElastiCache (Redis) can be used with a key expiration (TTL) set via the EXPIRE command.
Tahmini Süre:1m 0s
Bu soruyu puanla