Skip to content

This is the stress-ng upstream project git repository. 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.

License

Notifications You must be signed in to change notification settings

ColinIanKing/stress-ng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stress-ng (stress next generation)

Packaging status

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 features:

  • 350+ stress tests
  • 80+ CPU specific stress tests that exercise floating point, integer, bit manipulation and control flow
  • 20+ virtual memory stress tests
  • 40+ file system stress tests
  • 30+ memory/CPU cache stress tests
  • portable: builds on Linux (Debian, Devuan, RHEL, Fedora, Centos, Slackware OpenSUSE, Ubuntu, etc..), Solaris, FreeBSD, NetBSD, OpenBSD, DragonFlyBSD, Minix, Android, MacOS X, Serenity OS, GNU/Hurd, Haiku, Windows Subsystem for Linux, Cygwin and SunOs/Dilos/Solaris. with gcc, musl-gcc, clang, icc, icx, tcc and pcc.
  • tested on alpha, armel, armhf, arm64, hppa, i386, loong64, m68k, mips32, mips64, power32, ppc64el, risc-v, sh4, s390x, sparc64, x86-64

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.

stress-ng can also measure test throughput rates; this can be useful to observe performance changes across different operating system releases or types of hardware. However, it has never been intended to be used as a precise benchmark test suite, so do NOT use it in this manner.

Running stress-ng with root privileges will adjust out of memory settings on Linux systems to make the stressors unkillable in low memory situations, so use this judiciously. With the appropriate privilege, stress-ng can allow the ionice class and ionice levels to be adjusted, again, this should be used with care.

Tarballs

Tarballs of each version of stress-ng can be downloaded using the URL:

https://github.com/ColinIanKing/stress-ng/tarball/version

where version is the relevant version number, for example:

https://github.com/ColinIanKing/stress-ng/tarball/V0.13.05

Running latest stress-ng snapshot in a container

docker run --rm ghcr.io/colinianking/stress-ng --help

or

docker run --rm colinianking/stress-ng --help

Debian packages for Ubuntu

Recent versions of stress-ng are available in the Ubuntu stress-ng ppa for various Ubuntu releases:

https://launchpad.net/~colin-king/+archive/ubuntu/stress-ng

sudo add-apt-repository ppa:colin-king/stress-ng
sudo apt update
sudo apt install stress-ng

Building stress-ng

To build, the following libraries will ensure a fully functional stress-ng build: (note libattr is not required for more recent disto releases).

Debian, Ubuntu:

  • gcc g++ libacl1-dev libaio-dev libapparmor-dev libatomic1 libattr1-dev libbsd-dev libcap-dev libeigen3-dev libgbm-dev libcrypt-dev libglvnd-dev libipsec-mb-dev libjpeg-dev libjudy-dev libkeyutils-dev libkmod-dev libmd-dev libmpfr-dev libsctp-dev libxxhash-dev zlib1g-dev

RHEL, Fedora, Centos:

  • gcc g++ eigen3-devel Judy-devel keyutils-libs-devel kmod-devel libacl-devel libaio-devel libatomic libattr-devel libbsd-devel libcap-devel libgbm-devel libcrypt-devel libglvnd-core-devel libglvnd-devel libjpeg-devel libmd-devel mpfr-devel libX11-devel libXau-devel libxcb-devel lksctp-tools-devel xorg-x11-proto-devel xxhash-devel zlib-devel

RHEL, Fedora, Centos (static builds):

  • gcc g++ eigen3-devel glibc-static Judy-devel keyutils-libs-devel libacl-devel libaio-devel libatomic-static libattr-devel libbsd-devel libcap-devel libgbm-devel libcrypt-devel libglvnd-core-devel libglvnd-devel libjpeg-devel libmd-devel libX11-devel libXau-devel libxcb-devel lksctp-tools-devel mpfr-devel xorg-x11-proto-devel xxhash-devel zlib-devel

SUSE:

  • gcc gcc-c++ eigen3-devel keyutils-devel libaio-devel libapparmor-devel libatomic1 libattr-devel libbsd-devel libcap-devel libgbm-devel libglvnd-devel libjpeg-turbo libkmod-devel libmd-devel libseccomp-devel lksctp-tools-devel mpfr-devel xxhash-devel zlib-devel

ClearLinux:

  • devpkg-acl devpkg-eigen devpkg-Judy devpkg-kmod devpkg-attr devpkg-libbsd devpkg-libjpeg-turbo devpkg-libsctp devpkg-mesa

