LinuxCommandLibrary

stress

Stress test system resources

TLDR

Spawn 4 workers to stress test CPU

$ stress [[-c|--cpu]] [4]
copy

Spawn 2 workers to stress test IO and timeout after 5 seconds
$ stress [[-i|--io]] [2] [[-t|--timeout]] [5]
copy

Spawn 2 workers to stress test memory (each worker allocates 256M bytes)
$ stress [[-m|--vm]] [2] --vm-bytes [256M]
copy

Spawn 2 workers spinning on write()/unlink() (each worker writes 1G bytes)
$ stress [[-d|--hdd]] [2] --hdd-bytes [1GB]
copy

SYNOPSIS

stress [OPTIONS]

PARAMETERS

-c, --cpu N
    Spawn N workers spinning on sqrt().

-i, --io N
    Spawn N workers doing sync().

-m, --vm N
    Spawn N workers doing malloc()/free().

--vm-bytes B
    Allocate B bytes per vm worker. Default is 256MB.

--vm-keep
    Keep vm workers from freeing memory.

--vm-hang N
    Hang vm workers for N seconds before freeing memory.

--vm-method METHOD
    Specify the method to stress the memory. Supported: all, fft, memcopy.

-d, --hdd N
    Spawn N workers doing write()/unlink().

--hdd-bytes B
    Write B bytes per hdd worker. Default is 1GB.

-t, --timeout T
    Run stress test for T seconds.

-n, --dry-run
    Show what the command would do without actually running it.

-q, --quiet
    Suppress all output.

-v, --verbose
    Be verbose.

--version
    Show version information.

-h, --help
    Show this help message.

DESCRIPTION

The stress command is a workload generator designed to subject a system to intensive CPU, memory, I/O, and disk activity. It's primarily used for benchmarking, hardware testing, and identifying system stability issues under heavy load. It can simulate various stress scenarios, such as high CPU usage, memory allocation and deallocation, disk reads/writes, and process creation. It allows for configurable parameters to adjust the intensity and duration of the stress tests, enabling users to pinpoint bottlenecks and potential failure points in their systems. Using stress can help ensure that a system can handle anticipated peak loads and maintain performance under pressure. It can also be helpful for testing cooling systems and monitoring system resource consumption when a system is under duress.

CAVEATS

stress can severely impact system performance and potentially lead to crashes if not used carefully. It is recommended to run it in a controlled environment and monitor system resources closely.

EXIT STATUS

stress returns 0 if it exited normally, and a non-zero value if it encountered an error.

SIGNALS

You can stop stress by sending it SIGINT (Ctrl+C) or SIGTERM.

SEE ALSO

top(1), vmstat(8), mpstat(1), iostat(1)

Copied to clipboard