Feature Proposal: Smart/Adaptative Resource Usage

Keep in mind, if you edit a systemd file you must sudo systemctl daemon-reload and then restart the service before changes take effect.

systemctl status <service> will list start-up errors.

1 Like

mmm I can find in my Systemd

systemd/user-preset/90-syncthing.preset
systemd/user/syncthing.service
systemd/system/syncthing@.service
systemd/system/syncthing-resume.service

I am not sure which one is used, but neither the /user not the @ version change the Nice paramter in Fedora 31.

The syncthing@.service will dynamically run as the user’s account. Changing this will affect all users. To start/stop/restart you’ll need to refer to it as syncthing@<username>.service, e.g. syncthing@rvalle.service.

Chances are you’re using this unit file but to verify:

systemctl status --lines 1 syncthing *

systemctl cat syncthing@pi will print all relevant files. Ideally you don’t edit any existing service file, but create drop-in files in /etc/systemd/system/syncthing@.d/ (e.g. nice.conf). Thus if Syncthing ships any update to the service file, that update will take effect while your additions/changes stay in effect too (otherwise your copied service file shadows the updated service file).

2 Likes

Thanks for that tip!

1 Like

But it’s not everyone, it’s just Syncthing that could/would do this.

Its also worth mentioning that syncthing is both CPU and disk-heavy. Setting just niceness/priority is ineffective on its own to make sure other applications aren’t resource-starved.

Second issue is that, just like the OOM-killer[1][0], niceness on Linux is notoriously useless. Software has to be a bit smarter than those things in order to preserve a good desktop experience. Linux now has pressure stall monitoring (PSI), a background service absolutely could be instructed to pause itself or reduce load when it gets too high, that’s the whole point of that feature.

This discussion is uncannily similar to discussing the OOM-killer uselessness a few years ago. 99% of the responses were negative, "configure better, “RTFM”, “it’s your setup”, “it’s {vendor}”, etc. etc. I’m glad Linux has gotten somewhat past that, but Syncthing should too.

I think you fundamentally missed the point I was trying to make. What makes Syncthing different from every other program in the world?

It doesn’t matter, that’s my point you missed.

Nobody seems to have pointed out to the op what seems to me to be the incredibly bleeding obvious.

He is forced to stop work! Really? What is wrong is that he enables syncing of unwanted videos on his phone to device(s) without the capacity to store lots of junk.

Either he could arrange his phone so that only wanted videos are synced, or, he gets more storage to accommodate the junk until it can be cleaned up at a more convenient time, or he could be more selective about what he shoots.

A little effort is needed at some stage. It might be better not to create the mess rather than have to clear it up later.

OK, I’m not as helpful or considerate as the rest of the posters on this forum, but I don’t see syncthing as a rubbish collector.

I am interested in your point here, what is it?

That since everyone else doesn’t do this we probably shouldn’t either, unless someone can explain why we are the unique exception. Alternatively, if we agree that it would be bad if everyone did it, why should we be a bad actor and do it anyway.

I just wanted to add some information regarding process priorities in Windows.

Not many people know this, but Task Scheduler by default starts processes with a priority of 7, which means

7	BELOW_NORMAL_PRIORITY_CLASS	THREAD_PRIORITY_BELOW_NORMAL

following the documentation under https://docs.microsoft.com/windows/win32/taskschd/tasksettings-priority.

This priority can be changed only by modifying the task’s XML file, i.e. exporting, editing, and then re-importing. There is no way to do it directly from the GUI.

However, what is extremely important here, is that this priority does not apply to CPU only. It sets both CPU, I/O, and RAM priorities for the started process. For example, if I start syncthing.exe from Task Scheduler with a priority of 9, then the spawned process will have:

  • CPU priority of “Idle”
  • I/O priority of “Very low”
  • RAM priority of “Very low”

This is very different than doing start /low syncthing.exe from the command line, because the latter only sets CPU priority, but does not set I/O and RAM priorities, which in some circumstances, e.g. folders located on a slow spinning HDD or a computer with insufficient RAM, may be more important.

1 Like

I know this is an old thread, but I would like to provide some additional context.

My performance problems kept getting worse until I started to suspect something wrong with my system. Memory leaks kept growing to the point that I had to restart my laptop daily.

I tried to identify the root cause but I did not manage. I did not find threads of other Fedora 31 users that experienced similar issues. In the end I decided to switch to Ubuntu 20.04, since the performance problems have stopped.

Of course, now my view on this issue is completely different now.

It is true that during the time in which my system was degraded Syncthing was more demanding than Synology drive, and probably there is scope for improvement in this regard, but I guess there are also many other things in Syncthing that can also be implemented that this may have little priority.