High CPU Usage on Ubuntu By update-apt-xapi Process

High CPU Usage on Ubuntu By update-apt-xapi Process


update-apt-xapian-index is truncated and shown as update-apt-xapi in top tool. This process is responsible for maintaining an index of packages to speed up search on Synaptic and is scheduled as a cron job (/etc/cron.weekly).

This is the cron job, triggering the process:

#!/bin/sh

CMD=/usr/sbin/update-apt-xapian-index

IONICE=/usr/bin/ionice

# Rebuild the index
if [ -x $CMD ]
then
if [ -x $IONICE ]
then
nice $IONICE -c3 $CMD --quiet
else
nice $CMD --quiet
fi
fi

Edit the lines to show the following:


#!/bin/sh

CMD=/usr/sbin/update-apt-xapian-index

IONICE=/usr/bin/ionice

# Rebuild the index

if [ -x $CMD ]
then
if [ -x $IONICE ]
then
nice -n 19 $IONICE -c 3 $CMD --update --quiet
else
nice -n 19 $CMD --update --quiet
fi
fi

The modification will help reduce CPU usage. -n 19 option gives least favorable scheduling priority. --update option causes the process to update the index instead of rebuilding it every time.

Comments

  1. Many thanks for this - my machine crawls whilst this job runs.

    Thanks also for including in the text the
    "top" report string as google food. "update-apt-xapi" is a bit misleading to say the least if one doesn't know about xapian-index.

    ReplyDelete
  2. Glad to know that you find this useful.

    ReplyDelete

Post a Comment

Popular posts from this blog

OS/DB Migration - CMD. STR, TOC, EXT, R3load, DDLDBS.TPL and more

Fixing Inconsistent Table - Table activation fails due to inconsistency between DD and DB

301 Redirect Using SAP Web Dispatcher