Very slow transfer

Why transfer speed is so slow ? I get an average of 5 MB/s on a gigabit connection. The same behavior using freefilesync from an external Windows machine runs at 70~100 MB/s. I know this is not the only thread to talk about this subject. But my situation is quite far away of all I have read in all threads.

I did configure syncthing on 2 Synology NASes (amd64), both on the same LAN in gigabit. Both NASes handle full speed transfers on SMB is up to 110 MB/s, with an average of far above 50 MB/s in SMB. Most files are some big video files of 1GB or more each, with a total of 10TB. Syncthing is configured for 1-way syncing (RO -> RW).

I’ve checked all what was suggested in other threads, and other points:

  • CPU - < 10% on each NAS
  • RAM - < 20% on each NAS (src: 1/8G, dst: 1/4G)
  • load - < 2 on the source (4 cores), ~4 on the destination (4 cores) - the destination has higher I/O idle (SMB brings the load up to 8, with very good transfer speed)
  • scanning / hashing - not related - hashing was finished more than 2 weeks ago
  • crypting / hashing because of slow CPUs - not related, both can handle much more than 5 MB/s ** source: Single thread SHA256 performance is 99 MB/s using minio/sha256-simd (73 MB/s using crypto/sha256) ** destination: Single thread SHA256 performance is 76 MB/s using minio/sha256-simd (64 MB/s using crypto/sha256)
  • disk bandwidth - not related, the worst this RAID-5 can handle is over 100 MB/s
  • LAN issues - on the same LAN and SMB transfers have an average of 10x faster (on big files)
  • network latency - < 1ms between machines
  • network load - around nothing, except syncthing
  • STTRACE=model/all - nothing relevant
  • GUI open / closed in a browser - absolutely no difference (stuck around 5MB/s)
  • syncthing version - both are up to date (0.14.20)

At this point, I’m copying the files manually. Even with scanning, it will be 10x faster than letting syncthing do the job by itself. Except the fact I like the concept syncthing (and I use it for other cases, but with few files), it is quite unusable for syncing a multimedia library.

Any idea ?

Try increasing the number of pullers to something like 128 in advanced config for the given folder, on the receiving side.

Thanks for your answer. I did try. 150 GB in 9 hours => avg 4.6 MB/s. It seems to be tightly better, but really not impressive.

I suspect Syncthing will always perform poorly on network storage as the overhead and latency for the small writes that we do will be the bottleneck, I suspect thats where your IO wait is comming from and is potentially the cause.

If I read his text correctly, he installed Syncthing on the NAS itself. So not really network storage from Syncthings point of view. And his NASes don’t seem to have calculator CPUs either (AMD64).

1 Like

It’s not unreasonable, probably to large extent due to the block randomization.

Syncthing doesn’t do sequential writes, they are all random writes. RAID-5 is especially bad at this. In RAID-5, each write becomes a data read, a parity read, a data write and a parity write. There is also some CPU overheard, and although the NAS CPU’s aren’t “calculator grade” they are still fairly slow by computer standards - “SHA256 performance is 76 MB/s”.

4.6 MB/s is about 4.6 * 1024 / 128 = 36.8 blocks/s. That then expands into about 150 IOPS due to RAID-5. If those disks are slow spinning drives like WD Green (common in NASes), expect something like 50 IOPS per drive.

If that’s a three drive RAID-5 it’s maxed out at 3*50 = 150 IOPS and we are exactly where we expect. This is with the generous assumption that the fs and RAID layer can actually handle each 128 KiB block as one operation, which may absolutely not be the case. There is also overhead due to fs metadata and so on. All in all, I’m not surprised. Spinning disks suck, RAID-5 sucks, the combination is quite horrible for random writes unfortunately. :slight_smile:

Measuring random write performance on the NAS, and checking iostat on it while sync is happening, would confirm.

5 Likes

Thanks for this point of view, even if I’m not sure to understand it correctly.

FYI, the destination NAS is a Synology 1513+ with a RAID-5 (SHR) of 5 WD RED 4TB. BTW, it is formatted in BTRFS.

I’ve made to kind of tests with iostat, giving 3 results each:

  • global stat (the first one returned by iostat)
  • syncthing only
  • syncthing + file copy over SMB

But I’m not sure to understand what IOPS we are talking about, Disks are shown with a maximum of ~45 w/s, while md2 show ~900 w/s. 5*45 = 225, so why 900 on md2 ? Is it a cache effect ?

Do those results talk to you ?

iostat -dm 60
Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn   <-- global stat
sdb              78.24         3.46         1.45     384330     161038
sdc              78.95         3.46         1.45     384082     161406
sdd              78.04         3.46         1.45     384081     161013
sde              77.99         3.46         1.45     384136     160996
sda              80.17         3.47         1.45     385527     161458
md0               1.18         0.02         0.00       1888        170
md1               0.00         0.00         0.00          1          0
md2             499.68        16.09         5.64    1784998     626201
dm-0            499.68        16.09         5.64    1784997     626201
sdiv              0.01         0.00         0.00          1          0

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn   <-- syncthing only
sdb              45.62         0.78         0.83         47         49
sdc              44.45         0.77         0.83         46         49
sdd              44.92         0.76         0.83         45         49
sde              47.05         0.78         0.83         46         49
sda              45.52         0.80         0.82         47         49
md0               3.65         0.02         0.01          1          0
md1               0.00         0.00         0.00          0          0
md2             230.85         3.61         3.22        216        193
dm-0            230.85         3.61         3.22        216        193
sdiv              0.00         0.00         0.00          0          0

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn   <-- syncthing + copy over SMB
sdb              90.68         1.78        15.51        106        930
sdc              89.90         1.79        15.50        107        929
sdd              90.45         1.80        15.50        108        929
sde              90.55         1.81        15.51        108        930
sda              92.42         1.81        15.51        108        930
md0               3.18         0.01         0.01          0          0
md1               0.00         0.00         0.00          0          0
md2            1212.26         8.00        61.84        480       3711
dm-0           1212.26         8.00        61.84        480       3711
sdiv              0.00         0.00         0.00          0          0

iostat -dxm 60 (second round)
Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util   <-- global stat
sdb              80.35   362.72   61.46   16.74     3.46     1.48   129.24     1.21   15.45   13.86   21.30   5.50  43.03
sdc              80.39   362.70   61.31   17.60     3.45     1.48   128.11     1.26   15.91   14.25   21.71   5.67  44.71
sdd              80.31   362.65   61.24   16.76     3.45     1.48   129.52     1.19   15.24   13.65   21.04   5.47  42.63
sde              80.34   362.71   61.30   16.66     3.46     1.48   129.60     1.26   16.09   14.33   22.55   5.55  43.26
sda              80.55   362.83   62.54   17.59     3.47     1.48   126.51     1.29   16.00   14.45   21.51   5.72  45.82
md0               0.00     0.00    0.96    0.23     0.02     0.00    31.93     0.02   20.05   15.54   38.96   7.12   0.85
md1               0.00     0.00    0.00    0.00     0.00     0.00     7.94     0.00   14.17   14.14   16.50   1.07   0.00
md2               0.00     0.00  398.09  102.71    16.06     5.75    89.18    12.70   25.48   12.12   77.29   1.79  89.52
dm-0              0.00     0.00  398.09  102.71    16.06     5.75    89.18    12.77   25.49   12.13   77.30   1.79  89.81
sdiv              0.01     0.00    0.01    0.00     0.00     0.00     2.80     0.00    1.10    1.01    2.73   0.94   0.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util   <-- syncthing only
sdb              44.45   138.25   57.43    5.97     3.53     0.56   132.17     0.79   12.51   11.49   22.35   7.11  45.08
sdc              43.80   138.47   58.17    6.48     3.53     0.56   129.84     0.81   12.48   11.62   20.18   7.11  45.94
sdd              42.40   138.43   58.15    6.15     3.53     0.56   130.47     0.84   13.07   11.97   23.46   7.18  46.20
sde              42.75   137.62   58.42    5.85     3.53     0.56   130.18     0.82   12.79   11.96   21.12   7.23  46.48
sda              42.40   138.00   58.27    6.33     3.53     0.56   129.60     0.82   12.76   12.14   18.54   7.22  46.64
md0               0.00     0.00    1.38    2.13     0.02     0.01    19.00     0.07   23.95   17.35   28.23   8.14   2.86
md1               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
md2               0.00     0.00  414.60   37.45    17.27     2.16    88.04     7.58   16.85   11.09   80.64   2.19  98.87
dm-0              0.00     0.00  414.60   37.45    17.27     2.16    88.04     7.62   16.86   11.10   80.65   2.19  98.89
sdiv              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00

Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util   <-- syncthing + copy over SMB 
sdb              48.90  3463.92   46.30   45.90     2.63    13.68   362.16     2.21   23.83   15.66   32.06   6.68  61.60
sdc              47.98  3463.65   46.95   45.93     2.63    13.68   359.58     2.60   27.89   17.09   38.93   6.98  64.85
sdd              51.87  3464.25   47.43   45.33     2.65    13.68   360.45     2.42   25.98   16.61   35.78   7.01  65.01
sde              52.10  3464.22   46.85   45.27     2.63    13.68   362.56     2.62   28.30   17.95   39.02   6.89  63.47
sda              51.00  3464.28   48.22   46.12     2.64    13.68   354.41     2.77   29.22   18.02   40.94   7.12  67.15
md0               0.00     0.00    1.43    2.13     0.03     0.01    22.80     0.11   36.15   19.58   47.28   9.67   3.45
md1               0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00
md2               0.00     0.00  305.03  887.68    12.45    54.76   115.41    93.02   78.24   14.91  100.00   0.83  99.50
dm-0              0.00     0.00  305.03  887.70    12.45    54.76   115.41    93.41   78.24   14.92  100.00   0.83  99.54
sdiv              0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00

The most important point in those is the last column of the last two tables - “%util”. It indicates how much of the time the disk (or array) in question is busy servicing a request. For the individual disks in the syncthing only case it’s about 45%. That’s ok, the disks seem to have more to give. But checking the line for md2 it’s at 99% - the RAID array is maxed out. I’m guessing the “lost” performance between that is in waiting. Given that RAID5 needs to both read and write both old data and parity for each write, there will be some time where we’ve done one disk but not yet the the other.

The “IOPS” I’m talking about - I/O operations per second - is what you see in the r/s and w/s columns. The disks are each servicing about 58 + 6 requests, which is consistent with what we expect they should be able to do, being a little bit better than my WD Green guess.

Why so much reading and comparatively little writing? Not sure, maybe this is in the copy phase of syncing?

Now I understand better.

Regarding the reads, I cannot tell. I cannot install atop on the NAS, which could give me better details. But I’ve tried with htop and sort by disk reads. The only read consumer is syncthing, with an average of 2~10 MB/s.

I did connect to the GUI (climed to 900r/s - 50 MB/s), and the status is clearly “syncing” (only one share, no scan running). After closing the GUI, syncthing still consumes the value above (2~10 MB/s - ~150 r/s).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.