Getting to know how to stress test your machine is always an important thing, may it be system administration for servers or for benchmarking a embedded board. There are plenty of tools that are available which I will list below with some example on how to use it.
The first command we are going to see is stress. It a tool to impose load on and stress test systems.
apt-get install stress
stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s
Here –cpu or -c spawn N workers spinning on sqrt(), –io or -i spawn N workers spinning on sync(), –vm or -m will spawn N workers spinning on malloc()/free(), –vm-bytes malloc B bytes per vm worker (default is 256MB) and finally –timeout will end the program after N seconds.
uptime stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 10s uptime
For more information check man page of stress using the command man stress.
The Stress-NG is an updated version of the stress command. The stresss-ng as the manual says “stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces. stress-ng also has a wide range of CPU specific stress tests that exercise floating point, integer, bit manipulation and control flow.
stress-ng was originally intended to make a machine work hard and trip hardware issues such as thermal overruns as well as operating system bugs that only occur when a system is being thrashed hard. Use stress-ng with caution as some of the tests can make a system run hot on poorly designed hardware and also can cause excessive system thrashing which may be difficult to stop.”
apt-get install stress-ng
The stress-ng contains all the features of the stress command and many additional features.
stress-ng --cpu 16 --cpu-ops 900000
stress-ng --cpu 4 --cpu-method fft --timeout 2m
The next command we are going to see is spew. Spew is used to measures I/O performance and/or generates I/O load.
apt-get install spew
spew --write -b 16k 1m /tmp/bigfile WTR: 288931.54 KiB/s Transfer time: 00:00:00 IOPS: 18058.22 root@orangepizero:~# ls -lh /tmp/bigfile -rw------- 1 root root 1.0M May 23 18:38 /tmp/bigfile
For more examples check the man page of the spew. I found lots of other
performance testing and benchmarking tools which will mentioning below.
tsung – distributed multi-protocol load testing tool
stressapptest – stress test application for simulating high load situations
fuzz – stress-test programs by giving them random input
netstress – utility designed to stress and benchmark network activity
cpuburn – Collection of programs to put heavy load on CPU