In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to stress test the Linux system. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Why would you want to put pressure on your Linux system? Because sometimes you may wonder how a system performs when it is under a lot of stress due to a large number of running processes, heavy network traffic, excessive memory use, and so on. This stress test can help ensure that the system is ready to go public.
If you need to predict how long it may take for the application to respond, and which, if any, processes may fail under heavy loads or run slowly, then stress testing in the early stages is a very good idea.
Fortunately, for those who need to be able to predict the response of Linux systems to stress, you can use some useful techniques and tools to make this process easier. In this article, we will study some of them.
Make a cycle by yourself
The first technique is to run some loops on the command line to observe their impact on the system. This method can greatly increase the load of CPU. You can easily see the results using uptime or similar commands.
In the following command, we start four endless loops. You can increase the number of loops by adding numbers or using bash expressions such as {1. 6} instead of 1, 2, 3, 4:
For i in 1 2 34; do while:; do:; done & done
After you type on the command line, four endless loops are started in the background:
$for i in 12 34; do while:; do:; done & done [1] 205012 [2] 205013 [3] 205014 [4] 205015
In this case, job 1-4 is initiated, and the job number and process number are displayed accordingly.
To observe the effect on the average load, use the command shown below. In this example, the uptime command runs every 30 seconds:
$while true; do uptime; sleep 30; done
If you plan to run such tests on a regular basis, you can put loop commands into the script watch-it.
#! / bin/bash while truedo uptime sleep 30done
In the output, you can see how the average load increases, and then starts to fall again at the end of the cycle.
11:25:34 up 5 days, 17:27, 2 users, load average: 0.15, 0.14, 0.08 11:26:04 up 5 days, 17:27, 2 users, load average: 0.09, 0.12, 0.08 11:26:34 up 5 days, 17:28, 2 users, load average: 1.42, 0.43, 0.18 11:27:04 up 5 days, 17:28, 2 users, load average: 2.50, 0.79 0.31 11:27:34 up 5 days, 17:29, 2 users, load average: 3.09, 1.10, 0.43 11:28:04 up 5 days, 17:29, 2 users, load average: 3.45, 1.38, 0.54 11:28:34 up 5 days, 17:30, 2 users, load average: 3.67, 1.63, 0.66 11:29:04 up 5 days, 17:30, 2 users, load average: 3.80, 1.86 0.76 11:29:34 up 5 days, 17:31, 2 users, load average: 3.88, 2.06, 0.87 11:30:04 up 5 days, 17:31, 2 users, load average: 3.93, 2.25, 0.97 11:30:34 up 5 days, 17:32, 2 users, load average: 3.64, 2.35 1.04 COMMAND 269308 be/4 root 0.00 BUnix 0.00 BUnip 0.00% 1.24% [kworker~fficient] 283 be/3 root 0.00 BUnip 0.00% 0.26% [jbd2/sda1-8]
After that:
Total DISK READ: 0.00 Total DISK WRITE | Total DISK WRITE: 0.00 B/sCurrent DISK READ: 0.00 be/4 shs | Current DISK WRITE: 0.00B TID PRIO USER DISK READ DISK WRITE SWAPIN IO > COMMAND 270983 be/4 shs 0.00B TID PRIO USER DISK READ DISK WRITE SWAPIN IO 0.00% 51.45% stress-- io 4 270984 be/4 shs 0.00B / S 0.00 Bhand s 0.00% 51.36% stress-- io 4 270985 be/4 shs 0.00 Bhand s 0.00% 50.95% stress-- io 4 270982 be/4 shs 0.00 Bhand s 0.00% stress-- io 4 269308 be/4 root 0.00 Bhand s 0.00% 0.09% [kworker~fficient]
Stress is just one of several tools to put pressure on the system. Another newer tool, stress-ng, will be introduced in a future article.
This is the end of the article on "how to stress test the Linux system". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.