NAME¶
stress-ng - a tool to load and stress a computer system.
SYNOPSIS¶
stress-ng [
OPTION [
ARG]] ...
DESCRIPTION¶
stress-ng will stress test a computer system in various selectable ways.
OPTIONS¶
- -?, -h, --help
- show help.
- --affinity N
- start N processes that rapidly change CPU affinity (only on Linux).
Rapidly switching CPU affinity can contribute to poor cache
behaviour.
- --affinity-ops N
- stop affinity processes after N bogo affinity operations (only on
Linux).
- -a N, --all N
- start N instances of each stress test.
- -b N, --backoff N
- wait N microseconds between the start of each stress process. This allows
one to ramp up the stress tests over time.
- -c N, --cpu N
- start N processes computing sqrt((double)rand()). Note that the rand
function is based on a fast integer RNG with a period of about 2^60.
- --cpu-ops N
- stop cpu stress processes after N bogo operations.
- -l P, --cpu-load P
- load CPU with P percent loading. 0 is effectivly a sleep (no load) and 100
is full loading. The loading loop is broken into compute time (load%) and
sleep time (100% - load%). Accuracy depends on the overall load of the
processor and the responsiveness of the scheduler, so the actual load may
be different from the desired load. Note that the number of bogo cpu
operations may not be linearly scaled with the load as some systems employ
CPU frequency scaling and so heavier loads produce an increased CPU
frequency and greater CPU bogo operations.
- -C N, --cache N
- start N processes that perform random wide spread memory read and writes
to thrash the CPU cache. The code does not intelligently determine the CPU
cache configuration and so it may be sub-optimal in producing hit-miss
read/write activity for some processors.
- --cache-ops N
- stop cache thrash processes after N bogo cache thrash operations.
- -n, --dry-run
- parse options, but don't run stress tests. A no-op.
- -D N, --dentry N
- start N processes that create and remove directory entries. This should
create meta data activity.
- --dentry-ops N
- stop denty thrash processes after N bogo dentry operations.
- --dentries N
- create N dentries per dentry thrashing loop, default is 2048.
- -d N, --hdd N
- start N processes continually writing and removing temporary files.
- --hdd-bytes N
- write N bytes for each hdd process, the default is 1 GB.
- --hdd-noclean
- do not remove files created by hdd processes.
- --hdd-ops N
- stop hdd stress processes after N bogo operations.
- -F N, --fallocate N
- start N processes continally fallocating (preallocating file space) and
ftuncating (file truncating) temporary files.
- --fallocate-ops N
- stop fallocate stress processes after N bogo fallocate operations.
- -f N, --fork N
- start N processes continually forking children that immediately exit.
- --fork-ops N
- stop fork stress processes after N bogo operations.
- --flock N
- start N processes locking on a single file.
- --flock-ops N
- stop flock stress processes after N bogo flock operations.
- --float N
- start N processes executing various double precision floating point
operations.
- --float-ops N
- stop floating point stress processes after N bogo operations.
- --int N
- start N processes executing various 64 bit integer operations.
- --int-ops N
- stop integer stress processes after N bogo operations.
- -i N, --io N
- start N processes continuously calling sync() to commit buffer cache to
disk. This can be used in conjunction with the --hdd options.
- --io-ops N
- stop io stress processes after N bogo operations.
- --ionice-class class
- specify ionice class (only on Linux). Can be idle (default), besteffort,
be, realtime, rt.
- --ionice-level level
- specify ionice level (only on Linux). For idle, 0 is the only possible
option. For besteffort or realtime values 0 (hightest priority) to 7
(lowest priority). See ionice(1) for more details.
- -k, --keep-name
- by default, stress-ng will attempt to change the name of the stress
processes according to their functionality; this option disables this and
keeps the process names to be the name of the parent process, that is,
stress-ng.
- --metrics
- output number of bogo operations in total performed by the stress
processes. Note that these are not a reliable metric of performance or
throughput and have not been designed to be used for benchmarking
whatsoever. The metrics are just a useful way to observe how a system
behaves when under various kinds of load.
- -m N, --vm N
- start N processes continuously calling mmap()/munmap() and writing to the
allocated memory. Note that this can cause systems to trip the kernel OOM
killer on Linux systems if not enough physical memory and swap is not
available.
- --vm-bytes N
- mmap N bytes per vm process, the default is 256MB. One can specify the
size in units of Bytes, KBytes, MBytes and GBytes using the suffix b, k, m
or g.
- --vm-stride N
- write to every Nth byte, the default is every page (4096 bytes). One can
specify the size in units of Bytes, KBytes, MBytes and GBytes using the
suffix b, k, m or g.
- --vm-ops N
- stop vm stress processes after N bogo operations.
- --vm-hang N
- sleep N seconds before unmapping memory, the default is zero seconds.
Specifying 0 will do an infinite wait.
- --vm-keep
- don't continually unmap and map memory, just keep on re-writing to
it.
- --vm-locked
- Lock the pages of the mapped region into memory using mmap MAP_LOCKED
(since Linux 2.5.37). This is similar to locking memory as described in
mlock(2).
- --vm-populate
- populate (prefault) page tables for the memory mappings; this can stress
swapping. Only available on systems that support MAP_POPULATE (since Linux
2.5.46).
- -o N, --open N
- start N processes that perform open() and then close() operations on
/dev/zero. The maximum opens at one time is system defined, so the test
will run up to this maximum, or 65536 open file descriptors, which ever
comes first.
- --open-ops N
- stop the open stress processes after N bogo open operations.
- -p N, --pipe N
- start N stressors that perform large pipe writes and reads to exercise
pipe I/O. This exercises memory write and reads as well as context
switching. Each stressor has two processes, a reader and and writer.
- --pipe-ops N
- stop pipe stress processes after N bogo pipe write operations.
- -P N, --poll N
- start N processes that perform zero timeout polling via the poll(),
select() and sleep() system calls. This wastes system and user time doing
nothing.
- --poll-ops N
- stop poll stress processes after N bogo poll operations.
- -q, --quiet
- don't show any output.
- -r N, --random N
- start N random stress processes.
- --sem N
- start N processes that perform POSIX semaphore wait and post operation.
This stresses fast semaphore operations and produces rapid context
switching.
- --sem-ops N
- stop semaphore stress processes after N bogo semaphore operations.
- --sigq N
- start N processes that rapidly send SIGUSR1 signals using sigqueue() to
child processes that wait for the signal via sigwaitinfo().
- --sigq-ops N
- stop sigq stress processes after N bogo signal send operations.
- --sched scheduler
- select the named scheduler (only on Linux). To see the list of available
schedulers use: stress-ng --sched which
- --sched-prio prio
- select the scheduler priority level (only on Linux). If the scheduler does
not support this then the default priority level of 0 is chosen.
- -S N, --sock N
- start N stressors that perform various socket stress activity. This
involves a pair of client/server processes performing rapid connect, send
and receives and disconnects on the local host.
- --sock-port P
- start at socket port P. For N socket worker processes, ports P to P - 1
are used.
- --sock-ops N
- stop socket stress processes after N bogo operations.
- -s N, --switch N
- start N processes that send messages via pipe to a child to force context
switching.
- --switch-ops N
- stop context switcing processes after N bogo operations.
- -t N, --timeout N
- stop stress test after N seconds. One can also specify the units of time
in seconds, minutes, hours, days or years with the suffix s, m, h, d or
y.
- -T N, --timer N
- start N processes creating timer events at a default rate of 1Mhz (Linux
only); this can create a lot of timer clock interrupts.
- --timer-ops N
- stop timer stress processes after N bogo timer events (Linux only).
- --timer-freq F
- run timers at F Hz; range from 1000 to 1000000000 Hz (Linux only). By
selecting an appropriate frequency stress-ng can generate hundreds of
thousands of interrupts per second.
- -u N, --urandom N
- start N processes reading /dev/urandom (Linux only). This will load the
kernel random number source.
- --urandom-ops N
- stop urandom stress processes after N urandom bogo read operations (Linux
only).
- -v, --verbose
- show all debug, warnings and normal information output.
- -V, --version
- show version.
- -y N, --yield N
- start N process that call sched_yield(). This should force rapid context
switching.
- --yield-ops N
- stop yield stress processes after N sched_yield() bogo operations.
Examples:
stress-ng --cpu 4 --io 2 --vm 1 --vm-bytes 256M --timeout 60s
stress-ng --cpu 8 --cpu-ops 800000
stress-ng --cpu 4 --io 2 --timeout 60s --metrics
stress-ng --fork 4 --fork-ops 100000
stress-ng --all 4 --timeout 5m
stress-ng --random 64
SEE ALSO¶
stress(1),
ionice(1),
sched_yield(2),
sched_setaffinity(2),
fallocate(2),
ftruncate(2),
flock(2),
ioprio_set(2).
AUTHOR¶
stress-ng was written by Colin King <colin.king@canonical.com> and is a
clean room implementation of the original stress tool by Amos Waterland
<apw@rossby.metr.ou.edu>. Note that the stress-ng cpu, io, vm and hdd
tests are different implementations of the original stress tests and hence may
produce different stress characteristics.
This manual page was written by Colin King <colin.king@canonical.com>, for
the Ubuntu project (but may be used by others).