Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamoDBContext BatchGet in Parallel #3592

Open
2 tasks
danny-zegel-zocdoc opened this issue Dec 30, 2024 · 3 comments
Open
2 tasks

DynamoDBContext BatchGet in Parallel #3592

danny-zegel-zocdoc opened this issue Dec 30, 2024 · 3 comments
Labels
dynamodb feature-request A feature should be added or improved. p2 This is a standard priority issue queued

Comments

@danny-zegel-zocdoc
Copy link

Describe the feature

Currently DynamoDBContext's BatchGet functionality will chunk requests with more keys than the DDB BatchGet limit into multiple requests which is great but it seems to process them in series. Ideally all the BatchGet chunks would be processed in parallel.

Use Case

Using DynamoDBContext to perform a BatchGet operation with more keys than the DDB BatchGet API allows.

Proposed Solution

When using DynamoDBContext to BatchGet with many keys such that the SDK chunks the request into multiple API calls, invoke those calls in parallel instead of in series.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS .NET SDK and/or Package version used

AWSSDK.DynamoDBv2

Targeted .NET Platform

.NET 8 and up

Operating System and version

N/A

@danny-zegel-zocdoc danny-zegel-zocdoc added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Dec 30, 2024
@ashishdhingra ashishdhingra self-assigned this Dec 31, 2024
@ashishdhingra ashishdhingra added investigating This issue is being investigated and/or work is in progress to resolve the issue. dynamodb p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Dec 31, 2024
@ashishdhingra
Copy link
Contributor

ashishdhingra commented Dec 31, 2024

@danny-zegel-zocdoc Thanks for opening the feature request.

Currently DynamoDBContext's BatchGet functionality will chunk requests with more keys than the DDB BatchGet limit into multiple requests which is great but it seems to process them in series. Ideally all the BatchGet chunks would be processed in parallel.

Could you please elaborate the feature request with example and analysis which demonstrates above existing behavior? Are you using async API as demonstrated here or sync API here? Are you instead proposing to get hold of Task object from each awaited call and then execute Task.WaitAll() to wait for all tasks to complete?

Thanks,
Ashish

@ashishdhingra ashishdhingra added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 31, 2024
@danny-zegel-zocdoc
Copy link
Author

Could you please elaborate the feature request with example and analysis which demonstrates above existing behavior? Are you using async API as demonstrated here or sync API here?

I'm using using the async method, specifically IDynamoDBContext.CreateBatchGet<T>() and then invoking ExecuteAsync() on the resulting BatchGet<T> object.

The async code you linked appears to be the very code that shows the async batches are awaited in the while loop, i.e. in series, and not in parallel.

Are you instead proposing to get hold of Task object from each awaited call and then execute Task.WaitAll() to wait for all tasks to complete?

Yes one way of parallelizing the calls would be to collect the Task objects from each network call instead of awaiting them immediately and then using Task.WaitAll() to await them in parallel.

Thanks for considering this improvement.

@ashishdhingra ashishdhingra removed the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Dec 31, 2024
@ashishdhingra
Copy link
Contributor

Needs review with the team.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jan 1, 2025
@ashishdhingra ashishdhingra removed their assignment Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dynamodb feature-request A feature should be added or improved. p2 This is a standard priority issue queued
Projects
None yet
Development

No branches or pull requests

2 participants