AWS DevOps Engineer - DOP-C01 Exam: Web Application Scaling and DynamoDB Configuration

Web Application Scaling and DynamoDB Configuration

Prev Question Next Question

Question

You have a web application that is currently running on three M3 EC2 instances in three different AZs.

You have an Auto Scaling group configured to scale from three to thirty instances.

When reviewing your CloudWatch metrics, you see that sometimes your Auto Scaling group hosts fifteen instances.

The web application is reading and writing to a DynamoDB-configured backend, configured with 800 Write Capacity Units and 800 Read Capacity Units.

Your DynamoDB Primary Key is the Company ID.

You are hosting 25 TB of data in the database.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Answer - E.

The AWS documentation provide the following information on the best performance for DynamoDB tables.

The optimal usage of a table's provisioned throughput depends on these factors:

The primary key selection.

The workload patterns on individual items.

The primary key uniquely identifies each item in a table.

The primary key can be simple (partition key) or composite (partition key and sort key).

When it stores data, DynamoDB divides a table's items into multiple partitions, and distributes the data primarily based upon the partition key value.

Consequently, to achieve the full amount of request throughput you have provisioned for a table, keep your workload spread evenly across the partition key values.

Distributing requests across partition key values distributes the requests across partitions.

Option A is incorrect because ElastiCache should be in front of the DynamoDB instance instead of the web application.

Option B is incorrect because the read capacity units should be improved instead of the write capacity units.

Option C is incorrect because the computer capacity of instances is not the major issue.

We should improve the improper primary key in the DynamoDB instance.

Option D is incorrect because this may help however it does not fix the root cause of the problem.

For more information on DynamoDB best practises please visit the link:

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForTables.html

Note:

One of the AWS forumns is explaining the steps for this process in detail.

Based on that, while importing data from S3 using datapipeline to a new table in dynamodb we can create a new index.

Please find the steps given below.

1

Log into AWS console, select DynamoDB

2

Select table you want to copy.

3

Click Export/Import.

Export/Import uses dataPipeline and EMR to copy DynamoDB table to S3 and from S3 to DynamoDB table.

4

If you have not already, you need to create two IAM roles for Export/Import.

Documentation is available here.

5

Select Export table option ( Detailed documentation for exporting table data to S3 is available here.

6

You will need to specify

a.

S3 bucket where the table data will be copied and another bucket where the log files for the operation will be stored.

You can use the same bucket.

b.

The percentage of the throughput capacity you have provisioned for the table that you want to use for reading data from the table ( to copy to S3)

The default is 25%

Increasing the percentage will speed up the backup.

c.

The IAM roles : The values will be defaulted.

7

Select "create data pipeline" option and the backup will be scheduled.

The backup could take time depending on size of the table.

8

Once export is complete, check logs to verify there are no errors.

9

Note details of the hash and range key of the table.

10

Delete the table.

11

Create table with the right index.

Set the provisioned throughput

12

Import into table from S3 using the Import option.

13

Once complete, verify there are no errors.

For more information please view the following link:

https://forums.aws.amazon.com/thread.jspa?threadID=149069

The problem described in the question is that sometimes the Auto Scaling group hosts fifteen instances, indicating that the web application is experiencing high traffic. The web application reads and writes to a DynamoDB-configured backend with 800 Write Capacity Units and 800 Read Capacity Units. The DynamoDB Primary Key is the Company ID, and there are 25 TB of data in the database. The question asks which solution would be most effective in addressing this problem among the options given.

A. Add a caching layer in front of your web application by choosing ElastiCache Memcached instances in one of the AZs. Adding a caching layer using ElastiCache Memcached instances can improve the performance of the web application by reducing the number of requests to DynamoDB, which can help reduce the cost and improve the scalability of the application. Caching can help to reduce the load on the database, which in turn can help to reduce the cost of running the application. This solution can be effective in reducing the number of requests to DynamoDB, but it may not be sufficient to handle the peak load times.

B. Double the number of Write Capacity Units in your DynamoDB instance because the instance is probably being throttled when the customer accesses the website and your web application. Increasing the Write Capacity Units in DynamoDB can improve the performance of the web application by increasing the capacity of the database to handle writes. This solution can help to reduce the number of throttled requests to the database, but it may not be sufficient to handle the peak load times. Additionally, doubling the Write Capacity Units may increase the cost of running the application.

C. Change your Auto Scaling group configuration to use Amazon C3 instance types, because the web application layer is probably running out of compute capacity. Changing the instance type to Amazon C3 can improve the performance of the web application by providing more CPU and memory resources to the application. This solution can be effective in handling peak load times and reducing the latency of the application. However, changing the instance type may increase the cost of running the application.

D. Implement an Amazon SQS queue between your DynamoDB database layer and the web application layer to minimize the large burst in traffic the customer generates when everyone arrives at the office at 9:00AM and begins accessing the website. Implementing an Amazon SQS queue can help to manage the burst in traffic that occurs during peak load times. The queue can help to reduce the number of requests that are sent to the web application at once, which can reduce the load on the database and improve the performance of the application. This solution can be effective in handling peak load times and improving the scalability of the application.

E. Use data pipelines to migrate your DynamoDB table to a new DynamoDB table with a primary key that is evenly distributed across your dataset. Update your web application to request data from the new table. Migrating the DynamoDB table to a new table with a more evenly distributed primary key can help to improve the performance of the application by reducing the number of requests to the database. This solution can be effective in reducing the load on the database and improving the performance of the application. However, migrating the database can be time-consuming and may require downtime for the application.

In conclusion, while all the options could be effective in addressing the problem described, the most effective solution would depend on the specific needs and requirements of the application. Option D, implementing an Amazon SQS queue, would be the best solution in handling peak load times and improving the scalability of the application.