-
Notifications
You must be signed in to change notification settings - Fork 88
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
feat(v2): parallel batch processing #1620
Conversation
💾 Artifacts Size Report
|
cf625e4
to
789b91b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Some feedback inline
...c/main/java/software/amazon/lambda/powertools/batch/handler/DynamoDbBatchMessageHandler.java
Show resolved
Hide resolved
...c/main/java/software/amazon/lambda/powertools/batch/handler/DynamoDbBatchMessageHandler.java
Outdated
Show resolved
Hide resolved
.../java/software/amazon/lambda/powertools/batch/handler/KinesisStreamsBatchMessageHandler.java
Outdated
Show resolved
Hide resolved
...ch/src/main/java/software/amazon/lambda/powertools/batch/handler/SqsBatchMessageHandler.java
Outdated
Show resolved
Hide resolved
...ch/src/main/java/software/amazon/lambda/powertools/batch/handler/SqsBatchMessageHandler.java
Show resolved
Hide resolved
...ch/src/main/java/software/amazon/lambda/powertools/batch/handler/SqsBatchMessageHandler.java
Show resolved
Hide resolved
...ols-batch/src/main/java/software/amazon/lambda/powertools/batch/internal/MultiThreadMDC.java
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
Hi folks, I'm quite happy to see you're working on this. I know my team would love such ability. I have not read the PR yet, but thought I'd leave a couple of comments to consider - if you haven't already. In some of our Lambda functions, where we use powertools (more specifically logging, tracing), we do leverage concurrency to speedup our lambda requests. Depending on the use case, this concurrency is achieved using (1) AWS SDK async clients (which return Completable futures) (2) Other types of clients that might have their thread pools (3) Explicit executor services (and sometimes virtual threads from Java 21). The core challenges we tend to see are in logging/tracing
I kinda feel, this change, is likely the first time that powertools is handling concurrency. I wonder, if as part of that, or as follow ups, challenges with concurrency when it comes to tracing/logging can maybe be looked at, to see if there's any level of help powertools can provide. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v2 #1620 +/- ##
=============================================
- Coverage 89.79% 76.08% -13.71%
- Complexity 406 426 +20
=============================================
Files 44 40 -4
Lines 1274 1560 +286
Branches 165 240 +75
=============================================
+ Hits 1144 1187 +43
- Misses 88 288 +200
- Partials 42 85 +43 ☔ View full report in Codecov by Sentry. |
Hey @humanzz ! Sorry for the slow reply; it's been busy over here. I think the broader issue of "things that need to propagate information across thread boundaries don't work well" is something we may well be positioned to help with - certainly with logging and tracing at least. I have opened #1670 to track this. |
@jeromevdl how about we merge this without the fix for x-ray and handle that on another PR? Given the x-ray and log correlation is likely going to be a bigger thing, and we are talking about a SNAPSHOT here, I think the downside of merging this into v2 is low - some x-ray traces won't correlate well on a preview release - and it will let us deal with the bigger issue asynchronously rather than scope-creeping this PR. |
I agree, let's review like it is today and create a new issue for the multithread support |
See #1671 |
@jeromevdl i'll review this tomorrow morning |
...batch/src/main/java/software/amazon/lambda/powertools/batch/handler/BatchMessageHandler.java
Show resolved
Hide resolved
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤝
Issue #, if available: #1540
Description of changes:
batch module can now process items in parallel rather than in sequence. Introduction of a new method
processBatchInParallel
inBatchMessageHandler
. Works with SQS, Kinesis, DDB Streams but not SQS FIFO (does not make sense).Checklist
Breaking change checklist
RFC issue #:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.