I’m using Syncthing to sync my home directory between 2 Linux servers, both running Ubuntu. I use a remote desktop (KDE over VNC) sometimes on one or the other of these servers (never both at the same time).
Whenever I’m using the remote desktop, using normal desktop programs like Firefox, Thunderbird, KDE Dolphin etc, CPU usage is extremely high. It’s at about 100% of both CPU’s on the remote Linux server (a VPS), and at least 50% of each of the 4 CPUs on the other machine (refer screenshot). The high CPU usage lasts for several minutes after I close all programs on the remote desktop.
I’ve changed fsWatcherDelayS from the default of 10 secs to 180 secs, but this hasn’t helped. I ran syncthing with STTRACE=scanner syncthing. Looking in the output of this I only saw a small number of file paths it had to walk, for example over a ~3 minute period it found less than 30 file paths, most of which looked like Firefox files (Firefox was running at the time).
Check the recent change log, I suspect you are syncing some database which causes other devices to bombard you with requests for the constantly changing files.
In the end I disabled the inotify (watching for changes) and just set it to scan every 3 mins. This seems to reduce CPU usage so it takes 100% of one CPU (instead of both) for only about 30 secs every 3 mins. Not ideal, but it’s a balance between syncing changes often and actually being able to use the computer
Nothing like that came up in the ‘recent changes’, apart from the usual Firefox files. But even if I didn’t run Firefox or Thunderbird (which both use sqlite DBs) and just browsing around with Dolphin the high CPU usage seemed to come up.
Do I need to specifically exclude the Syncthing index (.config/syncthing/index-v0.14.0.db/) from the sync? Would it make sense even to delete these indexes and let syncthing create them again, assuming they’ve somehow grown too big or got corrupt or something?
You should not sync Syncthing index/config, I guess this is what is constantly triggering the file watcher. I wouldn’t sync FF and TB folders either. Better to use addons or IMAP server for that.
This will be the culprit.
With Io fswatcher on the ST database changing will rigger a rescan of the ST database which then states the new index and causes a rescan.
Even without fswatcher on you shouldn’t share the active ST folder.
No luck, I just checked my stignore file and /.config/syncthing was already in there.
Is there a way to reset that index/databases? On the assumption that somehow it’s become too big or corrupt (I’ve been running home-folder syncthing between these 2 machines since March 2017).
There is -reset-database command line switch but you should make sure devices are in sync. I am also very skeptical that that this will fix it. I am pretty sure you have something that changes constantly.
I suspect Audrius is correct. Perhaps you could try syncing the /home/Documents folder and it’s siblings individually and then pausing some of them to narrow down where your constantly changing files might be?