In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to explain the common Linux performance testing commands, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can get something.
1 、 uptime
[root@smgsim02 ~] # uptime
15:08:15 up 98 days, 4:19, 2 users, load average: 0.07, 0.29, 0.14
The current time the system has been running since how many users have logged in to the current system is 1 minute, 5 minutes, and the load situation since 15 minutes ago.
Load average is the average queue length and the number of processes waiting for execution in the queue
The lower the value, the more likely the process is to be processed by CPU immediately. On the contrary, the higher the value is, the more likely the process is to block.
This command checks whether the server load is high.
2 、 top
Show the actual usage of CPU
The first line of top is the content of the uptime command
Line 2: process information
Tasks: 71 Total number of total processes
2 the number of processes that running is running
Number of processes in 69 sleeping sleep
Number of processes stopped by 0 stopped
0 zombie number of zombie processes
Line 3: CPU information
Cpu (s): percentage of CPU occupied by 4.8%us user space
Percentage of 6.9%sy kernel space occupied by CPU
Percentage of CPU occupied by processes that have changed priority in 0.0%ni user process space
Percentage of 87.2%id idle CPU
Percentage of CPU time 0.0%wa waits for input and output
1.1% hi
0.0% si
Line 4: physical memory information
Mem: 255102k total total physical memory
Total physical memory used by 253572k used
1548k free total free memory
Amount of memory used as kernel cache by 13576k buffers
Line 5: exchange area information
Swap: total number of 522104k total exchange areas
Total number of switching areas used by 9892k used
Total free exchange area of 512212k free
The total number of swap areas of 34120k cached buffer.
The contents of the memory are swapped out to the swap area, and then swapped into memory, but the used swap area has not been overwritten, and this value is the size of the swap area where these contents already exist in memory. When the corresponding memory is swapped out again, there is no need to write to the swap area.
Process information area:
The details of each process are displayed at the bottom of the statistics area. First of all, let's understand the meaning of each column.
Serial number column name meaning
PID process id
PPID parent process id
RUSER Real user name
User id of the UID process owner
User name of the owner of the USER process
Group name of the owner of the GROUP process
The terminal name of the TTY startup process. Processes that are not started from the terminal are displayed as?
PR priority
NI nice value, negative value indicates high priority, positive value indicates low priority
P the last use of CPU makes sense only in a multi-CPU environment
VIRT: the total amount of virtual memory used by the process, in kb, VIRT=SWAP+RES
RES: the amount of unswapped physical memory used by a process, in kb, also known as resident memory, RES=CODE+DATA
SHR: the amount of shared memory in kb, that is, the amount of memory shared by this process and other processes
% MEM: percentage of physical memory used by the process
Total cpu time used by the TIME+: process (in 1max 100s)
COMMAND: command name / Lin
% percentage of time spent by CPU from last update to present CPU
SWAP: the size that has not been swapped out in the virtual memory used by the process (kb)
CODE: the amount of physical memory occupied by executable code
DATA: the amount of physical memory occupied by parts other than executable code (data segment + stack) (kb)
Number of nFLT page errors
The number of pages that nDRT has modified since it was last written.
STAT: state of the process: s = dormant state, R = running state, T = stopped state, D = interrupted hibernation state, Z = zombie state
WCHAN displays the name of the system function in sleep if the process is sleeping
Flags task flag, refer to sched.h
SIZE: the amount of memory consumed by the process (code + data + stack)
Amount of physical memory used by the RSS; process
Badness=oom_score (bandness)
Adj=oom_adjustment
After entering the top command, you can continue to press the f key to select the display columns that need to be added
The f key allows you to select what is displayed. Press the f key to display the list of columns, press amurz to show or hide the corresponding columns, and finally press enter to determine.
Press o to change the order in which the columns are displayed. Press lowercase Amurz to move the corresponding column to the right, and uppercase Amurz to move the corresponding column to the left. Finally, press the enter key to confirm.
Press the uppercase F or O key, and then press amurz to sort the processes by the corresponding columns. The uppercase R key reverses the current sort.
The top command parameters explain:
Top [-] [d] [p] [Q] [c] [C] [S] [s] [n]
D specifies the time interval between every two screen information refreshes. Of course, the user can use the s interactive command to change it.
P monitors only the status of a process by specifying the monitoring process ID.
Q this option will allow top to refresh without any delay. If the caller has superuser privileges, top will run at the highest possible priority.
S specifies the cumulative mode
S causes the top command to run in safe mode. This removes the potential danger of interactive commands.
I make top not show any idle or dead processes.
C displays the entire command line instead of just the command name
Here are some interactive commands that can be used during the execution of the top command. From a usage point of view, proficiency in these commands is more important than options. These commands are single-letter, and if the s option is used in the command line options, it is possible that some of these commands will be blocked.
Ctrl+L erases and rewrites the screen.
H or? Show the help screen and give some brief summary instructions for the command.
K terminates a process. The user will be prompted to enter the process PID that needs to be terminated and what kind of signal needs to be sent to the process. A general termination process can use a 15 signal; if it does not end properly, use signal 9 to force the process to end. The default value is signal 15. This command is blocked in safe mode.
I ignore idle and dead processes. This is a switch command.
Q exit the program.
R rearrange the priority of a process. The user is prompted to enter the process PID that needs to be changed and the process priority value to be set. Entering a positive value lowers the priority, otherwise it gives the process a higher priority. The default value is 10.
S switches to cumulative mode.
S change the delay time between two refreshes. The user will be prompted to enter a new time in s. If there is a decimal, it is converted to m s. Enter a value of 0 and the system will continue to refresh, with a default value of 5 s. It should be noted that if you set too little time, it is likely to cause continuous refresh, so that it is too late to see the display at all, and the system load will be greatly increased.
F or F adds or removes items from the current display.
O or O change the order in which items are displayed.
L Toggle displays average load and startup time information.
M toggles to display memory information.
T toggles to display process and CPU status information.
C toggles the display command name and the full command line.
M sorts according to the amount of resident memory.
P sorts according to the percentage of CPU usage.
T is sorted by time / cumulative time.
W writes the current settings to the ~ / .toprc file. This is the recommended way to write top configuration files.
Zombie process
When a process is finished, it usually takes some time to complete all tasks (such as closing open files) before it ends. In a short period of time, the process is in a zombie state. After the process completes all shutdown tasks, it submits its shutdown information to the parent process. In some cases, a zombie process cannot shut itself down, and the process state is z (zombie). You cannot use the kill command to kill a zombie process because it is already marked "dead". If you can't get rid of a zombie process, you can kill its parent process, and the zombie process disappears. However, if the parent process is an init process, you cannot kill the init process because init is an important system process, in which case you can only restart the server once to get rid of the zombie process. It is also necessary to analyze why applications lead to rigidity.
The second line tasks can see the number of zombie processes in the system.
3 、 iostat
Avg-cpu:
CPU occupancy of% user:user level (application)
% nice: CPU occupancy of user level with nice priority
CPU usage of% sys:system level (kernel)
% idle: idle CPU resources
Disk information
Device: block device name
Tps: the number of transmissions made by the device per second (Ipicuro requests per second). Multiple individual Iamp O requests can be grouped into a transport operation, because a transport operation can be of different capacity.
Blk_read/s, Blk_wrtn/s: the number of blocks read and written by the device per second. Blocks may be of different capacities.
Blk_read, Blk_wrtn: the total number of block devices read and written since the system was started.
4 、 vmstat
The Vmstat command provides the monitoring of the process, memory, page Imax O block and CPU. Vmstat can display the average or sampling value of the test results, and the sampling mode can provide monitoring results of different frequencies in a sampling period.
Process (procs)
R: number of processes waiting for run time
B: processes in an uninterruptible sleep state
W: processes that are swapped out but can still be run, this value is calculated
Memoryswpd: the amount of virtual memory
Free: the amount of free memory
Buff: the amount of memory used as a buffer
Swap
Si: the number swapped from the hard disk
So: the number swapped to the hard disk
IO
Bi: the number of blocks output to a block device
Bo: the number of blocks accepted from a block device
System
In: the number of interrupts per second, including the clock
Cs: the number of context switches occurring per second
Cpu (percentage of total cpu elapsed time)
Us: time for non-kernel code to run (user time, including nice time)
Sy: time for kernel code to run (system time)
Id: idle time
Wa: the time it takes to wait for the iThano operation
M: displays the memory utilization of the kernel
A: displays memory page information, including active and inactive memory pages
N: displays the header line, which is useful when using sampling mode and outputting the command results to a file. For example, root#vmstat-n 2 10 displays 10 output at a frequency of 2 seconds
5. Ps and pstree
Good command to analyze the process!
6 、 sar
Automatically collect and save system information, crontab configure system timing tasks
Crontab command format meaning: minute (0-59) hour (0-23) date (1-31) month (1-12) week (0-6) command paragraph
Let's look at a few specific examples:
● 0 * / 2 * / sbin/service httpd restart means to restart apache every two hours
● 50 7 * / sbin/service sshd start means to start the ssh service at 7:50 every day
● 50 22 * / sbin/service sshd stop means to shut down the ssh service at 22:50 every day
● 01 15 * * fsck / home check / home disk on the 1st and 15th of each month
● 1 * / home/bruce/backup first minute execution / home/bruce/backup this file
● 00 03 * * 1-5 find / home "* .xxx"-mtime + 4-exec rm {}\; from Monday to Friday at 3 o'clock in the directory / home, look for the file named * .xxx and delete the file from 4 days ago.
● 30 6 * / 10 * * ls means to execute the ls command once at 6:30 on the 1st, 11th, 21st and 31st of each month.
7 、 free
Display system memory information
The results are displayed according to bytes, kilobytes, megabytes and gigabytes, respectively.
-l display low and high memory differently
-c {count} the number of times free output is displayed
8 、 pmap
Pmap pid to view the memory usage of a specific process
The above is how to explain the common performance testing commands in Linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are 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.