First, what is stress?
Stress is a Linux stress testing tool designed for users who want to test their systems, fully load and supervise those devices running.
Second, installation
Upload and unzip the stress installation package to the/USR/LOCAL/SRC path of the Linux server, and the decompression command is: TAR–XZPVF stress_1.0.1.orig.tar.gz
Enter the extracted stress-1.0.1 folder, enter the./configure configuration, if the configuration fails, and print "no acceptable C compiler found in path" means no GCC compilation environment is available, enter yum–y Install GCC automatic download installation.
When the configuration is complete, enter
At this point, the stress is complete, and the command line prints the prompt for the successful installation of stress.
Third, the use of the guide
The first step is to set up a test directory for the files to be written to.
Stress each main parameter description (-to indicate followed by an underscore,--to indicate that followed by 2 underscores, can be used for stress after the parameters, different expressions):
-?
--HELP Display Help information
--version displaying software version information
-T secs:
--timeout secs Specify how many seconds to run
--backoff Usecs waits Usecs microseconds before it starts running
-C Forks:
--CPU forks produces multiple CPU processes that handle sqrt () functions
-M forks
--VM forks: Produces multiple processes that process malloc () memory allocation functions, followed by the number of processes
-I. Forks
--io forks: Generating multiple disk I/O processes that handle the sync () function
--vm-bytes bytes: Specifies the byte number of memory, the default value is 1
--vm-hang: Indicates how long the memory allocated by malloc was freed after free ()
-D:
--HDD: Write process, write fixed size, write to current directory via Mkstemp () function
--hdd-bytes Bytes: Specifies the number of bytes written, default 1G
--hdd-noclean: Do not write random ASCII data to a file unlink, the written file is not deleted and will remain on hard disk space.
Iv. Examples of test scenarios
- Test CPU Load
Input command: Stress–c 4
4 Additional CPU processes, processing sqrt () function functions to increase system CPU load
2. Memory test
Input command: stress–i 4–vm 10–vm-bytes 1g–vm-hang 100–timeout 100s
Added 4 IO processes, 10 memory allocation process, each allocation size 1G, not released after allocation, test 100S
3. Disk I/O test
Input command: stress–d 1--hdd-bytes 3G
1 new write processes, each writing 3G file block
4, hard drive test (do not delete)
Input command: stress–i 1–d--hdd-bytes 3g–hdd-noclean
A new 1 IO process, 10 write processes, each write 3G file block, and do not clear, will gradually run out of hard disk.
Five, server performance monitoring under Linux
- Top Monitor overall usage
Each parameter has the following meanings:
Load average: The average of the current system load, followed by 3 values of 1 minutes, 5 minutes, and 15 minutes before the average of the process. It is generally assumed that this number exceeds the number of CPUs, and the CPU will be more laborious to load the processes contained in the current system.
Represents several parameters of the CPU:
US: User space consumes CPU percentage
SY: CPU percent of kernel space occupied
NI: CPU percentage of processes that have changed priority in user process space
ID: Percentage of idle CPU
WA: Percentage of CPU time waiting for input and output
After entering top, press upper case p, sort by CPU size, press M, sort by memory footprint
From the application's point of view, available memory = System free memory+buffers+cached, where buffers/cached is designed to improve file read performance, buffer/cached is quickly recycled when the application uses memory
- Server I/o read/write load evaluation
With top view, the value of WA identifies the percentage of CPU time consumed by I/O waits, which is higher than the I/O pressure at 30%.
Then use iostat–x 1 to view, if not the file, to yum install systat installation. View%util,%idle, if the%util close to 100%, indicating that the resulting I/O request too much, i/0 system is full load, the disk may be a bottleneck,%idle less than 70%,i/0 pressure is relatively large, general reading speed has more waiting.
In conjunction with the vmstat-1 command, look at the B parameter, indicating the number of processes waiting for the resource, such as waiting for I/O, memory, etc., as usual time >1, then be concerned. I/o read/write load can be evaluated.
- Daily management of other systems
To view the number of CPUs in the system:cat/proc/cpu Info
Monitor the system status to see where the pressure is:vmstat
Proc column displays process-related information
R indicates the number of processes running and waiting for CPU time slices, such as the number of long-term > server CPUs, indicating that the CPU is not enough
Swap indicates memory exchange condition
View memory usage: Free
View System process:PS aux
Print network connection Status:netstat–an
Print which ports the current system launches:NETSTAT–LNP
View disk usage and file system mounted location:DF–LH
Linux Stress test software Stress installation and use guide