添加了在DynamoDB中使用batchWriteItem而不是PutItem的延迟延迟?
我有一个应用程序,该应用程序定期将每个请求插入一个项目中。不过,我们时不时地期望看到插入多个项目,在这种情况下,我想利用batchWriteItem
操作而不是putitem
。
我想知道的是,如果我对所有请求使用batchwriteItem
,这是否会导致延迟的增加,而不是使用putitem
对单个/几个项目(s)案件?
I have an app that, on a regular basis, inserts a single item per request into DynamoDb. Every now and then though, we could expect to see multiple items inserted, in which case I would like to utilize the BatchWriteItem
action instead of PutItem
.
What I am wondering is, if I use BatchWriteItem
for all requests, will that result in an increase in latency as opposed to using PutItem
for the single/few item(s) case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
batchWriteItem
的物理请求是的非常非常小的大于单个putitem
或deleteitem
请求请求。然后,这可能会导致A 非常非常小的增加了延迟测量值,因为需要在网络上运输更多数据,但我会说这是非常可忽略的。
也就是说,尽管使用
batchWriteItem
为每个请求都不会对您的应用程序产生真正的影响,但我希望在审查代码时为正确的情况进行正确的SDK方法/API调用。我建议至少要为单个项目添加条件检查并使用
putitem
。如果项目计数超过2,则可以使用batchWriteItem
。The physical request for a
BatchWriteItem
is by a very, very small amount larger than a singlePutItem
orDeleteItem
request.This may then result in a very, very small increased latency measurement as more data needs to be transported over the network, but I would say that this would be extremely negligible.
That said, while using
BatchWriteItem
for every request will have no real impact on your application, I would expect the right SDK methods/API calls are made for the right situation when reviewing code.I would advise to, at the very least, add a conditional check and use
PutItem
for single items. If the count of items are more than 2, you can useBatchWriteItem
.