3

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

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

这就是为什么扫描如此昂贵的原因吗?您读取了整个表格并为读取的每个表格行收费?

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

最后,您是否需要为没有结果的查询付费?

4

1 回答 1

2

See this link: http://aws.amazon.com/dynamodb/faqs/

1 Write = 1 Write per second for an item up to 1Kb in size.

1 Read = 2 Reads per second for an item up to 1Kb in size, or 1 per second if you required fully consistent results.

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.

The above applies to all the usual methods, GET, BATCH X & QUERY. SCAN is a little different, they don't document exactly how they calculate the usage but they do offer the following:

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.

So to answer your question directly: The calculation is made on what data is returned in all cases except for SCAN, where there isn't really any clear indication on how they charge. A query that yields no results will not cost you anything.

You can definitely set up a caching system infront of Dynamo, definitely recommend you look into that if you want to keep your reads down.

Hope that helps!

于 2012-12-22T20:54:19.510 回答