Ubuntu

updatedb cron job should make use of ionice

Reported by Timmie on 2007-08-25
24
Affects Status Importance Assigned to Milestone
findutils (Ubuntu)
Low
Kees Cook
slocate (Ubuntu)
Low
Kees Cook

Bug Description

Binary package hint: cron

Updatedb is invocted every day by cron.

When it is started it is not possible to work on other things like use Firefox with many tabs or write a letter in Openoffice since updatedb runs on a very high priority!

Please change the default cron script that it goes more like this:

ionice -c 2 -n 7 nice -n 19 updatedb

Thant would make the computer still usable while the service runs!!!

Daniel Hahler (blueyed) wrote :

Yes, I think it's a good idea to use "ionice", if it's present.

Apart from that, wouldn't "ionice -c 3" make more sense (3 being "idle" class)?

Changed in cron:
status: New → Confirmed
Timmie (timmie) wrote :

I changed the
/etc/cron.daily/slocate like follows:

#! /bin/sh
IONICE_CLASS=3 #2= Best effort 1 = Idle , 3 = idle
IONICE_PRIORITY=7 #0 (high)-7 (low)
NICE_PRIORITY=19 #10 (default) - 19 (low)

if [ -x /usr/bin/slocate ]
then
 if [ -f /etc/updatedb.conf ]
 then
  ionice -c $IONICE_CLASS nice -n $NICE_PRIORITY /usr/bin/updatedb
 else
  ionice -c $IONICE_CLASS nice -n $NICE_PRIORITY /usr/bin/updatedb -f proc
 fi
 chown root.slocate /var/lib/slocate/slocate.db
fi

Tomorrow I can report whether this helps or not...

Daniel Hahler (blueyed) wrote :

Based on your patch I've written a proper debdiff.

Daniel Hahler (blueyed) wrote :

The same method should get applied to "slocate", which e.g. gets installed by kubuntu-desktop (and which replaces the "find" cronjob of findutils).
I will provide a debdiff for it, when the one for findutils gets accepted.

Changed in slocate:
assignee: nobody → blueyed
Daniel Hahler (blueyed) on 2007-09-11
Changed in slocate:
assignee: blueyed → nobody
Daniel Holbach (dholbach) wrote :

Kees: can you take a look at the patches?

Daniel and Tim: it'd be nice to feed those patches back to Debian, so we can have the packages in sync soon again.

Changed in slocate:
assignee: nobody → keescook
Anders Morken (amorken) wrote :

This is a dupe of bug #13671 (although it seems that someone has marked that bug as a dupe of this one, although this bug is the newer one. =)

Anyway, we tried this approach there, and the consensus seemed to be that there was little or no measurable effect of using ionice with updatedb... Does anyone have any numbers that indicate that this has changed?

Daniel Holbach (dholbach) wrote :

Marking as 'incomplete' until question is answered.

Changed in findutils:
status: Confirmed → Incomplete
Changed in slocate:
status: New → Incomplete
Daniel Holbach (dholbach) wrote :

Unsubscribing Ubuntu Sponsors for main from this bug until questions are answered.

Daniel Hahler (blueyed) wrote :

I've updated the patch for findutils, making IONICE_CLASS=2 (and IONICE_PRIORITY=7) the default - because 3 is only allowed by root (and for a reason).

Daniel Hahler (blueyed) wrote :

Updated debdiff for slocate.

Peter Cherriman (pjcherriman) wrote :

I added the following patch to my slocate on my edgy system.
I also used class 2 and priority 7.

