Skip to main content

Linux stress command---stress test

Linux stress command---stress test

1. Usage scenarios

CPU stress test

Memory stress test

Disk IO test

Swap usability testing

2. Syntax and common parameters

stress [options] [number of processes]

-?, --help: Display help information

--version: display version information

-v, --verbose: verbose output

-q, --quiet: silent output

-t, --timeout: Exit after N seconds

--backoff: wait N microseconds to start work signing

-c, --cpu N: simulate the number of CPU usage

-i, --io N: simulate I/O and write the data in the memory buffer to disk immediately

-m, --vm N: Simulate N processes frequently calling/releasing memory

--vm-bytes B: Specify the size of memory allocated in each process (used with -m)

--vm-keep: Keep occupying memory instead of calling/releasing in a loop (used with -m)

-d, --hdd N: simulate disk writing (create files, write content, delete files)

--hdd-bytes N: Specify the write file size, the default is 1GB (used with -d)

Linux stress command---stress test

3. Commonly used commands

  • CPU stress test

stress –c 4 # Start 4 CPU processes

Linux stress command---stress test

Linux stress command---stress test

  • Memory stress test & Swap usability test

stress --vm 3 --vm-bytes 1G --vm-hang 100 --timeout 100s #Start 5 processes, allocate 3G memory, do not release it after allocation, last 100s

Linux stress command---stress test

Linux stress command---stress test

Linux stress command---stress test

  • Disk I/O test

stress –d 3 --hdd-bytes 3G # Start 3 writing processes and write 3G file blocks each time

Linux stress command---stress test

Linux stress command---stress test