[systemd-devel] How to schedule a resource consuming service

Andrei Borzenkov arvidjaar at gmail.com
Sat Feb 2 14:35:45 UTC 2019


02.02.2019 16:50, Fabrice Salvaire пишет:
> Dear all,
> 
> In Fedora mlocate (updatedb) service is setup like this
> 
> --------------------------------------------------------------------------
> 
>> cat /usr/lib/systemd/system/mlocate-updatedb.service
> [Unit]
> Description=Update a database for mlocate
> 
> [Service]
> ExecStart=/usr/libexec/mlocate-run-updatedb
> Nice=19
> IOSchedulingClass=2
> IOSchedulingPriority=7
> 
> PrivateTmp=true
> PrivateDevices=true
> PrivateNetwork=true
> ProtectSystem=true
> 
> --------------------------------------------------------------------------
> 
>> cat /usr/lib/systemd/system/mlocate-updatedb.timer
> [Unit]
> Description=Updates mlocate database every day
> 
> [Timer]
> OnCalendar=daily
> AccuracySec=24h
> Persistent=true
> 
> [Install]
> WantedBy=timers.target
> --------------------------------------------------------------------------
> 
> Unfortunately it saturates the IO after the boot when the machine was
> not running at midnight (not sure ???), see
> https://bugzilla.redhat.com/show_bug.cgi?id=1282232
> 

Similar problem was discussed for openSUSE as well (similar in the sense
that Persistent=true results in serious impact during boot). Some way to
delay Persistent=true would be nice indeed.

> This is painful when we want to use the machine asap, for a quite full
> 500 GB disk, it hangs during several minutes.  I encountered an unusable
> machine during more than 10 min due to mlocate and/or gnome indexer
> saturating IO and package cache update saturating a low ADSL connexion.
> 
> I noticed IOSchedulingClass=2 could be set to "idle", maybe it would
> improve.
> 
> I also read
> https://www.freedesktop.org/software/systemd/man/systemd.timer.html but
> I don't understand if there is a way to prevent to run the service
> during 1h after boot.
> 
> Well a way to run theses services during idle time.
> 

Define "idle time" ...


More information about the systemd-devel mailing list