Designing a DynamoDB System for Video Game Scores

Best Practices for DynamoDB System Design

Prev Question Next Question

Question

You are creating a new API for video game scores.

Reads are 100 times more common than writes.

The top 1% of scores are read more frequently than the rest of the scores.

These reads come from the high scores.

Which of the following options is the best to design this system using DynamoDB?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - D.

To speed up queries on non-key attributes, you can create a global secondary index.

A global secondary index contains a selection of attributes from the base table.

But they are organized by a primary key that is different from that of the table.

The index key does not need to have any of the key attributes from the table.

It doesn't even need to have the same key schema as a table.

Refer to page 504 in https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/dynamodb-dg.pdf.

DAX is a DynamoDB-compatible caching service that enables you to benefit from fast in-memory performance for demanding applications.

DAX addresses three core scenarios.

1

As an in-memory cache, DAX reduces the response times of eventually consistent read workloads by order of magnitude from single-digit milliseconds to microseconds.

2

DAX reduces operational and application complexity by providing a managed service that is APIcompatible with DynamoDB.

Therefore, it requires only minimal functional changes to use with an existing application.

3

For read-heavy or bursty workloads, DAX provides increased throughput and potential operational cost savings by reducing the need to overprovision read capacity units.

This is especially beneficial for applications that require repeated reads for individual keys.

Refer to page 663 in https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/dynamodb-dg.pdf.

The best option to design the system using DynamoDB would be option D: Create Global Secondary Index (GSI) properly based on the top score(s). Use DAX as the caching service.

Here's a detailed explanation:

Option A: DynamoDB table with 100x higher read than write throughput, with CloudFront caching. This option suggests creating a DynamoDB table with read throughput that is 100 times higher than write throughput. However, this option does not take into account the fact that the top 1% of scores are read more frequently than the rest of the scores. Also, while CloudFront caching can improve performance for frequently accessed data, it may not be the most efficient way to handle the high read requests for the top scores.

Option B: DynamoDB table with roughly equal read and write throughput, with CloudFront caching. This option suggests creating a DynamoDB table with roughly equal read and write throughput. However, since reads are 100 times more common than writes, this would not be an optimal solution. Additionally, CloudFront caching may not be the best approach to handle the high read requests for the top scores.

Option C: DynamoDB table with 100x higher read than write throughput, with ElastiCache caching. This option suggests creating a DynamoDB table with read throughput that is 100 times higher than write throughput, along with using ElastiCache for caching. While this option takes into account the high read requests, it does not address the fact that the top 1% of scores are read more frequently than the rest of the scores. Also, using ElastiCache can add additional complexity and cost to the system.

Option D: Create Global Secondary Index (GSI) properly based on the top score(s). Use DAX as the caching service. This option suggests creating a Global Secondary Index (GSI) based on the top score(s), which will allow efficient querying of the high score data. Additionally, using DAX as the caching service can improve performance for frequently accessed data. This solution takes into account the fact that the top 1% of scores are read more frequently than the rest of the scores and provides an efficient solution for handling those high read requests.

Therefore, option D is the best solution for designing the system using DynamoDB.