gpt4 book ai didi

amazon-dynamodb - DynamoDB 读写

转载 作者:行者123 更新时间:2023-12-01 15:20:29 29 4
gpt4 key购买 nike

什么构成 DynamoDB 中的实际读取?

它是读取表格中的每一行还是返回什么数据?

这就是扫描如此昂贵的原因 - 您读取整个表格并为读取的每一行表格付费吗?

能否将 ElasticCache (Memcached) 放在 DynamoDB 之前以降低成本?

最后,您是否为未产生结果的查询付费?

最佳答案

请参阅此链接:http://aws.amazon.com/dynamodb/faqs/

1 Write = 1Kb 以内的项目每秒写入 1 次。

1 Read = 每秒 2 次读取,对于大小不超过 1Kb 的项目,或者如果您需要完全一致的结果,则每秒 1 次。

For example, if your items are 512 bytes and you need to read 100 items per second from your table, then you need to provision 100 units of Read Capacity.

If your items are larger than 1KB in size, then you should calculate the number of units of Read Capacity and Write Capacity that you need. For example, if your items are 1.5KB and you want to do 100 reads/second, then you would need to provision 100 (read per second) x 2 (1.5KB rounded up to the nearest whole number) = 200 units of Read Capacity.

Note that the required number of units of Read Capacity is determined by the number of items being read per second, not the number of API calls. For example, if you need to read 500 items per second from your table, and if your items are 1KB or less, then you need 500 units of Read Capacity. It doesn’t matter if you do 500 individual GetItem calls or 50 BatchGetItem calls that each return 10 items.

以上内容适用于所有常用方法,GET、BATCH X 和 QUERY。SCAN 有点不同,他们没有记录他们是如何计算使用量的,但他们确实提供了以下内容:

The Scan API will iterate through your entire dataset and apply the filter conditions to every row. Since only 1MB of data can be scanned at a time, you may need to do multiple round trips (using a continuation token) to complete the scan. Further, using this API may consume much of your provisioned read throughput. Hence, this method has limited scaling characteristics and we do not recommend that you use it as a part of your application’s regular behavior.

因此,直接回答您的问题:计算是根据在所有情况下返回的数据进行的,SCAN 除外,在 SCAN 中并没有明确说明它们是如何收费的。没有结果的查询不会花费您任何费用。

你绝对可以在 Dynamo 前面设置一个缓存系统,如果你想减少读取,绝对建议你研究一下。

希望对您有所帮助!

关于amazon-dynamodb - DynamoDB 读写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13998909/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com