Want to put some stress|work load ( CPU or memory) on your Linux server. Learn how to install Stress on Linux so that, you can easily manage the activity of putting work-load on your Linux server.
How to install Stress on Linux?
Enable EPEL repository:
To begin activity of “Install stress on Linux” You need to first enable EPEL repository.
Enabling EPEL repository helps you to install some standard open source software’s using YUM command in Linux. Basically this is what I did on my RHEL7 64 bit server for the same.
[root@ip-172-31-22-4 ~]# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm [root@ip-172-31-22-4 ~]# rpm -ivh epel-release-7-10.noarch.rpm
Install stress on Linux
In the next step you need to install stress utility using simple yum command as below:
For RHEL, Centos and Fedora
[root@ip-172-31-22-4 ~]# yum install stress
For Ubuntu and Debian:
#apt-get install stress
How to put sample load and test the same on Linux using stress?
Lets put memory load on server using strss utility and capture it using free command.
- Capture the current memory utilisation prior to executing stress command.
[root@ip-172-31-22-4 ~]# free -m total used free shared buff/cache available Mem: 990 82 243 12 664 710 Swap: 0 0 0
- Now execute below command on the server which puts load with two workers having each load of 128M memory.
[root@ip-172-31-22-4 ~]# stress --vm 2 --vm-bytes 128M stress: info:  dispatching hogs: 0 cpu, 0 io, 2 vm, 0 hdd
- Now capture the memory utilisation one more time.
[root@ip-172-31-22-4 ~]# free -m total used free shared buff/cache available Mem: 990 288 128 12 574 509 Swap: 0 0 0 [root@ip-172-31-22-4 ~]#
You can easily figured out that, memory utilisation increased and stress utility is the reason behind it!