简体   繁体   English

从多个 dynamodb 表中获取项目的好方法(低延迟)?

[英]good way (with low latency) to get items from multiple dynamodb tables?

I have several dynamodb tables, table A, table B, table C and table D.我有几个 dynamodb 表,表 A,表 B,表 C 和表 D。

I want to get item A from table A, item B from table B, item C from table C and item D from table D.我想从表 A 中获取项目 A,从表 B 中获取项目 B,从表 C 中获取项目 C,从表 D 中获取项目 D。

Currently I make 4 dynamodb getItem calls to 4 tables to get the items sequentially.目前我对 4 个表进行 4 次 dynamodb getItem 调用以按顺序获取项目。 Each call cost ~12 millisecond, total ~50 millisecond.每次通话花费约 12 毫秒,总计约 50 毫秒。

ItemA a = tableA.getItem("A");
ItemB b = tableB.getItem("B");
ItemC c = tableC.getItem("C");
ItemD d = tableD.getItem("D");

Is there a better way to make the calls to reduce latency?有没有更好的方法来减少延迟? Not sure how i can make it parallel here.不知道我怎样才能让它在这里平行。

If the requests, as in your example, are not dependent on one another - in other words, you don't need to know the result of the first request to send the second, you don't need to do them sequentially (one after another) - you can start all four in parallel.如果请求(如您的示例所示)彼此不依赖 - 换句话说,您无需知道第一个请求的结果即可发送第二个请求,则无需按顺序执行(一个之后)另一个)-您可以同时启动所有四个。

How to start four requests in parallel depends on the specific programming you are using, but you have an even easier option: Send just one BatchGetItem request - with the four requests in it.如何并行启动四个请求取决于您使用的特定编程,但您有一个更简单的选择:只发送一个BatchGetItem请求 - 其中包含四个请求。 DynamoDB will do all these requests in parallel for you. DynamoDB 将为您并行处理所有这些请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Dynamodb - 是否可以按属性对多个项目进行排序? - Dynamodb - Is it possible to get multiple items sorted by an attirbute? KCL 不 PUT 或 GET 和来自 DynamoDB 检查点的项目或锁定表 - KCL doesn't PUT or GET and items from DynamoDB checkpoint or locks tables aws Dynamodb 通过 aws 管理控制台中的分区键获取多个项目 - aws Dynamodb get multiple items by partition key in aws management console 从 EC2 实例查询 DynamoDB 时遇到高延迟 - Experiencing high latency when querying DynamoDB from an EC2 instance 有没有办法在 DynamoDB 中检索没有属性的所有项目? - Is there a way to retrieve all items without an attribute in DynamoDB? 在 DynamoDB 中获取最近 15 分钟的所有项目 - Get all items of the last 15 minutes in DynamoDB AWS DynamoDB 如何使用不带范围键的 CreateMultiTableBatchGet 从多个表中检索数据 - AWS DynamoDB how to retrieve data from multiple tables using CreateMultiTableBatchGet without Range Key 如何一次更新 DynamoDB 表中的多个项目 - How to update multiple items in a DynamoDB table at once 使用 .NET 将多个项目插入 DynamoDB 表 - insert multiple items into DynamoDB table using .NET 在 GET 请求中使用多个参数从 DynamoDB 获取数据 - Getting data from DynamoDB using multiple parameters in GET Request
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM