Optimising Syncthing for low end hardware

First of all, I know that many topics have been created to discuss the question of running Syncthing on low end / slow / old devices, and I have done my part to search and study them. The problem is that the vast majority were support related, and are thus locked now, with no further discussion possible. Nevertheless, I apologise if I ask questions or raise subjects that have already been discussed to death.

I have Syncthing installed on a few older devices. The slowest of them has the following specifications.

CPU: 1.0 GHz Cortex-A8 single-core ARMv7
RAM: 512 MB (~380 MB usable)

As you can see, while not the slowest on Earth, it is slow enough to cause problems when running Syncthing with a lot of data.

What I have tried doing so far is the following.

  • progressUpdateIntervalS = -1
  • copiers = 1
  • hashers = 1
  • scanProgressIntervalS = -1
  • weakHashThresholdPct = 101
  • maxFolderConcurrency = 1
  • STNORESTART=1
  • GOGC=50 or GOGC=25

Most of the aforementioned settings were suggested in MIPS performance by @calmh. I am personally unsure about GOGC, as I am worried that it may kill the already struggling CPU for the sake of RAM. Also, I guess that options like hashers = 1 need not be explicitly set on my device, since Syncthing will use them as defaults on a single-core CPU anyway.

In addition to those, I have personally found that disabling UI animations and a few other cosmetics helps greatly. Of course, this applies only when opening and using the Web GUI on the actual device. It also helps when operating the GUI on a remote device, but this is a different story, not really related to the hardware.

I personally add these to my theme.css. They disable all the animations, transitions, rounded borders, and shadows, while not breaking anything at the same time.

*,
:before,
:after {
	animation-delay: 0s !important;
	animation-timing-function: step-start !important;
	transition-delay: 0s !important;
	transition-timing-function: step-start !important;

	border-radius: 0 !important;
	box-shadow: none !important;
}

All in all, my question is whether there is anything else that could be done to improve Syncthing performance or reduce its load when operating on low end devices. Also, if you have experience using Syncthing on such hardware, please share it :slightly_smiling_face:.

2 Likes

Nowadays there are also buffer settings that may be relevant, especially if there are multiple devices and/or folders involved.

  • maxConcurrentIncomingRequestKiB (maybe reduce to 32 MiB or so from the default of 256 MiB, avoids being overwhelmed by many clients asking for data)
  • pullerMaxPendingKiB (maybe reduce to 16 MiB from the default (IIRC) of 32 MiB, avoids allocating too much when pulling data)

Also, keep in mind those buffer sizes are not the limit on what will be allocated; they are the limit on the amount of data being processed at any given time. That data will be copied, hashed, compressed, etc, before garbage collection so the real memory usage will be a multiple of the buffer size.

Additionally, thereā€™s the GOMEMLIMIT env var nowadays which is probably more effective than GOGC. Set GOMEMLIMIT=256MiB for example if you want the runtime to try hard to not use more than 256 MiB of memory. This wonā€™t do magic ā€“ if Syncthing needs more, it will use more, but it will make the garbage collector at least try to stay within that limit. Thereā€™s further reading for the diligent student.

I made a PR on a page to keep this information, feel free to contribute with experiences and corrections:

I didnā€™t mention it in the original post either, but what do you think about GOMAXPROCS? Setting it to 1 on very low end hardware makes things simple, as then you donā€™t need to touch copiers, hashers, maxFolderConcurrency, etc., because the allowed CPU number is already just ā€œ1ā€.

Possibly, but even a Pi has four or so cores, and then weā€™re limiting us to a fraction of the already not plentiful CPU performanceā€¦ It could be a good thing if a secondary goal is to make sure it can run a bunch of other things concurrently and to limit Syncthing to 25% of the CPU cores. I added it to the tuning page!