LinuxCommandLibrary

stress-ng

Stress test system components

TLDR

Stress all CPUs with 4 workers for 60 seconds

$ stress-ng [[-c|--cpu]] 4 [[-t|--timeout]] 60s
copy

Stress virtual memory with 2 workers for 30 seconds
$ stress-ng [[-m|--vm]] 2 --vm-bytes [512M] [[-t|--timeout]] 30s
copy

Stress the I/O subsystem with 3 workers for 45 seconds
$ stress-ng [[-i|--io]] 3 [[-t|--timeout]] 45s
copy

Run all stress tests for 2 minutes
$ stress-ng [[-a|--all]] [1] [[-t|--timeout]] 2m
copy

SYNOPSIS

stress-ng [OPTIONS]

PARAMETERS

--cpu
    Specifies the number of CPU stressors to run, consuming CPU cycles.

--vm
    Runs N virtual memory stressors, allocating and deallocating memory.

--io
    Starts N I/O stressors, performing various synchronous and asynchronous I/O operations.

--disk
    Activates N disk I/O stressors, writing and reading files to consume disk bandwidth.

--timeout s|m|h
    Sets a time limit for the stress test (e.g., 60s, 5m, 1h).

--metrics
    Displays metrics on the stressor performance at the end of the run.

--verbose
    Enables verbose output, showing more details about the stress test progress.

--all
    Runs all available stressors, each with N workers. Use with caution as it consumes significant resources.

--vm-bytes
    Specifies the amount of memory to allocate for each virtual memory stressor (e.g., 256M, 1G).

--hdd-bytes
    Sets the amount of data to write/read for each disk stressor (e.g., 10G).

DESCRIPTION

stress-ng is a comprehensive workload generator designed to stress test a wide range of Linux system components. It can apply configurable stress to the CPU, memory, disk I/O, networking, and various kernel subsystems. The tool aims to discover hardware flaws, operating system bugs, and performance bottlenecks under extreme load. Users can specify the type and intensity of stress using numerous options, allowing for highly targeted testing of specific system resources or complex, multi-component workloads. It provides a robust way to validate system stability, benchmark performance, and ensure reliability before deployment, making it invaluable for developers, system administrators, and quality assurance engineers. Its flexible design allows it to simulate real-world usage patterns or push systems to their absolute limits, helping identify weak points and improve system resilience.

CAVEATS

stress-ng can push system resources to their absolute limits, potentially leading to system instability, unresponsiveness, or even crashes. It's crucial to use it with caution, especially in production environments or on systems containing unsaved work. Always understand the type and intensity of stress being applied to avoid unexpected outages or data loss. High resource consumption is an intended outcome.

EXTENSIVE STRESSOR TYPES

Beyond basic CPU and memory, stress-ng offers hundreds of distinct stressors, including specific types of floating-point math, various I/O patterns, file system operations, process creation/destruction, context switching, locking mechanisms, and many more. This allows for highly targeted testing of very specific system behaviors and kernel components, making it a powerful diagnostic tool.

HISTORY

stress-ng was developed by Colin King as a modern and highly configurable successor to the simpler stress tool. Its development focused on providing a much wider array of stressors covering various system components, from CPU and memory to I/O, networking, and kernel subsystems. It aims to provide a robust framework for identifying hardware and software flaws under extreme load, continuously evolving to include new workload types and system testing capabilities.

SEE ALSO

stress(1), top(1), iostat(1)

Copied to clipboard