FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

chore: update ChunkSegmenter to optionally allow a limit on the number of bytes it should consume by BenWhitehead · Pull Request #3279 · googleapis/java-storage · GitHub

chore: update ChunkSegmenter to optionally allow a limit on the number of bytes it should consume - #3279

Merged
BenWhitehead merged 2 commits into
mainfrom
appendable/02/chunk-limit
Sep 9, 2025
Merged

chore: update ChunkSegmenter to optionally allow a limit on the number of bytes it should consume#3279
BenWhitehead merged 2 commits into
mainfrom
appendable/02/chunk-limit

Conversation

Copy link
Copy Markdown
Collaborator

"Child" change after #3278

Update BidiAppendableUnbufferedWritableByteChannel to only attempt to consume as many bytes as are available according to the stream -- this prevents over packing of segments we will for sure never be able to use.

With both this PR and the contents of #3278 our latency now looks like the following, where the v2.56.0 line represents the workload running using version 2.56.0 and v2.56.1+bw.2025_09_04_1715 represents the same workload bu using a version build from this PR.

BenWhitehead requested a review from a team September 4, 2025 21:33
product-auto-label Bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/java-storage API. labels Sep 4, 2025
BrandonY previously approved these changes Sep 4, 2025
long overallRemaining = totalRemaining - consumedSoFar;
if (overallRemaining < blockSize && currentBlockPending == blockSize) {
break;
break outerloop;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

ooo, label break, those're rare!

}
if (numBytesConsumable <= 0) {
continue;
break outerloop;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

K...now I'm starting to worry a bit about cyclomatic complexity

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Prior to the appendable upload stuff we generally had a pretty firm bulkhead on the number of buffers that would be passed into these methods outside of tests. With the appendable addition we place less emphasis on early buffering in favor of passing things through wherever possible, so if multiple buffers are passed in here, logically the conditions would prevent consuming any bytes once a break from the while takes place, but by breaking the for as well we avoid the cycles performing work that isn't productive.

And, refactoring everything to nested method calls to allow early returns instead of break to label didn't seem worth it to me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What's the follow up here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nothing from my perspective. There isn't a functional difference here between the label break and a separate method with early returns.

…r of bytes it should consume

Update BidiAppendableUnbufferedWritableByteChannel to only attempt to consume as many bytes as are available according to the stream -- this prevents over packing of segments we will for sure never be able to use.
BenWhitehead force-pushed the appendable/02/chunk-limit branch from 0bbbc42 to e07f2a4 Compare September 5, 2025 17:30
BenWhitehead merged commit 23584da into main Sep 9, 2025
25 checks passed
BenWhitehead deleted the appendable/02/chunk-limit branch September 9, 2025 17:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL