• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to monitor high CPU load stress test using stress ng tool

156

To monitor high CPU load stress test using stress ng tool

In this article we will discuss how to monitor the stress of high load and also we will look through two important tools like stress and stress ng tool.

Stress is a tool to configure measure of CPU memory, Input output and disk stress.

Stress ng tool is the latest version of stress which helps to test the system features like VM stress, process creation and termination, CPU compute, Pipe I/O, switching properties etc.

These tools should be used with root privileges.

To install stress Tool

On Debian and its derivatives

[root@netaxis-virtual-machine:~]# apt-get install stress
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
stress
...
...
Processing triggers for install-info (6.0.0.dfsg.1-3) ...
Setting up stress (1.0.4-1) ...

Stress option argument

Options
cpu N is used to spawn N workers spinning on sqrt() function
vm-bytes N is used to allocate memory per vm worker
-v is used to show more detailed information when running stress
timeout N is used to set a timeout after N seconds
vm-hang N is used to set sleep to N seconds before freeing memory
vm-keep is used to reallocate memory resources
io N is used to spawn N workers spinning on sync() function
help is used to view manpage and options of stress

To examine effect of the command

The uptime command is used to examine the effect of the command and the average load

[root@netaxis-virtual-machine:~]# uptime
[root@netaxis-virtual-machine:~]# stress --cpu 8 --timeout 20
[root@netaxis-virtual-machine:~]# uptime
01:19:58 up 2:38, 2 users, load average: 0.07, 0.15, 0.10

[root@netaxis-virtual-machine:~]# stress --cpu 8 --timeout 20
stress: info: [23558] dispatching hogs: 8 cpu, 0 io, 0 vm, 0 hdd
stress: info: [23558] successful run completed in 20s

[root@netaxis-virtual-machine:~]# uptime
01:24:40 up 2:43, 2 users, load average: 0.06, 0.32, 0.22

To spwan 8 workers spinning on sqrt() with a timeout of 30 seconds

[root@netaxis-virtual-machine:~]$ uptime
[root@netaxis-virtual-machine:~]$ sudo stress --cpu 8 -v --timeout 30s
[root@netaxis-virtual-machine:~]$ uptime
01:26:01 up 2:44, 2 users, load average: 0.01, 0.24, 0.20

[root@netaxis-virtual-machine:~]# stress --cpu 8 -v --timeout 30s
stress: info: [23574] dispatching hogs: 8 cpu, 0 io, 0 vm, 0 hdd
stress: dbug: [23574] using backoff sleep of 24000us
stress: dbug: [23574] setting timeout to 30s
stress: dbug: [23574] -->  hogcpu worker 8 [23575] forked
stress: dbug: [23574] using backoff sleep of 21000us
stress: dbug: [23574] setting timeout to 30s
stress: dbug: [23574] -->  hogcpu worker 7 [23576] forked
stress: dbug: [23574] stress: info: [23574] successful run completed in 30s
[root@netaxis-virtual-machine:~]# uptime
01:27:34 up 2:46, 2 users, load average: 2.30, 0.92, 0.44

To spwan one worker of malloc() and free() functions

[root@netaxis-virtual-machine:~]$ uptime
[root@netaxis-virtual-machine:~]$ sudo stress --vm 1 --timeout 60s
[root@netaxis-virtual-machine:~]$ uptime
01:28:38 up 2:47, 2 users, load average: 0.90, 0.78, 0.43

[root@netaxis-virtual-machine:~]# stress --vm 1 --timeout 60s
stress: info: [23589] dispatching hogs: 0 cpu, 0 io, 1 vm, 0 hdd
stress: info: [23589] successful run completed in 60s

[root@netaxis-virtual-machine:~]# uptime
01:30:32 up 2:49, 2 users, load average: 0.79, 0.76, 0.45

To spwan 4 workers spinning on sqrt(), 2 workers spwaning on sync(), 2 workers on malloc()/free()

[root@netaxis-virtual-machine:~]$ uptime
[root@netaxis-virtual-machine:~]$ stress --cpu 4 --io 3 --vm 2 --vm-bytes 256M --timeout 20s
[root@netaxis-virtual-machine:~]$ uptime
01:31:37 up 2:50, 2 users, load average: 0.27, 0.61, 0.42
[root@netaxis-virtual-machine:~]# stress --cpu 4 --io 3 --vm 2 --vm-bytes 256M --timeout 20s
stress: info: [23594] dispatching hogs: 4 cpu, 3 io, 2 vm, 0 hdd
stress: info: [23594] successful run completed in 20s

[root@netaxis-virtual-machine:~]# uptime
01:34:01 up 2:52, 2 users, load average: 1.42, 0.82, 0.52

To Install stress ng Tool

[root@netaxis-virtual-machine:~]# apt-get install stress-ng
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
stress-ng tool
..
..
Processing triggers for man-db (2.7.4-1)
Setting up stress-ng (0.04.20-1)

Syntax
stress-ng option argument

