-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use Cats backpressure to throttle writes (and conversions to HTTP requests) #1000
base: master
Are you sure you want to change the base?
Use Cats backpressure to throttle writes (and conversions to HTTP requests) #1000
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1000 +/- ##
=======================================
Coverage 83.33% 83.33%
=======================================
Files 47 47
Lines 3156 3156
Branches 452 455 +3
=======================================
Hits 2630 2630
Misses 526 526
|
.unsafeRunSync() | ||
Backpressure[IO](Backpressure.Strategy.Lossless, maxOutstandingRawInsertRequests) | ||
.flatMap { backpressure => | ||
rows.grouped(batchSize).toVector.parTraverse_ { batch: Seq[Row] => |
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.
compared to _.grouped.toSeq.grouped.foreach
it will now create a vector of all batches, they will reference all Row items from iterator which potentially could be not a lot of mem, less than request bodies, more than constant mem
but compared to .grouped.toVector
it is about the same apart from having semaphore
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.
doesn't look like there's a out-of-the box Seq.parTraverse_, or even better the one that would not take more items when semaphore is full, so for now we can try the .toVector.parTraverse_
No description provided.