How To Stress Test CPU and Memory

How To Stress Test CPU and Memory


Stress is a h/w test utility. It is a simple workload generator for POSIX systems. It imposes a configurable amount of CPU, memory, I/O, and disk stress on the system.

Step 1:

Installation Stress Package 

A: Ubuntu 16
apt-get install stress
B: CentOS 6

yum install epel*
yum install stress*

C: CentOS 7

Downolad Stress RPM
cd /tmp
wget ftp://fr2.rpmfind.net/linux/dag/redhat/el7/en/x86_64/dag/RPMS/stress-1.0.2-1.el7.rf.x86_64.rpm

yum localinstall stress-1.0.2-1.el7.rf.x86_64.rpm



          Or
rpm -ivh ftp://fr2.rpmfind.net/linux/dag/redhat/el7/en/x86_64/dag/RPMS/stress-1.0.2-1.el7.rf.x86_64.rpm



Step 2:

Below command to watch load average

watch uptime
Or
top
Or
htop

Step 3:

Open new terminal and run stress command

stress -c 4 -i 8 -m 8 --vm-bytes 256M -d 1 --hdd-bytes 10GB -t 300s

    htop command output

stress -c 4 -i 4 -m 4 --vm-bytes 1024M -d 1 --hdd-bytes 10GB -t 300s

          stress -c 4 -i 4 -m 4 --vm-bytes 256M -d 1 --hdd-bytes 10GB -t 300s

Stress : load

         CPU = 4 cpu

         I/O  = 4 

         VM = 256MB

        HDD = 10GB 

     top command output


Here :

-c,    --cpu N spawn N workers spinning on sqrt()
-i,     --io N spawn N workers spinning on sync()
-m,   --vm N spawn N workers spinning on malloc()/free()
--vm-bytes B malloc B bytes per vm worker (default is 256MB)
-d, --hdd N spawn N workers spinning on write()/unlink()
--hdd-bytes B write B bytes per hdd worker (default is 1GB)
-t,   --timeout N timeout after N seconds

See more option

stress --help





Previous
Next Post »