Today I had a need to keep the load on a server at 20 for an extended period of time. I was doing this to test notification escalations in Nagios. So, I found a nice little program call cpuburn-in that will load a processor at 100%. It’s just a tarball with an executable and a single README file included. To run the program, call the executable and supply the number of minutes you want it to run. So, to run it for 60 minutes, just use:

./cpuburn-in 60

Since I wanted to generate a 20 load on the server for 60 minutes, I just put this in a loop and spawned 20 processes.

i=1; while [ $i -le 20 ];do ./cpuburn-in 60 & i=$(( $i + 1 ));done

This worked nicely for keeping the load right around 20 for me. If you want to kill things off early, just do the following:

ps a | grep cpuburn-in | awk '{print $1}' | xargs kill

Tags: , ,

  • tulcod

    also a nice tool is stress; see app-benchmark/stress

    • http://www.mindlesstechie.net John Alberts

      Thanks. I didn’t see that one and it looks like it would have been even easier to use and more powerful.
      To tell you the truth, I was on an old RHEL4 machine that no longer had a valid RH license, so the only software I could install was what I could easily google and find. I found cpuburn-in fairly quickly and it seemed well suited for what I needed.