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
Slow SFTP transfer rate since 0.12.1 #4209
Comments
Judging from the release notes of
The description of UseConcurrentWrites sounds like it should be safe to use, as we completely retry the upload if there is an error while writing a file. Anyone up for a PR? |
I've given the following changes a try, but it doesn't have any impact on transfer speed.
|
@DeadWalkingDeath I'd spell it
but yes, that should be it. UseConcurrentWrites actually only takes effect when using ReadFrom instead of Write, but it looks like the restic SFTP backend is already doing that... |
does this maybe help?
create test.sh with this content
remove host, user and pass to use localhost and maybe change the 7 to the seconds that works on your system
I tried this in a docker container and it seems that after this version writes are slower. |
have also a look at pkg/sftp#426 where the commit is also mentioned. |
Any workaround for this? Restic is taking x10 longer than borgbackup for me, right now |
I'm now using the REST server as backend, which is performing well. |
To improve speed, I switched to using rclone with an SFTP backend. I felt it gave me greater control over the options and felt more optimized. |
Hi, I was diagnosing my slow backup speeds even though I have 10g network and transfer is from local nvme to nas with ssds.
=> default should be 5, which I interpret as 5 ssh connections to the target server, which usually show up as separate process I only see 1 ssh connection on target. Is this what this bug is about and what MaxConcurrentRequestsPerFile will probably fix?
at the time of writing, I'm using latest restic 0.16.3. (I'm asking this directly which may sound stupid because the wording in "MaxConcurrentRequestsPerFile" makes it sound like multiple concurrent transfers to the same file but what is actually needed is multiple sftp connections to multiple files) |
The names here are somewhat misleading. With SFTP files are requested in 32KB chunks, which is why multiple concurrent requests have to happen for a file to ensure a decent performance. The issue here is likely related to that. |
thanks for clearing that up @MichaelEischer |
There's now #4782 that fixes the upload performance. Please give it a try. |
I tried to do before and after comparisons (0.16.4 and 0.16.4+patch) but somehow my performance was already adequate without the patch on vanilla 0.16.4. (around 250 MB/s ssd to ssd over 10gbe with read-concurrency 10, sftp-connections 10, Gentoo Linux). Different to what I witnessed some months ago. I need to test some more and better structure the tests, just quickly compiled it in and looked at network graph. I hope somebody else can test the MR too. |
The performance problems in this issue only show up when connecting to a remote server. In a LAN setting there was never much of a problem.
This a different question from that discussed in this issue and therefore my PR doesn't change anything in that regard. |
I've tested this patch on my side, that change nothing on a single file of 1GB. File transfer is very slow |
@yverry Can you provide a few more details on your test setup? What does "very slow" mean? How fast are you able to upload to that server using for example |
scp on qnap is slow, that is not new for me. I stuck at 20Mb/s I need more time to test with 0.12.0 because it's not compatible with version 2 format |
@yverry What exactly did you test? Which command, etc.? What is the output of |
I'm pretty sure that my bugfix PR fixes the issue introduced in restic 0.12.1; at least it did during my tests. If you still see very slow uploads/download please open a separate issue. |
Hi, My test was to upload a single file of 512MB via sftp. your version, just compiled: ./restic-patch version
restic 0.16.4-dev (compiled manually) compiled with go1.22.2 on linux/amd64 the backup command: time ./restic-patch backup -r sftp:restic@myserver:path --tag slowsftp ./512M -v
open repository
repository 09103b42 opened (version 2, compression level auto)
no parent snapshot found, will read all files
load index files
[0:01] 100.00% 82 / 82 index files loaded
start scan on [512M]
start backup on [512M]
scan finished in 1.141s: 1 files, 512.000 MiB
Files: 1 new, 0 changed, 0 unmodified
Dirs: 3 new, 0 changed, 0 unmodified
Data Blobs: 350 new
Tree Blobs: 4 new
Added to the repository: 512.024 MiB (512.065 MiB stored)
processed 1 files, 512.000 MiB in 8:00
snapshot de831b42 saved
real 8m2.470s
user 1m12.533s
sys 0m7.744s A classical sftp of this one file upload went well (35sec). time ./restic-patch backup -r =s3:https://mys3/mysuperbucket ./512M --tag slowsftp
repository 42 opened (version 2, compression level auto)
no parent snapshot found, will read all files
[0:01] 100.00% 8 / 8 index files loaded
Files: 1 new, 0 changed, 0 unmodified
Dirs: 3 new, 0 changed, 0 unmodified
Added to the repository: 512.024 MiB (512.054 MiB stored)
processed 1 files, 512.000 MiB in 0:31
snapshot 4242 saved
real 0m32.507s
user 1m17.382s
sys 0m5.115s So I switched to S3 without understanding where the bottleneck was. |
I'm trying to use restic to backup ~3TB of data to another system using SFTP over a gigabit network connection.
I've set RESTIC_REPOSITORY and RESTIC_PASSWORT environment variables and used the following commands:
restic init
restic backup /mnt/disk
When I tried the latest release (0.15.1), I immediately noticed the slow transfer speed of around 10 MB/s. The cpu load was 60% idle most of the time.
First I tried a lot of different options:
None of these parameters did change anything.
Next I tried an older version from the Debian repository (0.11.0).
Just using this version caused my cpu to get maxed out and I reached about 60-70 MB/s transfer rate.
Then I tried every release from 0.11.0 to 0.15.1 and starting with 0.12.1 every version afterwards shows this issue.
I guess it must have something to do with a change that happened in 0.12.1.
It does only happen with SFTP repositories. A backup to a local repository is not affected.
I've also tried to init the repository with 0.12.0 (repository format version 1) and then doing the backup with the latest release. Also slow transfer.
Any ideas?
The text was updated successfully, but these errors were encountered: