[英]Aws Dynamo db performance is slow
For my application I am using free tier aws account I have given 5 read capacity and 5Write capacity(i can't increase the capacity because they will charge if I increase) to the dynamo db here I am using scan operation.对于我的应用程序,我使用的是免费层 aws 帐户,我已经为 dynamo db 提供了 5 个读取容量和 5 个写入容量(我无法增加容量,因为如果我增加它们会收费),我正在使用扫描操作。 The api is loading in between 10 seconds to 20 seconds.
api 在 10 秒到 20 秒之间加载。
I have used parallel scan too but the api is loading same time.我也使用了并行扫描,但 api 正在加载。 Is there any alternate service in aws.
aws.js 中是否有任何替代服务?
It is not a good idea to use a Scan on a NoSQL database.在 NoSQL 数据库上使用 Scan 不是一个好主意。
DynamoDB is optimize for Query requests. DynamoDB 针对查询请求进行了优化。 The data will come back very quickly, guaranteed (within the allocated Capacity).
数据将很快返回,保证(在分配的容量内)。
However, when using a Scan, the database must read each item from the database and each item consumes a Read Capacity unit .但是,在使用 Scan 时,数据库必须从数据库中读取每个项目,并且每个项目消耗一个读取容量单位。 So, if you have a table with 1000 items, a Query on one item would consume one Unit, whereas a Scan would consume 1000 Units.
因此,如果您有一个包含 1000 个项目的表,则对一个项目的查询将消耗一个单位,而扫描将消耗 1000 个单位。
So, either increase the Capacity Units (and cost) or, best of all, use a Query rather than a Scan.因此,要么增加容量单位(和成本),要么最好使用查询而不是扫描。 Indexes can also help.
索引也可以提供帮助。
You might need to re-think how you store your data if you always need to do a Scan.如果您总是需要进行扫描,您可能需要重新考虑如何存储数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.