5

I use the integrated backup service of Ubuntu 16.04/Unity provided by deja dup/duplicity. Whenever a backup is performed, my system becomes very slow (annoying but still usable) due to the complex diffing/compressing/encryption mechanism used.

Is there a way to set a nice value for the processes that are started by Unity (deja dup/duplicity/gpg)? Or is there another way to improve responsiveness of the system while a backup is performed?

Simon Warta
  • 217
  • 1
  • 11
  • I could answer the question you are asking, but I'm not convinced that CPU usage is the source of your problem. It's more likely that your system is suffering from high IOWAIT. – Elder Geek Feb 08 '17 at 21:29
  • I am not sure about that. My system is running at 50-90 % load on a modern 4 core system reading from SSD and writing to an external USB3 HDD. But I may be missing details. However, I am going to play around with nice and ionice parameters as soon as I know how to set those. – Simon Warta Feb 08 '17 at 21:43

2 Answers2

6

Edit /etc/xdg/autostart/deja-dup-monitor.desktop and prepend settings to the Exec value, e.g.

before: Exec=/usr/lib/x86_64-linux-gnu/deja-dup/deja-dup-monitor
after:  Exec=/usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /usr/lib/x86_64-linux-gnu/deja-dup/deja-dup-monitor

The nice value is set to deja-dup-monitor and all the processes it spawns (deja-dup/duplicity/gpg).

Changing these values improved responsiveness of my system dramatically, even if the overall load is still between 30 and 90 % (all cores summed up) during a backup.

Note: this does not work when you hit the "Backup now" button in the Ubuntu system settings.

Simon Warta
  • 217
  • 1
  • 11
3

Don't launch via Unity. Launch via the CLI of course you'll have to review the manual in order to duplicate the settings you are using in the GUI.

nice -19 Preceeding your duplicity command line will launch the process with a nice value of 19 (which is as nice as it gets) Or alternately find the processes in top and renice them there.

If and when this fails to provide the results you are looking for we will have to consider an alternative.

setup a cron job to or use scheduled tasks as noted here to run your backup when you are sleeping to avoid impacting the performance of your session when you are using the system. After all computers were invented to do work for us so that we can occupy ourselves with other things (like sleeping)

Or wait for the developers to fulfill this item on the wish list.

There doesn't appear to be a script that launches Dejadup instead there's apparently something called deja-dup-monitor that launches when you log into your session. Unfortunately the dconf settings used by dejadup don't include any niceness whatsoever. As much as I know this isn't the answer you want, I have to conclude that it's correct.

Note: My tests at this moment on a lowly Intel I3 backing up to a USB2 drive didn't seem to experience the lag you are experiencing. I know that in many cases an Intel Dual Core will outperform an AMD quad core. Perhaps this is why you feel that your system is laggy while backing up or the problem could also be related to IOWAIT. You might find the output from System Load Indicator contained in the indicator-multiload package Will help you determine whether you are pinning your processors capabilities or experiencing High IOwait percentages. It's easily installable though the Software Center and rides on the top menu bar where you can see at a glance what is going on with your system. See below:

cpu-or-iowait

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • But I like the unity integration. I can configure everything nicely and it starts the backup as soon I attach the laptop to the the docking station with the external backup drive. I don't link using a cron as this will almost never match the situation when I am ready to backup.

    Btw, when I sleep, my machine sleeps as well. Sadly, not the entire industry is able to integrate hardware and software like Apple, so I am still using this 1990th boot and shutdown thing.

    – Simon Warta Feb 08 '17 at 22:07
  • Sometimes we need to adjust in order to obtain the results we want. – Elder Geek Feb 08 '17 at 22:11
  • Or find the damn script that unity uses to start a backup – Simon Warta Feb 08 '17 at 22:12
  • Or wait for a wish to be granted. – Elder Geek Feb 08 '17 at 22:45
  • Thanks for the hint to indicator-multiload. The i/o load is between 2 and 4 %. The CPU is an Intel i5-5300U. The highest load I get when an incremental backup is prepared, not during a simple copy step. The "whish" you mentioned is entirely unrelated to the question as I do not want to care for other scheduling than what deja-dup-monitor does. – Simon Warta Feb 10 '17 at 22:50
  • @SimonWarta Glad to help! To clarify the wish mentioned is for more detailed scheduling and is on the DejaDup developers wish list, so actually it is related. (at least to what deja-dup-monitor might do in the future) I/O waits between 2 and 4 percent are certainly acceptable and a round robin pinning of a single core at 100% isn't really a concern. On a 4 core system such as yours a single core at 100% only equates to a cpu load of about 25% Which is certainly acceptable. I think you'd be better served by determining what else your system is doing when you experience the lagging you mention. – Elder Geek Feb 10 '17 at 23:07