Options
all N is used to start N instances of stress ng tool test
cpu N is used to start N processes to exercises the CPU
cpu-method is used to give CPU stress testing method
cpu-ops N is used to stop CPU stress process after N bogo operations
io N is used to start N I/O stress testing processes
io-ops N is used to stop io stress processes after N bogo operations
vm N is used to start N vm stress ng tool testing processe
vm-bytes N is used to specify amount of memory per vm process
vm-ops N is used to stop vm stress processes after N bogo operations
hdd N is used to to start N hard disk exercising processes.
hdd-ops N is used to stop hdd stress processes after N bogo operations
timeout N is used to set a timeout after N seconds
metrics or metrics-brief is used to generate a summary report after bogo operations
dir N is used to start N processes that will create and remove directories using mkdir and rmdir
dir-ops N is used to stop directory operations processess
nice N is used to start N CPU consuming processes
nice-ops N is used to stop nice loops
chmod N is used to start N processes that change the file mode bits via chmod(2) and fchmod(2) on the same file
chmod-ops N is used to stop chmod operations
v is used to to display more information
h is used to view help for stress ng tool

To run 8 CPU stressors with a timeout of 60 seconds

[root@netaxis-virtual-machine:~]#uptime
[root@netaxis-virtual-machine:~]# sudo stress-ng --cpu 8 --timeout 60 --metrics-brief
[root@netaxis-virtual-machine:~]# uptime
01:38:27 up 2:57, 2 users, load average: 0.14, 0.42, 0.42
[root@netaxis-virtual-machine:~]# stress-ng --cpu 8 --timeout 60 --metrics-brief
stress-ng: info: [24074] dispatching hogs: 8 cpu
stress-ng: info: [24074] successful run completed in 60.42s (1 min, 0.42 secs)
stress-ng: info: [24074] stressor bogo ops real time usr time sys time bogo ops/s bogo ops/s
stress-ng: info: [24074] (secs) (secs) (secs) (real time) (usr+sys time)
stress-ng: info: [24074] cpu 13512 60.38 60.02 0.00 223.78 225.12
[root@netaxis-virtual-machine:~]# uptime
01:41:48 up 3:00, 2 users, load average: 1.58, 1.36, 0.80

To run 5 hdd stressors and stop after 100000 bogo operations

[root@netaxis-virtual-machine:~]# uptime
[root@netaxis-virtual-machine:~]# sudo stress-ng --hdd 5 --hdd-ops 100000
[root@netaxis-virtual-machine:~]# uptime
01:42:25 up 3:01, 2 users, load average: 0.88, 1.21, 0.77
[root@netaxis-virtual-machine:~]# stress-ng --hdd 5 --hdd-ops 100000
stress-ng: info: [24090] defaulting to a 86400 second run per stressor
stress-ng: info: [24090] dispatching hogs: 5 hdd
stress-ng: info: [24090] successful run completed in 120.85s (2 mins, 0.85 secs)
[root@netaxis-virtual-machine:~# uptime
01:46:18 up 3:04, 2 users, load average: 1.88, 2.39, 1.40

To run 8 CPU stressors, 4 I/O stressors and 1 virtual memory stressor

[root@netaxis-virtual-machine:~]# uptime
[root@netaxis-virtual-machine:~]# sudo stress-ng --cpu 4 --io 4 --vm 1 --vm-bytes 1G --timeout 60s --metrics-brief
[root@netaxis-virtual-machine:~]# uptime
01:46:18 up 3:04, 2 users, load average: 1.88, 2.39, 1.40

[root@netaxis-virtual-machine:~]# stress-ng --cpu 4 --io 4 --vm 1 --vm-bytes 1G --timeout 60s --metrics-brief
stress-ng: info: [24099] dispatching hogs: 4 cpu, 4 iosync, 1 vm
stress-ng: info: [24099] successful run completed in 60.27s (1 min, 0.27 secs)
stress-ng: info: [24099] stressor bogo ops real time usr time sys time bogo ops/s bogo ops/s
stress-ng: info: [24099] (secs) (secs) (secs) (real time) (usr+sys time)
stress-ng: info: [24099] cpu 5691 60.12 25.39 0.01 94.66 224.06
stress-ng: info: [24099] iosync 258708 60.04 0.00 25.51 4308.86 10141.43
[root@netaxis-virtual-machine:~]# uptime
01:49:35 up 3:08, 2 users, load average: 3.34, 2.87, 1.74

Tags:
noah
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

how to install "stress ng tool" in free bsd os?

A

Use the given command to install the tress ng tool in "free bsd"
"pkg install stress"

Q

Which option is used to stop the directory operation in stress ng tool?

A

"dir-ops N" is helping to stop directory operations processess in stress ng tool

Q

how to get more options in stress ng tool?

A

Use help option, it helps to use stress ng tool more effectively.

Q

How do i stop nice loop?

A

You can use the following option for stop the nice loop in stress ng tool
"nice-ops N "

Q

How to generate the summary report in stress ng tool?

A

"metrics or metrics-brief" option can helps to generate the summary report in stress ng tool.

Related Tutorials in How to monitor high CPU load stress test using stress ng tool

Related Tutorials in How to monitor high CPU load stress test using stress ng tool

How to monitor high CPU load stress test using stress ng tool
How to monitor high CPU load stress test using stress ng tool
Mar 25, 2016
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Isaiah ?
What is the use of SUID & SGID commands

How to set the special permissions to the files and folders using SUID and SGID commands...

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.