Stress Test CPU and Memory (VM) On a Linux / Unix
stress : it's a straightforward workload generator for POSIX systems. It imposes to be configurable number of CPU, memory, I/O, and disk stress on the system. it's written in C, and is free software licensed under the GPLv2. it's not a benchmark, but is very a tool designed
stress-ng : it's an updated version of stress tool and it'll check a server for the subsequent features:
- CPU compute
- Cache thrashing
- Drive stress
- I/O syncs
- VM stress
- Socket stressing
- Context switching
- Process creation and termination
This program is meant to be easy to use and recommended for brand spanking new sysadmins. The tool is thought to figure on x86 Linux and FreeBSD/OpenBSD, powerpc AIX and Linux, SPARC Solaris, Compaq Alpha Tru64 UNIX, and plenty of others.
Install stress package on a Linux
You can install stress as a part of the Linux or Unix distribution.
Just same as below Install stress on a CentOS, RHEL, and Fedora Linux
sudo yum install stress
As per below Install stress on a Debian and Ubuntu Linux
apt-get install stress
According to below step you can Install stress on a FreeBSD Unix system
Type the following pkg command to install the stress tool using binary method:
pkg install stress ## OR ## pkg install sysutils/stress
Install stress on a OpenBSD Unix system
Type the following pkg_add command to install the stress tool using binary method:
## if installpath not set in /etc/pkg.conf as follow ## ## installpath = http://mirror.esc7.net/pub/OpenBSD/%c/packages/%a/ use ## ## PKG_PATH ## export PKG_PATH=http://ftp.usa.openbsd.org/pub/OpenBSD/`uname -r`/packages/`arch -s` pkg_add stress
How do I use stress tool on Linux?
First, note down the current system load averages by typing the following command:
# uptime
Next, run any one of the following command to see load on screen:
# watch uptime
OR you can use tload command:
# tload
The syntax is as follows:
stress [OPTION] ## Stress using CPU-bound task stress -c 4 ## Stress using IO-bound task stress -i 2
For example, a load average of four is imposed on the system by specifying two CPU-bound processes, one I/O-bound process, and one memory allocator process as follows:# uptime
# stress -c 2 -i 1 -m 1 --vm-bytes 128M -t 10s
# uptime
stress [OPTION]
## Stress using CPU-bound task
stress -c 4
## Stress using IO-bound task
stress -i 2
For example, a load average of four is imposed on the system by specifying two CPU-bound processes, one I/O-bound process, and one memory allocator process as follows:
# uptime
# stress -c 2 -i 1 -m 1 --vm-bytes 128M -t 10s
# uptime
While,
-c 2 : Spawn two workers spinning on sqrt()
-i 1 : Spawn one worker spinning on sync()
-m 1 : Spawn one worker spinning on malloc()/free()
--vm-bytes 128M : Malloc 128MB per vm worker (default is 256MB)
-t 10s : Timeout after ten seconds
-v : Be verbose
Comments
Post a Comment