exam questions

Exam AWS Certified Database - Specialty All Questions

View all questions & answers for the AWS Certified Database - Specialty exam

Exam AWS Certified Database - Specialty topic 1 question 154 discussion

Exam question from Amazon's AWS Certified Database - Specialty
Question #: 154
Topic #: 1
[All AWS Certified Database - Specialty Questions]

A development team at an international gaming company is experimenting with Amazon DynamoDB to store in-game events for three mobile games. The most popular game hosts a maximum of 500,000 concurrent users, and the least popular game hosts a maximum of 10,000 concurrent users. The average size of an event is 20 KB, and the average user session produces one event each second. Each event is tagged with a time in milliseconds and a globally unique identifier.
The lead developer created a single DynamoDB table for the events with the following schema:
✑ Partition key: game name
✑ Sort key: event identifier
✑ Local secondary index: player identifier
✑ Event time
The tests were successful in a small-scale development environment. However, when deployed to production, new events stopped being added to the table and the logs show DynamoDB failures with the ItemCollectionSizeLimitExceededException error code.
Which design change should a database specialist recommend to the development team?

  • A. Use the player identifier as the partition key. Use the event time as the sort key. Add a global secondary index with the game name as the partition key and the event time as the sort key.
  • B. Create two tables. Use the game name as the partition key in both tables. Use the event time as the sort key for the first table. Use the player identifier as the sort key for the second table.
  • C. Replace the sort key with a compound value consisting of the player identifier collated with the event time, separated by a dash. Add a local secondary index with the player identifier as the sort key.
  • D. Create one table for each game. Use the player identifier as the partition key. Use the event time as the sort key.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
novice_expert
Highly Voted 3 years, 1 month ago
Selected Answer: D
ItemCollectionSizeLimitExceededException Message: Collection size exceeded. For a table with a local secondary index, a group of items with the same partition key value has exceeded the maximum size limit of 10 GB. For more information on item collections, see Item Collections. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html Problem is too much data in partition cause issues with LocalSecondaryIndex. one game_id had 500K users with 20K data per event = 10GB/event Solution is separate table for game and partition by player_id Each table will have max 500000 partitions each partition gets 3600 events per hour * 20KB/events = 72 MB... so it can store data for 10GB/72 MB = 13 hours data before ItemCollectionSizeLimitExceededException for option D design. For game I guess TTL would be set to avoid it
upvoted 7 times
Stteve
2 years, 9 months ago
Are you asking the developers to rewrite the application as changing from 1 table to 3 tables ?
upvoted 3 times
Mintwater
2 years, 2 months ago
should not be that difficult because the original code is possible with "...from table X where game_id=?" and table X could be a dynamic parameter -- maybe the programer even don't need to change the code.
upvoted 1 times
Germaneli
1 year, 8 months ago
The partition key was obviously chosen wrong (game name has low cardinality as there are only 3 distinct games). This leads to overloading their partitions. The solution and best practice is to choose a partition key with high cardinality --> user name. https://aws.amazon.com/blogs/database/choosing-the-right-dynamodb-partition-key/
upvoted 1 times
...
...
...
...
aqiao
Most Recent 2 years, 2 months ago
Selected Answer: D
I' will go with D, for A you can consider GSI as table, if you still use game name as partition key, guess it will raise the same exception
upvoted 1 times
...
lollyj
2 years, 5 months ago
Selected Answer: D
Chose D because the partition key is to have high cardinality. Option A and C are out of the question because it is inferring to modify the table which is not possible on the fly. Option B also didn't seem to feasible
upvoted 1 times
...
Sab
2 years, 6 months ago
Selected Answer: D
B and C is out of question. Between A and D, problem with A is the global index with game name as the partition key. This will create hot partitions since one game has over 500000 concurrent users. So better to have 3 tables, with players are partition key.
upvoted 1 times
...
RotterDam
3 years, 3 months ago
Got this question in my exam. (i cleared it). But this is one of those questions I dont know if I got it right...I chose (D)
upvoted 1 times
...
RotterDam
3 years, 3 months ago
Selected Answer: A
I feel its A LSI is the problem here with Low cardinality. But remember the question is asking about doing queries using game name. So you do need some form of index for that and GSI will solve it. This isnt being addressed in (D)
upvoted 1 times
RotterDam
3 years, 3 months ago
Actually GSI will also have a problem with very low cardinality as game name is a terrible choice for partition key. I will go with (D) - damn this is a tough one
upvoted 1 times
...
...
soyyodario
3 years, 4 months ago
Selected Answer: D
I vote for D An item collection is too large. This exception is only returned for tables that have one or more local secondary indexes. https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Types/ItemCollectionSizeLimitExceededException.html
upvoted 2 times
RotterDam
3 years, 3 months ago
Is the Global Secondary Index having a very low cardinality also an issue?
upvoted 1 times
RBSK
2 years, 5 months ago
No, 10GB limit does not apply to GSI. The maximum size of any item collection for a table which has one or more local secondary indexes is 10 GB. This does not apply to item collections in tables without local secondary indexes, and also does not apply to item collections in global secondary indexes. Only tables that have one or more local secondary indexes are affected.
upvoted 1 times
RBSK
2 years, 5 months ago
Hence "A" should be a right ans too. With A, we do not need to change the application like "D". Hence my vote will be to "A"
upvoted 1 times
...
...
...
...
szl0144
3 years, 4 months ago
I think D is correct
upvoted 2 times
...
jove
3 years, 5 months ago
Selected Answer: D
I'd go with option D
upvoted 3 times
...
AlexChih
3 years, 6 months ago
Selected Answer: A
I think A make sense to me as the document mention: "The maximum size of any item collection is 10 GB. This limit does not apply to tables without local secondary indexes; only tables that have one or more local secondary indexes are affected", avoid to use local secondary index will be the better solution.
upvoted 3 times
jove
3 years, 5 months ago
Why not option D?
upvoted 2 times
...
...
johnconnor
3 years, 6 months ago
C Makes sense to me
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...