What is stress?
stress
is a linux
under pressure testing tool specifically for those who want to test their systems, fully loaded and supervised by these devices running users.
Installation Method One
Upload and unzip the stress installation package to the/USR/LOCAL/SRC path of the Linux server,
Perform:tar -xf stress_1.0.1.orig.tar.gz
Enter the stress-1.0.1 folder after decompression,
Input:./configure
Configured, if the configuration fails and prints no acceptable c compiler found in path
,
Indicates that no GCC compilation environment is available, enter an 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.
Way Two
Need to have a epel
source
aliyun
the source that can be used epel
Perform:wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
Can be used directly:yum install stress -y
User Guide
The first step is to set up a test directory for the files to be written to.
stress
The main parameters of the description (-to be followed by an underscore,--that is, followed by 2 underline, 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.
Examples of test scenarios
1. Test CPU Load
Enter the command:stress –c 4
4 Additional CPU processes, processing sqrt () function functions to increase system CPU load
2. Memory test
Enter the 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
Enter the command:stress –d 1 --hdd-bytes 3G
1 new write processes, each writing 3G file block
4, hard drive test (do not delete)
Enter the command:stress –i 1 –d 10 --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.
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
top
after input, sort by uppercase p, sorted 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 10
view, if not the file, to yum install systat
install.
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 vmstat -1
the 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, it should 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
- To view memory usage:
free
- To view system processes:
ps aux
- Print Network connection Status:
netstat –an
- Print which ports the current system launches:
netstat –lnp
- View the disk usage and location where the file system is mounted:
df –lh
Llinux under Stress pressure test tool