Alpine Linux:

  • build-base eigen-dev jpeg-dev judy-dev keyutils-dev kmod-dev libacl-dev libaio-dev libatomic libattr libbsd-dev libcap-dev libmd-dev libseccomp-dev lksctp-tools-dev mesa-dev mpfr-dev xxhash-dev zlib-dev

Snaps:

  • stress-ng is not intended to be snap'd with snapcraft. Doing so is strictly against the wishes of the project maintainer and main developer.

NOTE: the build will try to detect build dependencies and will build an image with functionality disabled if the support libraries are not installed.

At build-time stress-ng will detect kernel features that are available on the target build system and enable stress tests appropriately. Stress-ng has been build-tested on Ubuntu, Debian, Debian GNU/Hurd, Slackware, RHEL, SLES, Centos, kFreeBSD, OpenBSD, NetBSD, FreeBSD, Debian kFreeBSD, DragonFly BSD, OS X, Minix, Solaris 11.3, OpenIndiana and Hiaku. Ports to other POSIX/UNIX like operating systems should be relatively easy.

NOTE: ALWAYS run make clean after fetching changes from the git repository to force the build to regenerate the build configuration file. Parallel builds using make -j are supported.

To build on BSD systems, one requires gcc and GNU make:

    CC=gcc gmake clean
    CC=gcc gmake

To build on OS X systems, just use:

    make clean
    make -j

To build on MINIX, gmake and clang are required:

    CC=clang gmake clean
    CC=clang gmake

To build on SunOS, one requires GCC and GNU make, build using:

    CC=gcc gmake clean
    CC=gcc gmake

To build on Dilos, one requires GCC and GNU make, build using:

    CC=gcc gmake clean
    CC=gcc gmake

To build on Haiku R1/beta5:

    # GCC
    make clean
    make
    # Clang
    CC=clang make clean
    CC=clang make

To build a static image (example, for Android), use:

# path to Android NDK
# get NDK from https://developer.android.com/ndk/downloads
    export NDK=$HOME/android-ndk-r27c
    export PATH=$PATH:$NDK/toolchains/llvm/prebuilt/linux-x86_64/bin
    export TARGET=aarch64-linux-android
    # Define Android API level
    export API=27
    export CC=$TARGET$API-clang

    make clean
    STATIC=1 make

To build with the Tiny C compiler:

    make clean
    CC=tcc make

To build with the PCC portable C compiler use:

    make clean
    CC=pcc make

To build with the musl C library:

    make clean
    CC=musl-gcc

To build with the Intel C compiler icc use:

    make clean
    CC=icc make

To build with the Intel C compiler icx use:

    make clean
    CC=icx make

To perform a cross-compilation using gcc, use a static build, specify the toolchain (both CC and CXX). For example, a mips64 cross build:

    make clean
    STATIC=1 CC=mips64-linux-gnuabi64-gcc CXX=mips64-linux-gnuabi64-g++ make -j $(nproc)

To perform a cross-compile for qnx, for example, a aarch64 qnx cross build:

    make clean
    CC=aarch64-unknown-nto-qnx7.1.0-gcc CXX=aarch64-unknown-nto-qnx7.1.0-g++ STATIC=1 make

Build option: DEBUG, build with debug (-g) enabled:

    make clean
    DEBUG=1 make

Build option: LTO, Link Time Optimization (~1-2% performance improvement on compute stressors):

    make clean
    LTO=1 make

Build option: PEDANTIC, enable pedantic build flags:

    make clean
    PEDANTIC=1 make

Build option: GARBAGE_COLLECT, warn of unused code:

    make clean
    GARBAGE_COLLECT=1 make

Build option: UNEXPECTED=1, warn of unexpected #ifdef'd out code:

    make clean
    UNEXPECTED=1 make

Contributing to stress-ng:

Send patches to [email protected] or merge requests at https://github.com/ColinIanKing/stress-ng

Quick Start Reference Guide

The Ubuntu stress-ng reference guide contains a brief overview and worked examples.

Examples

Run 4 CPU, 2 virtual memory, 1 disk and 8 fork stressors for 2 minutes and print measurements:

