another request by me
I have noticed that using syncthing on arm devices, especially the development boards DietPi supports, can easily boost the cpu usage to 100% for long periods of time, when rescans of the shared folders take place.
I have read that syncthing-inotify sensibly reduces cpu usage by allowing longer times between rescans, simply by notifying the system of the files that have changed, instead of having it fully rescan the directories.
Could this be added to DietPi? I think it would make our boards more responsive.
Unfortunately though, I don’t seem to be able to make it autostart or run as a service.
The syncthing-inotify project gives two scripts (one to run as users and one as system), and I have tried both without success. They make syncthing-inotify start but it does not work (and rescans of the directories happen as usual).
I have also tried adding it to /etc/rc.local but it happens the same.
BTW, here are the two scripts provided by the project… If anyone more capable than me could make them work I would be extremely grateful:
Run as system service: /etc/systemd/system/syncthing-inotify@.service
I can notice a drastic decrease in CPU usage, as the system won’t scan every shared directory every few minutes, but only checks and syncs those files that get changed.
It would be nice if I could get it to work as a service, though.
I have been discussing this issue with the guys from syncthing, as running syncthing-inotify from the crontab is not working properly.
There seems to be a problem with how syncthing is run in DietPi. Specifically, they are saying that the service file provided by DietPi is not correct and that this is causing the issue with syncthing-inotify.
This is what came out regarding the syncthing.service script in DietPi:
This file is plain wrong:
It starts syncthing is root; there is no possibility to overwrite it.
It uses some bash Foo in order to create a logfile
The type is oneshot (i guess because of the bash foo?)
I don’t understand much about these things, but I think that our development boards would benefit a lot from the introduction of syncthing-inotify on DietPi, therefore I am calling out to Fourdee again for this to be introduced or at least fixed in order for us to install syncthing-inotify successfully. Thanks!
Yes, syncthing uses a lot of cpu during the rescan of the shared directories.
This would be avoided by switching from full rescans to partial ones by adopting the syncthing-inotify way.
The main problem seems to be that syncthing runs as root in DietPi, and this creates some kind of incompatibility with the syncthing-inotify.service script.
On the syncthing support forum they suggest to install syncthing manually on DietPi and avoid using the provided syncthing.service script, but I guess this defeats the purpose of having the logs kept in the ramdisk to avoid the frequent writes of the SD card…
Thanks John for sharing your experience. I have not time to try right now, but please check that syncthing-inotify correctly signals syncthing about file changes.
You can easily do that by modifying one file on the machine with syncthing-inotify, and checking that the other machines receive the modified file immediately (while the “last rescan” time remains the same).
I’m saying this because during my tests, syncthing-inotify was correctly showing in the process list, but it didn’t actually do its job properly.
The purpose of syncthing-inotify is to set a long rescan interval (let’s say an hour, for example) to avoid the system to be constantly rescanning the shared folders in search of changed files. Between two rescans syncthing-inotify works by “detecting” file changes and syncing those files almost immediately.
If you modify a file and it’s not being immediately “spread” to the other nodes in the syncthing network, then syncthing-inotify isn’t working properly.