简体   繁体   English

aws dynamo db吞吐量

[英]aws dynamo db throughput

There's something which I cant understand about AWS DynamoDb throughput. 关于AWS DynamoDb吞吐量,我无法理解。

Lets consider strongly consistent reads. 让我们考虑强一致的读取。

Now, I understand that in this case, 1 unit of capacity would mean I can read up to 4KB of per second. 现在,我知道在这种情况下,1个容量单位意味着我可以读取高达每秒4KB的容量。

It's the "per second" bit that slightly confuses me. 这是“每秒”一点让我有点困惑。 If you know exactly how quickly you want to read data then you can set the units appropriately. 如果您确切知道要读取数据的速度,则可以适当地设置单位。 But what if you're not too fussy about the read time? 但是如果你对阅读时间不太挑剔怎么办?

Say I do have only 1 read unit assigned to my table and I try to read an item which is more than 4KB. 假设我只有1个读取单元分配给我的表,我尝试读取超过4KB的项目。 Now surely that just means that my read is going to take more than 1 second? 现在肯定只是意味着我的阅读时间超过1秒? That would be fine but the documentation talks about Requests failing. 那没关系,但文档谈到请求失败。 How can AWS determine that I used too many units when I didn't request that the data be read within a particular time? 当我没有请求在特定时间内读取数据时,AWS如何确定我使用了太多单元?

Maybe I am missing something obvious. 也许我错过了一些明显的东西。 Can you someone help clear this up? 你能帮忙解决这个问题吗?

DynamoDB can consume up to 300 seconds of unused throughput in burst capacity . DynamoDB可以在突发容量中消耗长达300秒的未使用吞吐量。

The maximum item size in DynamoDB is 400KB and 1 RCU gives you a read of up to 4KB. DynamoDB中的最大项目大小为400KB,1 RCU最多可读取4KB。

Lets say you want to read an item that is 400KB in size and you have 1 RCU on your table. 假设您想要读取400KB大小的项目,并且您的桌面上有1个RCU。 You could retrieve that item once every 100 seconds. 您可以每100秒检索一次该项目。

Because of burst capacity there will always be a time you can read that item, because in fact you can use up to 300 RCUs in one go, not just 1. 由于爆破容量,总有一段时间你可以读取该项目,因为事实上你可以一次使用多达300个RCU,而不仅仅是1。

Imagine starting the table with that 400KB item. 想象一下,用400KB的项目启动表。 You need to wait 100 seconds without spending any RCUs so that you've earned enough burst capacity to get the item. 您需要等待100秒而不需要花费任何RCU,这样您就可以获得足够的爆破容量来获取物品。 After 101 seconds you make the request, spend 100 RCUs and get the item. 101秒后,您提出请求,花费100 RCU并获得该项目。 After another 5 seconds you make the request again, but get denied with a Throttling Exception. 再过5秒钟后,您再次发出请求,但拒绝接受限制异常。

So no, DynamoDB will not increase request latency to meet your RCU provision. 所以不,DynamoDB不会增加请求延迟以满足您的RCU规定。 It either returns your results as fast as possible, or throws an exception. 它要么尽可能快地返回结果,要么抛出异常。

EDIT: By the way, I should mention that all AWS DynamoDB SDKs handle Throttling Exceptions for you. 编辑:顺便提一下,我应该提到所有AWS DynamoDB SDK都会为您处理限制异常。 If you try and read an item, but get denied because you don't have enough throughput available, the SDK backs off and try again. 如果您尝试读取某个项目但由于没有足够的可用吞吐量而被拒绝,则SDK会退出并重试。 So unless your table really is under provisioned, you shouldn't have to worry about handling Throttling Exceptions. 因此,除非您的表真的不在配置状态,否则您不必担心处理限制异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM