Skip to content

Instantly share code, notes, and snippets.

@sandeep-mg
Created February 22, 2023 06:04
Show Gist options
  • Save sandeep-mg/06183efdc89b4cc6ae244b9967f7c9cc to your computer and use it in GitHub Desktop.
Save sandeep-mg/06183efdc89b4cc6ae244b9967f7c9cc to your computer and use it in GitHub Desktop.
Stress Test on Linux

Stress Test on Linux

Test your Linux systems when they are under stress of high load.

This command line tool that allows to generate a workload on the system.

Execute the following commands to update the package lists and install stress:

sudo apt update
sudo apt install -y stress

Run the stress command with a --cpu option followed by number of workers to perform CPU stress testing. The --timeout option stops stress testing after N seconds. The uptime command can be used to determine the average system load before and after running a stress command.

uptime
sudo stress --cpu 8 --timeout 20
uptime

Example of the output:

user@linux ~ $ uptime    
 17:20:00 up  7:51,  2 users,  load average: 1.91, 2.16, 1.93     [<-- Watch Load Average]
 
user@linux ~ $ sudo stress --cpu 8 --timeout 20
stress: info: [17246] dispatching hogs: 8 cpu, 0 io, 0 vm, 0 hdd
stress: info: [17246] successful run completed in 21s

user@linux ~ $ uptime
 17:20:24 up  7:51,  2 users,  load average: 5.14, 2.88, 2.17     [<-- Watch Load Average]

Remove stress with command:

sudo apt purge --autoremove -y stress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment