In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to simulate the system load under Linux, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
System administrators usually need to explore the impact of different loads on application performance. This means that the load must be artificially created repeatedly. To simulate the system load can be achieved through special tools.
CPU
The following command creates a CPU load by compressing random data and sending the results to / dev/null:
Cat / dev/urandom | gzip-9 > / dev/null
If you want more load, or if the system has multiple cores, all you need to do is compress and decompress the data, like this:
Cat / dev/urandom | gzip-9 | gzip-d | gzip-9 | gzip-d > / dev/null
Press CTRL+C to terminate the process.
Memory footprint
The following command reduces the total amount of memory available. It is achieved by creating a file system in memory and writing files to it. You can use as much memory as you want, just write more files into it.
First, create a mount point, and then mount the ramfs file system:
Mkdir zmount-t ramfs ramfs z /
The second step is to create a file in this directory using dd. Here we create a 128m file:
Dd if=/dev/zero of=z/file bs=1M count=128
The size of the file can be modified by the following operators:
Bs= block size. It can be any number followed by B (for bytes), K (for KB), M (for MB), or G (for GB). How many blocks does count= have to write? Disk IPUBO
The way to create disk I _ par O is to create a file first, and then use the for loop to keep copying it.
The following uses the command dd to create a 1G file with all zeros:
Dd if=/dev/zero of=loadfile bs=1M count=1024
The following command performs 10 operations with a for loop. Loadfile is copied each time to overwrite loadfile1:
For i in {1... 10}; do cp loadfile loadfile1; done
Adjust the run time by modifying the second parameter in {1... 10}. (LCTT translation note: the default cp command used on your Linux system is likely to be an alias for cp-I, in which case overriding will prompt you to enter y to confirm, you can use the cp command with the-f argument to override this behavior, or directly with the / bin/cp command. )
If you want to keep running until you press CTRL+C to stop, run the following command:
While true; do cp loadfile loadfile1; done above is all the content of this article "how to simulate system load under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.