It has made my system much better behaved, so much so
that I no longer notice what slocate is started 15mins or so after I
boot up (it doesn't run 24/7)

diff -u -r1.1 slocate
--- slocate 2007/08/02 18:12:30 1.1
+++ slocate 2007/08/02 18:35:08
@@ -1,4 +1,5 @@
 #! /bin/sh
+ionice -c2 -n7 -p$$

 if [ -x /usr/bin/slocate ]
 then

Kees Cook (kees) wrote :

Thanks, I will get this taken care of after beta unfreezes.

Changed in slocate:
status: Incomplete → Triaged
Changed in findutils:
assignee: nobody → keescook
importance: Undecided → Low
status: Incomplete → Triaged
Changed in slocate:
importance: Undecided → Low
Kees Cook (kees) wrote :

I think the patches can be cleaned up a bit for fewer changes:

- ionice is in util-linux (so no need for schedutils)
- util-linux is Essential (no need to test for ionice existing)

Daniel Hahler (blueyed) wrote :

Thanks for your comments, Kees.

Now while updating the patches, I wonder if we should support IONICE_CLASS=0 to disable usage of ionice?
Or should it get used always?

Kees Cook (kees) wrote :

Is there any harm in using ionice? (Or rather, is there a good reason to ever disable it?)

Daniel Hahler (blueyed) wrote :
Daniel Hahler (blueyed) wrote :
Daniel Hahler (blueyed) wrote :

slocate (3.1-1ubuntu2) gutsy; urgency=low

  * debian/cron.daily: Use ionice. It looks for settings from
    /etc/updatedb.conf and uses "best effort" class by default.
    Quite the same for "nice", defaulting to "10".
    (LP: #134692)

 -- dAniel hAhler <email address hidden> Wed, 26 Sep 2007 02:31:46 +0200

Changed in slocate:
status: Triaged → Fix Released
Daniel Hahler (blueyed) wrote :

findutils (4.2.31-1ubuntu1) gutsy; urgency=low

  * Make use of ionice in cron.daily, if available (LP: #134692)
  * debian/updatedb.conf: added IONICE_CLASS/IONICE_PRIORITY,
    defaulting to IONICE_CLASS=2, IONICE_PRIORITY=7 (best effort)
  * debian/find-crond.daily: use ionice
  * debian/control: DebianMaintainerField

 -- dAniel hAhler <email address hidden> Tue, 02 Oct 2007 01:52:46 +0200

Changed in findutils:
status: Triaged → Fix Released
Timmie (timmie) wrote :

Thank you dAniel hAhler for putting so much effort into this!

Just recently that my notbook got literally blocked by this deamon. It has to stop!
Imagine you working on something critical and the system all by a sdden get irrespnsive because of this!

yop (yop) wrote :

@dAniel hAhler
Question: If running at nice -10 it will have a high priority yes? and running at nice 10 will make it have a low prio

And in your diff you have
nice -n {$NICE:-10}

Is it not better to set it to
nice -n {$NICE:+10}
to make it run as low prio?

Daniel Hahler (blueyed) wrote :

yop, please note that {$NICE:-10} (which I've used in most places in my patches) is actually a typo/wrong!
${NICE:-10} is correct (and Kees has fixed it already).

"echo ${FOO:-10}" results in 10, if $FOO is not set, if you want to get "-10" as default, you would actually have to use ${FOO:--10}. The ":-" appears to be the syntax for "default".

So, this seems to be fine - except for the typo.. ;)

ah ok thanks.

On Nov 13, 2007 1:01 AM, dAniel hAhler <email address hidden> wrote:

> yop, please note that {$NICE:-10} (which I've used in most places in my
> patches) is actually a typo/wrong!
> ${NICE:-10} is correct (and Kees has fixed it already).
>
> "echo ${FOO:-10}" results in 10, if $FOO is not set, if you want to get
> "-10" as default, you would actually have to use ${FOO:--10}. The ":-"
> appears to be the syntax for "default".
>
> So, this seems to be fine - except for the typo.. ;)
>
> --
> updatedb cron job should make use of ionice
> https://bugs.launchpad.net/bugs/134692
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Timmie (timmie) wrote :

Hello,
is this problem solved on your Gutsy machines?

I still have the problem that updatedb blocks the machine totally for some minutes.

Thanks for your efforts!

Neal McBurnett (nealmcb) wrote :

The findutils package in gutsy, and the debdiff from 2007-10-01, was faulty - instead of changing ionice on the updatedb process, it changes it for process id 7 (and generates cron mail if there is no process 7).

See see https://bugs.edge.launchpad.net/ubuntu/+source/findutils/+bug/159472

Timmie (timmie) wrote :

Sorry, people for disturbing again.

But everyday findutils or better put updatedb blocks my harddrive for 5min.

Why can I set ionice options for my rsnapshot scripts and wit works well while this issue hasen't been fixed, yet?

Anything that we can do to prevent this in the coming release?
Is there already a check for battery state included?

Kind regards!

Gustavo Carneiro (gjc) wrote :

On a related note, nowadays we have tracker enabled by default in ubuntu-desktop; why do we need to have two file indexers running at the same time?

Please have a look at the mailing list threads shown in bug 140493 to read the whole discussion about keeping or removing updatedb.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers