Scanning slow on MacOS

Can you try toggling this setting via advanced settings: caseSensitiveFS — Syncthing v1 documentation

This does lead to dangers of file loss if the file exists in multiple different cases on a case sensitive system, but just curious to see if this helps in any way.

Sorry I can’t see any clues in there, just that it seems to be a really small sample? Hope somebody with better Go knowledge can make sense of the numbers.

If you scan a similar sized folder that is on the internal SSD, how’s the performance then?

Thank you Audrius, this improved the situation so from ~160KiB/s I am at ~1MiB/s. But I do not plan to use something what is not safe so I am back at the option disabled. I did couple of tests on the HDD storage and on dedicated SSD (usb c), both using case insensitive apfs. 1GB on the volume - unable to measure as it completes almost instantly. 10GB on the volume - ~5MiB/s on HDD storage and ~160MiB/s on SSD. 20GB on the volume - ~200KiB/s on HDD storage and ~150MiB/s on SSD. 300GB on the volume - ~160KiB/s on HDD storage and ~50MiB/s on SSD. I do not have enough disk space to test it on internal SSD but I assume the external SSD provides similar results. All the volumes are excluded for Spotlight and the Spotlight is disabled on my system (so no indexing of the files is happening).

I’m not a mac user, but is there something like iotop/iostat to check io wait?

There is actually another command which can show the process itself and what happens with the read/write etc.

sudo fs_usage syncthing

which in my case has an output like:

16:32:36.098645  write             F=32   B=0x1000                                                                                                                                                                            0.000008   syncthing.1030685
16:32:36.098658  write             F=32   B=0xc97                                                                                                                                                                             0.000007   syncthing.1030685
16:32:36.098667  read              F=32 [ 35]                                                                                                                                                                                 0.000001   syncthing.1030685
16:32:36.138932    THROTTLED                                                                                                                                                                                                  0.715509   syncthing.1030732
16:32:36.138933  read              F=25   B=0x8000                                                                                                                                                                            0.872152   syncthing.1030732
16:32:36.224242    THROTTLED                                                                                                                                                                                                  0.794747   syncthing.1030714

Any THROTTLED as far as I know means that the MacOS is throttling resource heavy processes for idle applications. Why the Syncthing is considered as an idle application I have no clue, the developers can probably answer and fix this.

How to temporary fix it?

Prior folder scan you can run:

sudo sysctl debug.lowpri_throttle_enabled=0

To enable the throttling again you run:

sudo sysctl debug.lowpri_throttle_enabled=1

You can as well run

sudo sh -c 'echo debug.lowpri_throttle-enabled=0 >> /etc/sysctl.conf'

to disable the throttling on your system completely (no clue what will be the long term impact).

With disabled throttling the scanning performance is in my case ~270MiB/s (the value 8 for Hashers seems to be good for my storage).

Thank you very much everyone for your help!

Cool. Now we can also deal with broken powersaving “features” on non-Android platforms, too. Yeah! /s

A more serious take on this issue: what is the priority of the Syncthing process on your system?

The priority of the process is the default coming from the package (no idea how to check).

Syncthing lowers priority be default; there’s a setting to disable it too (Advanced → Options → Set Low Priority). It doesn’t usually have this drastic of an effect though, so still not sure what’s going on with this system. Perhaps it’s heavily loaded in some way so the OS things it needs to throttle everything nonessential?

I tried to enable the Set Low Priority option but it had no effect on the performance. During the time I reported the behaviour I had running messages, mail, terminal (mc), Chrome and Signal so nothing CPU/IO intensive (90%+ CPU idle). Any energy saving is turned off on the system.

You have to disable it, as its enabled by default.

Sorry for confusion, I disabled it, but no impact on performance.

Just to exclude one more possile aspect: Did you restart Syncthing after toggline said setting? It does not take effect immediately.

Yes. I rather restart after each change as I do not know when the settings are applied.

1 Like

How do you start/install Syncthing on the Mac? Any chance that some wrapper/task-manager/… is setting any funky flags (I have no idea about macos, thus the very non-specific questions :slight_smile: ).

This behavior seems to be purely I/O related and is tied to what kind of storage is used(SSD vs HDD) from what a quick Google search revealed.

I installed the package from the official distribution

Well, the Syncthing application is for whatever reason sleeping the majority of the time. The I/O is not the issue here, even if I run Syncthing as a single application (no other applications running, nothing in the tray) the performance is in KiB/s while the storage provides xxxMiB/s. Disabling throttling is resolving the issue so the I/O is definitely not an issue. Why the macOS thinks that Syncthing should be throttled I have no clue.

1 Like

Searching for that flag, this seems to be a common problem e.g. also for time-machine:, Speed Up Time machines First back up - Apple Community

I don’t think we can do anything on Syncthing’s side (the flag change requires root) - maybe worth adding a FAQ about this.

To be clear: The OS seems to throttle I/O operations only for processes with low priority and not in general.

So your storage might be able to provide a lot more performance but Syncthing or other low priority processes are artificially limited.

Maybe we should rethink the low process priority default for Mac in order to avoid this?

1 Like