添加了在DynamoDB中使用batchWriteItem而不是PutItem的延迟延迟?

发布于 2025-02-01 18:37:05 字数 232 浏览 1 评论 0原文

我有一个应用程序,该应用程序定期将每个请求插入一个项目中。不过,我们时不时地期望看到插入多个项目,在这种情况下,我想利用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

許願樹丅啲祈禱 2025-02-08 18:37:05

batchWriteItem的物理请求是的非常非常小的大于单个putitemdeleteitem请求请求。

然后,这可能会导致A 非常非常小的增加了延迟测量值,因为需要在网络上运输更多数据,但我会说这是非常可忽略的。

也就是说,尽管使用batchWriteItem为每个请求都不会对您的应用程序产生真正的影响,但我希望在审查代码时为正确的情况进行正确的SDK方法/API调用。

我建议至少要为单个项目添加条件检查并使用putitem。如果项目计数超过2,则可以使用batchWriteItem

The physical request for a BatchWriteItem is by a very, very small amount larger than a single PutItem or DeleteItem 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 use BatchWriteItem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文