Repository navigation
Stream ByteStream uploads segment by segment; closes #1565 - #1566
Open
vlad-ivanov-name wants to merge 1 commit into
Open
vlad-ivanov-name wants to merge 1 commit into
vlad-ivanov-name wants to merge 1 commit into
Conversation
Contributor
|
This pull request has been imported. If you are a Meta employee, you can view this in D124990313. (Because this pull request was imported automatically, there will not be any future comments.) |
vlad-ivanov-name
marked this pull request as ready for review
October 13, 2026 15:18
What: - upload_impl builds WriteRequest segments lazily from the reader and passes the stream to ByteStream.Write. - A read error during the stream ends it without finish_write and fails the upload. - The committed_size check also accepts the full blob size, which a server returns when it already has the blob. - After the RPC returned, the segment stream ends on its next poll, because the transport can still drive it. Why: - The whole blob was collected into a Vec<WriteRequest> before the first byte was sent, so a large upload used as much memory as the blob.
vlad-ivanov-name
force-pushed
the
vlad/lazy-bytestream-upload
branch
from
October 14, 2026 07:50
99b09ec to
498e3e7
Compare
Contributor
Author
|
Updated code -- not sure if previous failure was a fluke but internal tests pass now |
This was referenced Oct 14, 2026
This branch has not been deployed
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
upload_implbuildsWriteRequestsegments lazily from the reader and passes the stream toByteStream.Write. Segments are stillmax_total_batch_sizebytes, withfinish_writeon the last data segment, so the wire shape does not change.finish_writeand fails the upload.committed_sizecheck also accepts the full blob size. The REAPI text says a server that already has the blob answers early with the full size regardless of how much data the client sent. This worked before only because the whole blob was always read first.Why
The whole blob was collected into a
Vec<WriteRequest>before the first byte was sent, so a large upload used as much memory as the blob. Now at most two segments are in memory.Notes
BoxStreampassed to tonic'swritedirectly fails with "implementation ofSendis not general enough" at theupload_implcall, also with the closure parameter annotated. A small newtype that forwardspoll_nextavoids it.Closes #1565