Repository navigation
perf(remotefs): send Windows file writes in 4 MiB rigrcp commands - #482
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The test factory incorrectly captures the parent test context and must use the subtest context.
Review effort: Balanced
Findings: None
What changed in this PR
Improves Windows remote upload performance and memory usage by batching writes into 4 MiB rigrcp commands.
Changes:
- Splits large writes into bounded commands.
- Buffers
CopyFromoperations in 4 MiB batches. - Adds batching and error-handling tests.
| File | Review |
|---|---|
remotefs/winfs_test.go |
Adds coverage, but source factories must receive the subtest’s t to avoid invalid parent FailNow calls. |
remotefs/winfile.go |
Implements bounded writes and buffered copying. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
kke
force-pushed
the
perf/rigrcp-write-chunks
branch
from
September 24, 2026 10:02
0a4104a to
097d369
Compare
Uploads to Windows hosts went through winFile.CopyFrom, which used io.Copy. Upload wraps its source in an io.TeeReader, which hides any io.WriterTo, so io.Copy fell back to its 32 KiB buffer and every 32 KiB became a w command of its own: a reply to wait for before the payload, and since #480, a completion reply after it too. A 100 MiB upload made about 3,200 of those exchanges. CopyFrom now fills 4 MiB at a time, which brings that down to about 25. It does so for every source, including an *os.File, whose own WriteTo would also write 32 KiB at a time. WriteFile had the opposite problem. bytes.Reader implements io.WriterTo, so its whole payload arrived in one Write and went out as a single w. The helper reads a command's whole payload into memory before writing it, and parses its length as a PowerShell [int]. So WriteFile held the entire file in the helper's memory and failed above 2 GiB. Write now splits a larger payload into commands of at most 4 MiB. The idle timeout is unaffected. It is still measured per 32 KiB piece of payload handed to the pipe, not per command, so a larger command does not raise the transfer rate a slow link has to sustain. Refs #475 Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
kke
force-pushed
the
perf/rigrcp-write-chunks
branch
from
September 24, 2026 10:12
097d369 to
f14bc32
Compare
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.

Uploads to Windows hosts went through winFile.CopyFrom, which used io.Copy. Upload wraps its source in an io.TeeReader, which hides any io.WriterTo, so io.Copy fell back to its 32 KiB buffer and every 32 KiB became a w command of its own: a reply to wait for before the payload, and since #480, a completion reply after it too. A 100 MiB upload made about 3,200 of those exchanges. CopyFrom now fills 4 MiB at a time, which brings that down to about 25. It does so for every source, including an *os.File, whose own WriteTo would also write 32 KiB at a time.
WriteFile had the opposite problem. bytes.Reader implements io.WriterTo, so its whole payload arrived in one Write and went out as a single w. The helper reads a command's whole payload into memory before writing it, and parses its length as a PowerShell [int]. So WriteFile held the entire file in the helper's memory and failed above 2 GiB. Write now splits a larger payload into commands of at most 4 MiB.
The idle timeout is unaffected. It is still measured per 32 KiB piece of payload handed to the pipe, not per command, so a larger command does not raise the transfer rate a slow link has to sustain.
Refs #475