Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does DynamoDB throttle request?

In the answer to "How is Amazon DynamoDB throughput calculated and limited?" it's been suggested, that DynamoDB throttles request whenever you exceed provisioned throughput on per second basis. However, this contradicts my experience.

I've table where I post multiple rows, often the number of rows way exceeding provisioned write capacity. This happens in short bursts. At one point I've even got 5 minutes average above provisioned capacity. OTOH, 15 minutes average is below capacity. I haven't got any throttled request in that period.

5 minutes average peaks at 8.053 with provisioned capacity of 6: 5 minutes average

15 minutes average peaks well below provisioned capacity:

enter image description here

So when does DynamoDB throttle requests? What kind of average does it take in account? How high above provisioned capacity can the burst be before it gets throttled?

like image 570
vartec Avatar asked Jun 07 '13 09:06

vartec


People also ask

How do I fix DynamoDB throttling?

If the traffic to a table exceeds the per-table account quotas for throughput, then the table might be throttled. To resolve this issue, use the Service Quotas console to increase the table-level read throughput and write throughput quotas for your account.

How does DynamoDB accelerator work?

DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache for DynamoDB that delivers up to a 10x performance improvement – from milliseconds to microseconds – even at millions of requests per second. DAX is intended for high-performance read applications.

How many requests per second can DynamoDB handle?

DynamoDB can handle more than 10 trillion requests per day and can support peaks of more than 20 million requests per second.

How quickly does DynamoDB scale?

DynamoDB auto scaling actively matched the provisioned capacity to the generated traffic, which meant that we had a workload that was provisioned efficiently. The test's average service-side request latency was 2.89 milliseconds for reads and 4.33 milliseconds for writes.


2 Answers

DynamoDB is designed to ensure that your provisioned capacity is available on a per-second basis. If you provision a table for ten 1kB reads per second then DynamoDB will give you enough capacity to handle that throughput rate. In addition, DynamoDB will sometimes allow you to achieve limited bursting above your provisioned throughput for a short period of time. This is intended to absorb natural variations in customer workloads. This bursting is not guaranteed and it is not always available (and the nature of the available bursting may change over time). As is currently described in the best practices documentation, in order to get the best performance you should have an evenly distributed workload that does not exceed your provisioned capacity and distributes the load evenly over the key space. However, if the reality of production behavior for your application deviates from an evenly distributed workload then DynamoDB may absorb some of the bursts.

As for how much to provision your table, it depends a lot on your workload. You could start with provisioning to something like 80% of your peaks and then adjust your table capacity depending on how many throttles you receive (which you can see in your CloudWatch graphs) and your application’s tolerance for latency induced by retries. Keep in mind that DynamoDB does not allow unlimited bursts above your provisioned capacity. You may be able to absorb short bursts but you cannot sustain a throughput rate above your provisioned capacity level for an extended period of time. The general guidance we can give is to provision for something close to your peaks and then dial down while watching for throttles.

This answer was posted in AWS forums

Disclaimer: I work for Amazon, DynamoDB team.

like image 122
Dan Andreatta Avatar answered Oct 17 '22 02:10

Dan Andreatta


There's a hint in the DynamoDB documentation that explains how bursting works:

When you are not fully utilizing a partition's throughput, DynamoDB retains a portion of your unused capacity for later bursts of throughput usage. DynamoDB currently retains up five minutes (300 seconds) of unused read and write capacity.

But it also says that you cannot rely on this behavior:

However, do not design your application so that it depends on burst capacity being available at all times: DynamoDB can and does use burst capacity for background maintenance and other tasks without prior notice.

At least that would explain why it was possible to have a 5 minute average above the provisioned capacity. With the explanation above, it would even be possible to have 15 minute averages (or longer timespans) to be above the provisioned capacity, if you have a spike in the very beginning of the interval and less usage within the 300 seconds before the start of the interval.

like image 44
Ben Romberg Avatar answered Oct 17 '22 01:10

Ben Romberg