stress-ng --cpu 4 --vm 2 --hdd 1 --fork 8 --timeout 2m --metrics
stress-ng: info:  [573366] setting to a 120 second (2 mins, 0.00 secs) run per stressor
stress-ng: info:  [573366] dispatching hogs: 4 cpu, 2 vm, 1 hdd, 8 fork
stress-ng: info:  [573366] successful run completed in 123.78s (2 mins, 3.78 secs)
stress-ng: info:  [573366] stressor       bogo ops real time  usr time  sys time   bogo ops/s     bogo ops/s CPU used per
stress-ng: info:  [573366]                           (secs)    (secs)    (secs)   (real time) (usr+sys time) instance (%)
stress-ng: info:  [573366] cpu              515396    120.00    453.02      0.18      4294.89        1137.24        94.42
stress-ng: info:  [573366] vm              2261023    120.01    223.80      1.80     18840.15       10022.27        93.99
stress-ng: info:  [573366] hdd              367558    123.78     10.63     11.67      2969.49       16482.42        18.02
stress-ng: info:  [573366] fork             598058    120.00     68.24     65.88      4983.80        4459.13        13.97

Run matrix stressor on all online CPUs for 60 seconds and measure temperature:

stress-ng --matrix -1 --tz -t 60
stress-ng: info:  [1171459] setting to a 60 second run per stressor
stress-ng: info:  [1171459] dispatching hogs: 8 matrix
stress-ng: info:  [1171459] successful run completed in 60.01s (1 min, 0.01 secs)
stress-ng: info:  [1171459] matrix:
stress-ng: info:  [1171459]               acpitz0   75.00 C (348.15 K)
stress-ng: info:  [1171459]               acpitz1   75.00 C (348.15 K)
stress-ng: info:  [1171459]          pch_skylake   60.17 C (333.32 K)
stress-ng: info:  [1171459]         x86_pkg_temp   62.72 C (335.87 K)

Run a mix of 4 I/O stressors and check for changes in disk S.M.A.R.T. metadata:

sudo stress-ng --iomix 4 --smart -t 30s
stress-ng: info:  [1171471] setting to a 30 second run per stressor
stress-ng: info:  [1171471] dispatching hogs: 4 iomix
stress-ng: info:  [1171471] successful run completed in 30.37s
stress-ng: info:  [1171471] Device     ID S.M.A.R.T. Attribute                 Value      Change
stress-ng: info:  [1171471] sdc        01 Read Error Rate                   88015771       71001
stress-ng: info:  [1171471] sdc        07 Seek Error Rate                   59658169          92
stress-ng: info:  [1171471] sdc        c3 Hardware ECC Recovered            88015771       71001
stress-ng: info:  [1171471] sdc        f1 Total LBAs Written               481904395         877
stress-ng: info:  [1171471] sdc        f2 Total LBAs Read                 3768039248        5139
stress-ng: info:  [1171471] sdd        be Temperature Difference             3670049           1

Benchmark system calls using the VDSO:

stress-ng --vdso 1 -t 5 --metrics
stress-ng: info:  [1171584] setting to a 5 second run per stressor
stress-ng: info:  [1171584] dispatching hogs: 1 vdso
stress-ng: info:  [1171585] stress-ng-vdso: exercising vDSO functions: clock_gettime time gettimeofday getcpu
stress-ng: info:  [1171585] stress-ng-vdso: 9.88 nanoseconds per call (excluding 1.73 nanoseconds test overhead)
stress-ng: info:  [1171584] successful run completed in 5.10s
stress-ng: info:  [1171584] stressor       bogo ops real time  usr time  sys time   bogo ops/s     bogo ops/s CPU used per
stress-ng: info:  [1171584]                           (secs)    (secs)    (secs)   (real time) (usr+sys time) instance (%)
stress-ng: info:  [1171584] vdso          430633496      5.10      5.10      0.00  84375055.96    84437940.39        99.93
stress-ng: info:  [1171584] vdso               9.88 nanoseconds per call (average per stressor)

Generate and measure branch misses using perf metrics:

sudo stress-ng --branch 1 --perf -t 10 | grep Branch
stress-ng: info:  [1171714]                604,703,327 Branch Instructions            53.30 M/sec
stress-ng: info:  [1171714]                598,760,234 Branch Misses                  52.77 M/sec (99.02%)

Run permutations of I/O stressors on a ZFS file system, excluding the rawdev stressor with kernel log error checking:

stress-ng --class io --permute 0 -x rawdev -t 1m --vmstat 1 --klog-check  --temp-path /zfs-pool/test

x86 only: measure power using the RAPL interfaces on 8 concurrent 3D matrix stressors with verification enabled. Note that reading RAPL requires root permission.

