Repository navigation
Description
The associated forum post URL from https://forum.rclone.org
What is the problem you are having with rclone?
When I use SFTP plus Crypt, then it does not utilize my upload bandwidth. I have about 35 MBit upload speed, which should result in about 4 MBytes/s transfer.
If I use rsync plus encfs then I get 4 MBytes/s,
If I use rclone SFTP with Crypt, then I get only 2.6 MBytes/s.
If I use rclone SFTP without Crypt, then I get 4 MBytes/s.
CPU usage on my Core i5 is very low, so that is not the issue.
What is your rclone version (output from rclone version)
rclone v1.61.1
- os/version: gentoo 2.9 (64 bit)
- os/kernel: 5.15.88-gentoo-x86_64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.19.4
- go/linking: static
- go/tags: none
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
Linux 64 Bit. Gentoo.
Which cloud storage system are you using? (e.g. Google Drive)
SFTP to Hetzner storage box.
The command you were trying to run (e.g. rclone copy /tmp remote:tmp)
rclone sync localdir hetzner-crypt:/destdir --links --progress --transfers 9 --checkers 9 --check-first --create-empty-src-dirs --log-level ERROR
For testing rsync + encfs vs. rclone SFTP + Crypt, I transferred only one large file with one thread:
time rsync -Whav --progress --delete-after source dest
building file list ...
2 files to consider
backup-test/
backup-test/rpi.img.gz_old
1,60G 100% 3,71MB/s 0:06:51 (xfr#1, to-chk=0/2)
sent 1,60G bytes received 37 bytes 3,88M bytes/sec
total size is 1,60G speedup is 1,00
real 6m52,996s
user 0m5,595s
sys 0m2,648s
time ./rclone sync source dest --links --progress --transfers 1 --checkers 1 --check-first --create-empty-src-dirs
Transferred: 1.493 GiB / 1.493 GiB, 100%, 1.852 MiB/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 9m45.1s
real 9m45,241s
user 0m16,047s
sys 0m6,916s
If I run rclone with for example 4 or 8 transfers on a real directory with mixed file sizes, I am seeing the same issue. Max total transfer rate I get is 2.6 MByte/s but should be up to 4 MByte/s.
Now rclone without Crypt:
time ./rclone sync source hetzner:/home/test/backup-test --links --progress --transfers 1 --checkers 1 --check-first --create-empty-src-dirs
Transferred: 1.492 GiB / 1.492 GiB, 100%, 3.188 MiB/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 6m29.6s
real 6m29,639s
user 0m9,417s
sys 0m4,676s
Although rclone states 3.188 MiB/s as last number, it was near 4 MBytes/s during transfer and the total transfer time is good, too.
A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)
2022/12/22 09:30:14 DEBUG : rclone: Version "v1.61.0" starting with parameters ["./rclone" "sync" "/work2/backup-test" "hetzner-crypt:/backup-test" "--links" "--progress" "--transfers" "1" "--checkers" "1" "--check-first" "--create-empty-src-dirs" "-vv" "--log-file" "rclone.log"]
2022/12/22 09:30:14 DEBUG : Creating backend with remote "/work2/backup-test"
2022/12/22 09:30:14 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2022/12/22 09:30:14 DEBUG : local: detected overridden config - adding "{b6816}" suffix to name
2022/12/22 09:30:14 DEBUG : fs cache: renaming cache item "/work2/backup-test" to be canonical "local{b6816}:/work2/backup-test"
2022/12/22 09:30:14 DEBUG : Creating backend with remote "hetzner-crypt:/backup-test"
2022/12/22 09:30:14 DEBUG : Creating backend with remote "hetzner:rclone/t7sn3p3miij4fskh9s5hdk58og"
2022/12/22 09:30:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: New connection 192.168.0.2:36604->168.119.80.176:23 to "SSH-2.0-OpenSSH_8.8 FreeBSD-20211221"
2022/12/22 09:30:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Shell type "unix" from config
2022/12/22 09:30:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Relative path resolved to "/home/rclone/t7sn3p3miij4fskh9s5hdk58og"
2022/12/22 09:30:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Using root directory "/home/rclone/t7sn3p3miij4fskh9s5hdk58og"
2022/12/22 09:30:15 INFO : Encrypted drive 'hetzner-crypt:/backup-test': Running all checks before starting transfers
2022/12/22 09:30:15 DEBUG : Encrypted drive 'hetzner-crypt:/backup-test': Waiting for checks to finish
2022/12/22 09:30:15 INFO : Encrypted drive 'hetzner-crypt:/backup-test': Checks finished, now starting transfers
2022/12/22 09:30:15 DEBUG : Encrypted drive 'hetzner-crypt:/backup-test': Waiting for transfers to finish
2022/12/22 09:31:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Not closing 1 unused connections as 1 sessions active
2022/12/22 09:32:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Not closing 1 unused connections as 1 sessions active
2022/12/22 09:33:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Not closing 1 unused connections as 1 sessions active
2022/12/22 09:34:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Not closing 1 unused connections as 1 sessions active
2022/12/22 09:35:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Not closing 1 unused connections as 1 sessions active
2022/12/22 09:36:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Not closing 1 unused connections as 1 sessions active
2022/12/22 09:37:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Not closing 1 unused connections as 1 sessions active
2022/12/22 09:38:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Not closing 1 unused connections as 1 sessions active
2022/12/22 09:39:15 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Not closing 1 unused connections as 1 sessions active
2022/12/22 09:39:53 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Shell path "/home/rclone/t7sn3p3miij4fskh9s5hdk58og/9nu7j523t3t4uh4elp5ti9l850"
2022/12/22 09:39:53 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Running remote command: md5 -r /home/rclone/t7sn3p3miij4fskh9s5hdk58og/9nu7j523t3t4uh4elp5ti9l850
2022/12/22 09:39:59 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Remote command result: e64a7d5f2c2642b1e7dc83e74613e97f /home/rclone/t7sn3p3miij4fskh9s5hdk58og/9nu7j523t3t4uh4elp5ti9l850
2022/12/22 09:39:59 DEBUG : 9nu7j523t3t4uh4elp5ti9l850: Parsed hash: e64a7d5f2c2642b1e7dc83e74613e97f
2022/12/22 09:39:59 DEBUG : rpi.img.gz_old: md5 = e64a7d5f2c2642b1e7dc83e74613e97f OK
2022/12/22 09:39:59 INFO : rpi.img.gz_old: Copied (new)
2022/12/22 09:39:59 DEBUG : Waiting for deletions to finish
2022/12/22 09:39:59 INFO :
Transferred: 1.493 GiB / 1.493 GiB, 100%, 1.840 MiB/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 9m44.5s
2022/12/22 09:39:59 DEBUG : 12 go routines active
2022/12/22 09:39:59 DEBUG : sftp://[email protected]:23/rclone/t7sn3p3miij4fskh9s5hdk58og: Closing 1 unused connections
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Activity
ncw commentedon Feb 13, 2023
I can replicate this problem locally with rclone's bandwidth limiter
Whereas
Whatever values I plug in for the bandwidth limiter, or even trying it without the bandwidth limiter I the crypt transfer is about 65% of the speed of the non crypt transfer which is what you are seeing.
I discovered that lowering
--sftp-chunk-sizefrom the default 32k makes things run faster. At 4k it runs at 90% of the speed.I wonder whether this is a bad interaction between the crypt block size of 65568 and the chunk size...
Setting
--sftp-chunk-size 32784b(exactly half the crypt blocksize) puts it to 100% of the speed.I wonder if we are transmitting more data than we need to. This should be easy enough to measure with
If I put the
--sftp-chunk-size 64kthen it runs at 50% of the speed as it is as if it is transmitting two 64k blocks, one which is mostly empty.A bit of work with tcpdump and perl later, I believe we are transmitting twice as much data as we should in this case. For a 100MiB file with
--sftp-chunk-size 64kwe transmit 200.7 MiB of data, but with--sftp-chunk-size 32784b100.7 MiB and with default chunk size 150.8 MiB. Note that 100/150.8 is 66% so the ratio we've been seeing.OK, so that is what is happening. Why is a different question. This may be a bug in the SFTP library or in rclone.
To be continued...
Stop ReadFromWithConcurrency sending more data than it needs to
ncw commentedon Feb 13, 2023
This turned out to be a bug in pkg/sftp which I've sent in a pull request to fix pkg/sftp#537
In the mean time you should find setting
--sftp-chunk-size 32784bis a reasonable work-around.When this gets merged upstream, I'll make a beta for you to try.
sidamos commentedon Feb 13, 2023
Wow, very cool. I can confirm that the workaround helps. I get 4 MBytes/s with it. Thank you!
ncw commentedon Feb 14, 2023
Ok the upstream has merged my fix, and I've pulled it back into rclone.
Can you give this a test please without a
--sftp-chunk-sizeparameter.Thanks
v1.62.0-beta.6731.3d4b4516c.fix-6763-sftp-slow on branch fix-6763-sftp-slow (uploaded in 15-30 mins)
PS Thanks for being persistent about this bug :-)
sidamos commentedon Feb 14, 2023
Yes, I can confirm that the beta is fast without the --sftp-chunk-size parameter. Thank you!
ncw commentedon Feb 14, 2023
Thank you for testing.
I've merged this to master now which means it will be in the latest beta in 15-30 minutes and released in v1.62
sftp: fix uploads being 65% slower than they should be with crypt
sftp: fix uploads being 65% slower than they should be with crypt
sftp: fix uploads being 65% slower than they should be with crypt