-
Notifications
You must be signed in to change notification settings - Fork 380
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
Stop ReadFromWithConcurrency sending more data than it needs to #537
Conversation
It was discovered that the ReadFrom method for uploading files in pkg/sftp was sending more data than it needed to. This was tracked down to the ReadFromWithConcurrency method forgetting to truncate the packets it was sending to the size Read. This was giving the remote server more work to do as it was writing and re-writing parts of a file. See: rclone/rclone#6763
Thanks! |
Huh… good catch! |
Thanks for merging :-) On a philosophical point - the current implementation directly couples the block size read from the
From https://pkg.go.dev/io#Reader :
Since SFTP isn't latency sensitive, I'd suggest reading from the What do you think? Happy to send a PR if you like the idea. |
The block size for crypt is 64k + a few bytes. The default block size for sftp is 32k. This means that the blocks for crypt get split over 3 sftp packets two of 32k and one of a few bytes. However due to a bug in pkg/sftp it was sending 32k instead of just a few bytes, leading to the 65% slowdown. This was fixed in the upstream library. This bug probably affected transfers from over the network sources also. Fixes #6763 See: pkg/sftp#537
The block size for crypt is 64k + a few bytes. The default block size for sftp is 32k. This means that the blocks for crypt get split over 3 sftp packets two of 32k and one of a few bytes. However due to a bug in pkg/sftp it was sending 32k instead of just a few bytes, leading to the 65% slowdown. This was fixed in the upstream library. This bug probably affected transfers from over the network sources also. Fixes #6763 See: pkg/sftp#537
Yeah, I was thinking of this as an alternative to the code here, basically, use |
The block size for crypt is 64k + a few bytes. The default block size for sftp is 32k. This means that the blocks for crypt get split over 3 sftp packets two of 32k and one of a few bytes. However due to a bug in pkg/sftp it was sending 32k instead of just a few bytes, leading to the 65% slowdown. This was fixed in the upstream library. This bug probably affected transfers from over the network sources also. Fixes rclone#6763 See: pkg/sftp#537
It was discovered that the ReadFrom method for uploading files in
pkg/sftp was sending more data than it needed to.
This was tracked down to the ReadFromWithConcurrency method forgetting
to truncate the packets it was sending to the size Read.
This was giving the remote server more work to do as it was writing
and re-writing parts of a file.
See: rclone/rclone#6763