I needed a reliable way to test a script I wrote to monitor server load. Luckily I found it in bash’s stress
command.
On most versions of Linux, you can install it with
yum install stress
or
apt-get install stress
depending on your distro.
I was on Centos 7.2, which of course doesn’t have the package in a repo (including EPEL), so I downloaded it from here
ftp://fr2.rpmfind.net/linux/dag/redhat/el7/en/x86_64/dag/RPMS/stress-1.0.2-1.el7.rf.x86_64.rpm
and did
yum localinstall stress-1.0.2-1.el7.rf.x86_64.rpm
Usage is straightforward, all I needed to do was generate 90 seconds of greater than 70% CPU usage on a one CPU cloud virt, so I did
stress --cpu 2 --timeout 90