sudo stress-ng --matrix-3d 8 --matrix-3d-size 512 --rapl -t 10 --verify
stress-ng: info:  [4563] setting to a 10 secs run per stressor
stress-ng: info:  [4563] dispatching hogs: 8 matrix-3d
stress-ng: info:  [4563] matrix-3d:
stress-ng: info:  [4563]  core                     6.11 W
stress-ng: info:  [4563]  dram                     2.71 W
stress-ng: info:  [4563]  pkg-0                    8.20 W
stress-ng: info:  [4563]  psys                    16.90 W
stress-ng: info:  [4563]  uncore                   0.06 W
stress-ng: info:  [4563] skipped: 0
stress-ng: info:  [4563] passed: 8: matrix-3d (8)
stress-ng: info:  [4563] failed: 0
stress-ng: info:  [4563] metrics untrustworthy: 0
stress-ng: info:  [4563] successful run completed in 11.38 secs

Measure C-state residency:

stress-ng --intmath 0 -t 1m --c-states
stress-ng: info:  [6998] setting to a 1 min run per stressor
stress-ng: info:  [6998] dispatching hogs: 8 intmath
stress-ng: info:  [6998] intmath:
stress-ng: info:  [6998]  C0     99.98%
stress-ng: info:  [6998]  C1      0.00%
stress-ng: info:  [6998]  C1E     0.01%
stress-ng: info:  [6998]  C3      0.00%
stress-ng: info:  [6998]  C6      0.01%
stress-ng: info:  [6998]  C7s     0.00%
stress-ng: info:  [6998]  C8      0.00%
stress-ng: info:  [6998]  POLL    0.00%
stress-ng: info:  [6998] skipped: 0
stress-ng: info:  [6998] passed: 8: intmath (8)
stress-ng: info:  [6998] failed: 0
stress-ng: info:  [6998] metrics untrustworthy: 0
stress-ng: info:  [6998] successful run completed in 1 min

Bugs and regressions found with stress-ng

stress-ng has found various Kernel, QEMU bugs/regressions, and libc bugs; appropriate fixes have been landed to address these issues:

2015:

2016:

2017:

2018:

2019:

2020:

2021:

2022:

2023:

2024:

Kernel improvements that used stress-ng

2020:

2021:

2022:

2023:

2024:

Presentations

Citations

2015:

2016:

2017:

2018:

2019:

2020:

2021:

2022:

2023:

2024:

I am keen to add to the stress-ng project page any citations to research or projects that use stress-ng. I also appreciate information concerning kernel bugs or performance regressions found with stress-ng.

Contributors

Many thanks to the following contributors to stress-ng (in alphabetical order):

Abdul Haleem, Aboorva Devarajan, Adriand Martin, Adrian Ratiu, Aleksandar N. Kostadinov, Alexander Kanavin, Alexandru Ardelean, Alfonso Sánchez-Beato, Allen H, Amit Singh Tomar, Andrey Gelman, André Wild, Anisse Astier, Anton Eliasson, Arjan van de Ven, Baruch Siach, Bryan W. Lewis, Camille Constans, Carlos Santos, Christian Ehrhardt, Christopher Brown, Chunyu Hu, Daniel Andriesse, Daniel Hodges, Danilo Krummrich, Davidson Francis, David Turner, Denis Ovsienko, Dominik B Czarnota, Dorinda Bassey, Eder Zulian, Eric Lin, Erik Stahlman, Erwan Velu, Fabien Malfoy, Fabrice Fontaine, Fernand Sieber, Florian Weimer, Francis Laniel, Guilherme Janczak, Hui Wang, Hsieh-Tseng Shen, Iyán Méndez Veiga, James Hunt, Jan Luebbe, Jianshen Liu, Jimmy Ho, John Kacur, Jules Maselbas, Julien Olivain, Kenny Gong, Khalid Elmously, Khem Raj, Luca Pizzamiglio, Luis Chamberlain, Luis Henriques, Lukas Durfina, Matteo Italia, Matthew Tippett, Mauricio Faria de Oliveira, Maxime Chevallier, Max Kellermann, Maya Rashish, Mayuresh Chitale, Meysam Azad, Mike Koreneff, Munehisa Kamata, Myd Xia, Nick Hanley, Nikolas Kyx, Paul Menzel, Piyush Goyal, Ralf Ramsauer, Rosen Penev, Rulin Huang, Sascha Hauer, Sergey Matyukevich, Siddhesh Poyarekar, Shoily Rahman, Stian Onarheim, Thadeu Lima de Souza Cascardo, Thia Wyrod, Thinh Tran, Tim Gardner, Tim Gates, Tim Orling, Tommi Rantala, Witold Baryluk, Yiwei Lin, Yong-Xuan Wang, Zhiyi Sun.

About

This is the stress-ng upstream project git repository. 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.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Languages