Stress test - induce load on CPU, FPU, RAM, HDD, SSD and more Print

  • hardware, stress test, prime95, linux, cpu, torture, high load, fake load, hdd test, hard disk, i/o, fpu
  • 16

When a dedicated server is crashing or its hardware otherwise misbehaving under load, it is helpful to induce a 'fake load' onto the system to help diagnose the problem. This can be done with the nifty stress tool that is available in most Linux distributions.

First, let's install the stress-ng package. On Debian/Ubuntu you should use:

apt install stress-ng

Whereas RHEL/CentOS/Fedora, we need to first enable the EPEL repository (which is generally safe, but proceed with moderate caution as this can change package versions!)then install stress:

yum install epel-release
yum install stress

Now that it's installed, we need to tell it to do something. To start, let's run a short 4-thread CPU test:

stress --cpu 4 --timeout 30

If all goes well, a 30 second torture test should be executed on the CPU, using 4 seperate threads. If your system is a quad core, then this should sufficiently tax all cores. Though, if your system has HyperThreading (HT) or Simultaneous MultiThreading (SMT) technologies, you might want to use 8 threads so that your threaded cores are utilised too.

Here are a small selection of useful tests. Please edit as you see fit for your workload and requirements:

stress --vm 4 --timeout 900s
This will start a 4-thread stress test, running malloc() and free() functions continually, for a period of 900 seconds.

stress --io 4 --timeout 900s
This will start a 4-thread test running sync(), to stress the system's storage read and read buffers, for 900 seconds.

stress --hdd 4 --timeout 900s
This will start a 4-thread test running write()/unlink(), which will write data to the system's storage and then delete it, for 900 seconds.

stress --hdd 2 --io 4 --vm 6 --cpu 8 --timeout 900s
This combines a selection of all the above tests for 900 seconds. Combining tests can give a more realistic workflow of a busy server, mimicing usage of CPU, RAM and storage as if it were in regular use.

Was this answer helpful?

« Back