DynamoDB SessionData Table Management After TTL

SessionData Table Management

Question

KindleYou is a location-based social search mobile app that allows users to like or dislike other users, and allows users to chat if both parties liked each other in the app.

It has more than 1 billion customers across the world. They use DynamoDB to support the mobile application and S3 to host the images and other documents shared between users. Consider a table named SessionData that tracks the session history of users.

Each item in SessionData is identified by a partition key (UserName) and a sort key (SessionId)

Additional attributes like UserName, SessionId, CreationTime and ExpirationTime track the session information.The ExpirationTime attribute is set as the Time To Live (TTL) attribute.

How is the data in the SessionData table managed in DynamoDB post TimeToLive (TTL)? Select 2 options.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E. F.

Answer: A,C.

Option A is correct -A background job checks the TTL attribute of items to see if they are expired.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html

Option B is incorrect -A background job checks the TTL attribute of items to see if they are expired.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html

Option C is correct -If the epoch time value stored in the attribute is less than the current time, the item is marked as expired and subsequently deleted.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html

Option D is incorrect - If the epoch time value stored in the attribute is less than the current time, the item is marked as expired and subsequently deleted.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html

Option E is incorrect -This processing of expiry and deletion takes place automatically in the background and does not affect read or write traffic to the table.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html

Option F is incorrect -This processing of expiry and deletion takes place automatically in the background and does not affect read or write traffic to the table.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html

The correct options for how the data in the SessionData table is managed in DynamoDB post TimeToLive (TTL) are A and C.

A. A background job checks the TTL attribute of items to see if they are expired: When a TTL attribute is set for an item in DynamoDB, a background job checks the TTL attribute of each item to determine if it has expired. The background job runs once per hour and checks for expired items. If the TTL attribute value is less than the current time, the item is marked for deletion.

C. If the epoch time value stored in the attribute is less than the current time, the item is marked as expired and subsequently deleted: The TTL attribute in DynamoDB stores an epoch timestamp value that indicates when the item should expire. If the epoch time value stored in the attribute is less than the current time, the item is considered expired and subsequently deleted from the table. DynamoDB does not automatically delete expired items immediately, but it marks them for deletion and removes them during the next periodic background job.

Therefore, after the expiration time of an item, DynamoDB marks the item for deletion, but the item is not immediately removed from the table. Instead, a periodic background job checks the TTL attribute and removes any items that have expired. This process has a very mild performance impact, especially on read traffic.

So, options B, D, E, and F are incorrect: B. No background job is needed to check TTL. Automatically DynamoDB expires the Item: This is not correct, as DynamoDB uses a background job to check and remove expired items.

D. The item is marked as expired and subsequently deleted automatically: This is not entirely correct, as the item is marked for deletion but not immediately deleted. DynamoDB removes the item during the next periodic background job.

E. There is a very mild performance impact when deletion is performed, it especially impacts the read traffic: This is incorrect, as the performance impact of deleting expired items is mild, but it does not primarily impact read traffic. Instead, it impacts write traffic, as DynamoDB marks expired items for deletion during the write operations.

F. There is a very mild performance impact when deletion is performed, it especially impacts the write traffic: This is partly correct, as the performance impact is mild, but it does not primarily impact write traffic. Instead, it impacts read traffic, as DynamoDB removes expired items during the periodic background job, which may cause increased read traffic if many items need to be deleted.