Is there any way to make tracker less resource-intensive?

Just switched to GNOME 3.36 from XFCE, from KDE, from…

It’s way better than the last time I tried it (and the stock Manjaro-picked extensions help a LOT!!!), and I’m actually enjoying it.

The only thing is, I’m afraid that tracker is going to crash my machine, the way it did a year ago when I first tried GNOME on this machine. It’s got an SSD, but it’s a Mid-2011 iMac – 2nd gen Core i5, no USB 3, Thunderbolt 1 (not 2 or 3). It’s a bit long in the tooth, but still does everything I need. (except have an acceptably fast USB port)

I know I can kill tracker, or disable it from starting. I was just wondering if there was some way to throttle it. Ideally, set it to pause after processing every few files for X milliseconds if the system load goes above Y. I can try to do that with some scripting, but it’d be nice if there were a config option for it.

How do you guys handle tracker?

Cheers

1 Like

Tracker has a setting to only index on iddle. Though that might be already enabled in manjaro? Search dconf tool for tracker.

1 Like

I didn’t know (or forgot about) the dconf editor! There’s a throttle value right there! Thanks!!!

I wrote a script, just in case tracker got out of hand again. I came back to a frozen box a couple times, and blamed tracker in my anger, but it turned out to be a buggy resume-from-suspend. I haven’t really experienced that on this box before, but I don’t usually suspend this box, because I use it as a syncthing server. So, I just disabled suspend, and it’s happy camping. Display suspend seems to be working fine.

Anyway, here is my script:

(note: load is expressed in whole integers, so a load of 5.72 would be expressed as 572. It just makes the math easier in shell)

$ cat bin/tracker-nanny 
#!/bin/bash

progname=$(basename $0)
maxload=400		#no decimal point
logfile=$HOME/.tracker-nanny.log

function getload() {
	uptime |cut -f3 -d, |cut -f2 -d: |tr -d ' .'
}

function datestamp() {
	date +%Y%m%d-%H:%M:%S
}

starttracker() {
	killall -CONT /usr/lib/tracker-extract		&>/dev/null
	killall -CONT /usr/lib/tracker-miner-fs		&>/dev/null
	killall -CONT /usr/lib/tracker-miner-rss	&>/dev/null
	killall -CONT /usr/lib/tracker-store		&>/dev/null
	killall -CONT /usr/lib/tracker-writeback	&>/dev/null
}

stoptracker() {
	killall -STOP /usr/lib/tracker-extract		&>/dev/null
	killall -STOP /usr/lib/tracker-miner-fs		&>/dev/null
	killall -STOP /usr/lib/tracker-miner-rss	&>/dev/null
	killall -STOP /usr/lib/tracker-store		&>/dev/null
	killall -STOP /usr/lib/tracker-writeback	&>/dev/null
}


while :	#mainloop
do
	if [ $(getload) -ge $maxload ]
	then
		echo "$(datestamp) $progname: load ($(getload)) is high. Stopping tracker" |tee -a $logfile
		stoptracker

		#Wait for system load to cool down
		while [ $(getload) -ge $maxload ]
		do
			sleep 30
		done
		echo "$(datestamp) $progname: load ($(getload)) is low again. Resuming tracker" |tee -a $logfile
		starttracker
	fi

	echo "$(datestamp) $progname heartbeat: load is $(getload)" |tee -a $logfile

	sleep 30
done

And here is some output:

$ grep -B1 -A2 high .tracker-nanny.log 
20200901-23:01:01 tracker-nanny heartbeat: load is 278
20200901-23:01:31 tracker-nanny: load (414) is high. Stopping tracker
20200901-23:02:01 tracker-nanny: load (364) is low again. Resuming tracker
20200901-23:02:01 tracker-nanny heartbeat: load is 364
--
20200901-23:03:31 tracker-nanny heartbeat: load is 393
20200901-23:04:01 tracker-nanny: load (431) is high. Stopping tracker
20200901-23:06:31 tracker-nanny: load (378) is low again. Resuming tracker
20200901-23:06:31 tracker-nanny heartbeat: load is 378
20200901-23:07:01 tracker-nanny heartbeat: load is 370
20200901-23:07:31 tracker-nanny: load (444) is high. Stopping tracker
20200901-23:08:31 tracker-nanny: load (392) is low again. Resuming tracker
20200901-23:08:31 tracker-nanny heartbeat: load is 392
20200901-23:09:01 tracker-nanny: load (447) is high. Stopping tracker
20200901-23:10:31 tracker-nanny: load (363) is low again. Resuming tracker
20200901-23:10:31 tracker-nanny heartbeat: load is 363
--
20200901-23:12:01 tracker-nanny heartbeat: load is 363
20200901-23:12:31 tracker-nanny: load (427) is high. Stopping tracker
20200901-23:13:01 tracker-nanny: load (394) is low again. Resuming tracker
20200901-23:13:01 tracker-nanny heartbeat: load is 394
--
20200901-23:17:31 tracker-nanny heartbeat: load is 398
20200901-23:18:01 tracker-nanny: load (431) is high. Stopping tracker
20200901-23:20:31 tracker-nanny: load (329) is low again. Resuming tracker
20200901-23:20:31 tracker-nanny heartbeat: load is 329

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.