1839550 Members
2363 Online
110147 Solutions
New Discussion

System Stress Script

 
SOLVED
Go to solution
Brent W. Moll
Advisor

System Stress Script

Does anyone have a script which will run up CPU utilization to 100% ?

We are testing some new server monitoring software to alarm and send email when the servers are at high CPU utilization and I need a way to test it.

Thank you :)
8 REPLIES 8
Elmar P. Kolkman
Honored Contributor
Solution

Re: System Stress Script

You could try:
cd /usr/bin
while true
do
for f in *
do
nroff -man $f &
done
done

But be carefull: it will run indefinitely.

You could also increase usage by setting nice -20 on the command to increase priority.
Every problem has at least one solution. Only some solutions are harder to find.
doug mielke
Respected Contributor

Re: System Stress Script

depending on the number of processors you may need to run multiple scripts.

I've done application load testing with variations of this simple loop, run multiple times

while :
do
cp /somedirname/* /dev/null
done

after the first loop of something like this, data will be in cache, and dump to null as fast as memory i/o allows.

You can add some calculatiion type commands to the body if you want to try to eliminate any waits for resouces.
G. Vrijhoeven
Honored Contributor

Re: System Stress Script

Hi,

while true
do
nice --10 gzip -c /stand/vmunix >/dev/null &
done

Gideon

Claudio Cilloni
Honored Contributor

Re: System Stress Script

#! /usr/bin/env perl

while (1) {
$a = 1
}


this brings _one_ cpu to 100%. Stop it with ctrl-c.

hth,
Claudio
doug mielke
Respected Contributor

Re: System Stress Script

correction on the cp command.
a better one is cat /somedirname >/dev/null

the cp will error.
sorry
Pete Randall
Outstanding Contributor

Re: System Stress Script

Multiple find commands will put some serious stress on a machine.


Pete

Pete
Elmar P. Kolkman
Honored Contributor

Re: System Stress Script

And in my solution you need to add a redirection to /dev/null, off course.

Every problem has at least one solution. Only some solutions are harder to find.
John Carr_2
Honored Contributor

Re: System Stress Script

Hi

make sure you do stressing in foreground so you can kill the process ctrl/c . If you set it in background you could have a little difficulty :-) John.