How to Test CPU and Memory Load with Stress & Stress-ng

Published on March 9, 2021 54 sec read

In this article, I’ll install Stress on Linux machine and test CPU and memory load with Stress. Let’s get started:

Table of Contents

  1. Install Stress
  2. Run Stress
  3. Watch Load Average
  4. Note

Install Stress

Run this command to install Stress-ng (updated version of Stress):

# CentOS/RHEL 8
sudo dnf install stress-ng -y

# CentOS/REHL 7/Amazon Linux
sudo yum install stress-ng -y

# Debian/Ubuntu
sudo apt install stress-ng -y

Run this command to install Stress on your machine:

# CentOS/RHEL 8
sudo dnf install stress -y

# CentOS/REHL 7/Amazon Linux
sudo yum install stress -y

# Debian/Ubuntu
sudo apt install stress -y

Now run this command to see all available options:

stress-ng --help
# stress
stress --help

Run Stress

Stress using CPU-bound task:

stress-ng --cpu 4 -t 30s

# with stress
stress --cpu 4 -t 30s
stress -c 4 -t 30s

Stress using IO-bound task:

stress-ng -i 4 -t 60s

# with stress
stress -i 4 -t 60s

We can run all of these tests in parallel by running the command below:

stress-ng --cpu 2 --all -t 120s

Give load using two CPU-bound processes, one I/O-bound process, and one memory allocator:

stress-ng -c 2 -i 1 -m 1 --vm-bytes 128M -t 20s

Watch Load Average

We can see the avegare load using these commands:

# or 
watch uptime
# or

htop is another awesome tool to monitor loads:

# install htop
sudo yum install htop -y # CentOS/RHEL
sudo apt install htop -y # Debian/Ubuntu

# then run


If you run stress for a long time, you should reboot the system before making it live.

sudo reboot
That’s all. Thank you. 🙂

Monthly Newsletter

One email a month, packed with the latest tutorials, delivered straight to your inbox.
We'll never send any spam or promotional emails.

Hey, I'm Md Obydullah. I build open-source projects and write on Laravel, Linux server, modern JavaScript and more on web development.