Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate Target Utilization in DynamoDB table?

We know the minimum, maximum provisioned capacity for a certain table.

For example our minimum capacity is 200 reads per second and maximum is 1000 read per second, so what should be the target utilization percentage ?

like image 248
Aman Aggarwal Avatar asked Apr 25 '18 05:04

Aman Aggarwal


People also ask

What is target utilization in DynamoDB?

Target utilization is the ratio of consumed capacity units to provisioned capacity units, expressed as a percentage. Application Auto Scaling uses its target tracking algorithm to ensure that the provisioned read capacity of ProductCatalog is adjusted as required so that utilization remains at or near 70 percent.

How do you calculate capacity in DynamoDB?

1 read capacity unit (RCU) = 1 strongly consistent read of up to 4 KB/s = 2 eventually consistent reads of up to 4 KB/s per read. 2 RCUs = 1 transactional read request (one read per second) for items up to 4 KB. For reads on items greater than 4 KB, total number of reads required = (total item size / 4 KB) rounded up.

What is consumed capacity in DynamoDB?

One write capacity unit represents one write per second for an item up to 1 KB in size. If you need to write an item that is larger than 1 KB, DynamoDB must consume additional write capacity units. Transactional write requests require 2 write capacity units to perform one write per second for items up to 1 KB.

How is read throughput calculated?

To calculate the average read throughput of each disk, the total number of bytes read is divided by the total read time during the collection interval.


1 Answers

Some background for a complete answer; DynamoDB provides an Autoscaling option for managing throughput capacity. With autoscaling you define a minimum, maximum and target utilization.

DynamoDB Autoscaling will then vary the provisioned throughput between the maximum and mimumum bounds set. It will aim to keep this throughput provision at the utilization capacity.

Target utilization is the ratio of consumed capacity units to provisioned capacity units, expressed as a percentage

A good starting point is to ask why not set target utilization to 100%? This sounds efficient, because you will only be paying for the throughput you use. But there is a problem to this:

DynamoDB auto scaling modifies provisioned throughput settings only when the actual workload stays elevated (or depressed) for a sustained period of several minutes

So, imagine your target utilization is 100% and you have increased demand on your table for 15 minutes. For the first 5 minutes you might be saved by burst capacity, in the second lot of 5 minutes you are likely to see database read/write failures as your throughput is exceeded, and then after around 10 minutes Autoscaling should kick in and increase your throughput.

This is the problem you are trying to avoid by setting target utilization (i.e. an increase in demand causing throttling). You need to consider two things

1) What is the biggest change in throughput capacity usage you see over a time period of 15 minutes expressed as a percentage? Leave this amount of room in your target utilization.

2) How much do you care if you have some database throttling? (i.e. some database read/writes fail?) Adjust your target utilization higher or lower depending on your appetite for cost saving versus throttling.

Lets say you look over one week of data, and find that in a 15 minute period, the largest increase in throughput you see is 20%. That gives you a target utilization of 80% (because then your increased demand is absorbed by autoscaling)*. However lets say you are cautious and you really aren't OK with database throttling, so to be on the safe side, you might go with 70%.

Hope that helps make some decisions. In summary, your target utilization should be a function of how quickly your throughput capacity changes, and how averse you are to throttling.

EDIT:*The maths isn't perfect here, but you get the idea I think. And its probably a close enough approximation.

like image 67
F_SO_K Avatar answered Oct 17 '22 15:10

F_SO_K