How to install Stress on Linux to create a workload

Want to put stress to create a workload (CPU or memory) on a Linux server. Learn how to install Stress on Linux so you can easily manage your Linux server workload.

How do I install Stress on Linux?

  • enable EPEL repository:

In order to enable “Install stress on Linux”, you must first enable the EPEL repository.

Enabling the repository EPEL helps you install some standard open source Linux source software using the yum command. Basically this is what we did on our 64 bit RHEL7 server for the same.

[[email protected] ~]# wget
[[email protected] ~]# rpm -ivh epel-release-7-10.noarch.rpm

  • Installing Stress on Linux

In the next step, you need to install the Stress utility using a simple yum command as shown below:

For RHEL, CentOS and Fedora

[[email protected] ~]# yum install stress

For Ubuntu and Debian:

#apt-get install stress

How to load and test on Linux using Stress?

Stress allows you to put the memory load on the server using the strss utility and capture it using the free command.

  • Capturing the current memory usage before executing the Stress command.
[[email protected] ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:            985          82         229          12         669         705
Swap:             0           0           0

  • Now run the following command on the server, which puts the load on two workers each with 128M of memory.
[[email protected] ~]# stress --vm 2 --vm-bytes 128M
stress: info: [23785] dispatching hogs: 0 cpu, 0 io, 2 vm, 0 hdd

  • Now grab the memory usage again.
[[email protected] ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:            985         288         114          12         581         502
Swap:             0           0           0
[[email protected] ~]#

You can easily figure out how the memory usage increases and the reason for this is the stress utility!