Welcome
Welcome to refracta

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

Snapshot and cpu usage

Refracta Development, Scripts, etc.

Snapshot and cpu usage

Postby dzz » Mon May 23, 2011 11:08 am

Done some very interesting experiments with snapshot bash version recently. Although incomplete as yet, the basic commands work fine and can be easily customised (set temp paths, add to the rcync-exclude list, throw in a few zenity dialogs)

One problem here is cpu usage in the rsync and mksquashfs stages, particularly if using virtualbox. I got some total lockups and even sudden shutdowns due to overheating. The fastest box here is a single-core XP3200, old but normally not problematic.

I used top to monitor this, it showed the VM process itself hitting 100% at those stages (rsync and mksquashfs)

I did some reading and tried cpulimit, which seems to work. Not ideal as the hog process has to first be started, then identified and manually limited to, say, 75%. Difficult if a script, when it is ready, will start that process (although if in an open VM session, the VM itself can be limited before starting the script)

Any better ideas to deal with this issue? I'm really looking for an automated cli solution.
dzz
 
Posts: 629
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: Snapshot and cpu usage

Postby fsmithred » Mon May 23, 2011 8:48 pm

First: remove dust and check fans.

If you want to build it into the script, I think you may need to use nice instead of cpulimit, but I'm not sure if that will help with the overheating. I played with cpulimit a bit, and it seems like it needs to be run external to the script. I get three instances of rsync running in the snapshot script, and to limit all three of them, I needed to do some tricks. I put cpulimit in a separate script and let it find the rsync processes. Here's what I was playing with
Code: Select all
#!/usr/bin/env bash

n=0
for i in $(pgrep rsync); do
    process_list[$n]="$i"
    echo "${process_list[$n]}"
    cpulimit -p "${process_list[$n]}" -l 75 &
    ((n++))
done

echo "cpulimit"
ps ax |grep cpulimit
echo "rsync"
ps ax |grep rsync
The echoes and ps ax are not necessary, but they help to see what's going on. When rsync is finished, you'll need to kill the cpulimit processes. Easiest way is with 'pkill cpulimit'.
User avatar
fsmithred
 
Posts: 1987
Joined: Wed Mar 09, 2011 9:13 pm

Re: Snapshot and cpu usage

Postby dzz » Tue May 24, 2011 1:21 pm

The fan seemed OK and dust-free... but new thermal grease on the heatsink made a big difference. This box was built from old scrap, like most things here (there is a laptop with a faster 2-core but I try to avoid stressing that)

I got lm-sensors installed so can monitor temperature (if that tool is reliable) It still seems rather hot at 64 off-load rising to 74 with mksquashfs running in virtualbox. But that's better than before and snapshot now completes OK

I'm going to try snapshot with X closed altogether and try to get some performance comparisons.

Thanks for the ps/cpulimit script, that's a good tool to have handy.
dzz
 
Posts: 629
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England


Return to Discuss

Who is online

Users browsing this forum: No registered users and 0 guests

suspicion-preferred