Linux system some system view instructions

Source: Internet
Author: User
Tags sorts cpu usage disk usage

First, Vmstat

[[email protected] ~]# Vmstat 2 1procs-----------memory-------------Swap-------io------System-------CPU-----R B S     WPD free buff cache si so bi bo in CS us sy ID WA St 0 0 0 343228 8952 43660 0 0 5 1 11 10 0 0 100 0 0

Introduce the common methods of Vmstat, the first parameter is the sampling time interval, the second parameter is the number of samples.

[[email protected] ~]# vmstat 2 procs -----------Memory---------- ---swap--  -----IO---- --system-- -----CPU----- r  b   swpd    free   buff  cache   si   so     bi    bo   in   cs us sy id wa  st 0  0      0 340616   9292   45460    0    0     5      1   11   10  0  0 100  0   0  0  0      0 340600   9292   45460    0    0     0      0   13   11  0  0 100  0  0  0   0      0 340600   9292  45460     0    0     0     0    10   11  0  0 100  0  0  0   0      0 340476   9292  45460     0    0     0     2    12   16  0  0 100  0  0  0   0      0 340476   9292  45460     0    0     0     0    11  &nbSp;11  0  1 100  0  0 

     is sampled every 2 seconds, and no specified number of times is kept, and CTRL + C ends the sampling. Let's say the meanings of each parameter below.

R: Represents the number of processes waiting for CPU resources, and when this number exceeds the CPU count, the system has a performance bottleneck on the CPU.    B: There are several processes that are blocked by waiting for Io, which can be a bottleneck on a high-concurrency, traditional model-based Web server.    SWPD: Represents the amount of swpd used, when used to SWPD, indicates that your physical memory is low.    Free: The remaining amount of physical memory, my side of the remaining 340M.    Buff:linux system uses a certain amount of memory to buffer the IO, the buff is used to store the metadata of the file, such as directory contents, file permissions.    The Cache:cache is used to cache open files. Si: The size of memory written from swap area per second (unit: kb/s) So: the size of writes from memory to swap per second (in kb/s) BI: Number of blocks read per second bo: number of blocks written per second in: Interrupts per second CPU, including time Interrupt CS: Context switch: Call    System functions, the context switch, the thread switch, also to the process context switch, the smaller the value of the better, too big, to consider how to reduce the number of threads or processes.    US: CPU time occupied by user space Sy: CPU time occupied by kernel space, this time is generally consumed on Io.    WA: CPU time waiting for IO. ST: Stolen time, do not know why was stolen, CPU God stole.


Second, top

650) this.width=650; "title=" 1.jpg "alt=" wkiol1w4gp_gshpnaapcuucl4pq663.jpg "src=" http://s3.51cto.com/wyfs02/M00/ 70/79/wkiol1w4gp_gshpnaapcuucl4pq663.jpg "/>

You can normally use the top command directly, if you don't want top to occupy the front desk, you can use Top-n. Top is an interactive command, and we can make adjustments to top in the top window. Let's look at the contents of top display


First act uptime:

[Email protected] ~]# uptime 15:26:14 up 4:05, 3 users, Load average:0.00, 0.00, 0.00
First column: Current time second column: System run time third column: Number of users logged in the fourth column: Average queue length, or load. The time is 1 minutes, 5 minutes, 15 minutes.

Second to third behavior CPU information:

         Note that when the CPU is multiple, this side may have multiple lines, the CPU (s) as the average, press "1" key can be expanded.

        82 total: Total number of processes          1 running: Number of processes running          81 sleeping: Number of dormant processes         0 stopped: Number of processes stopped          0 zombie: Zombie Process Count         0.3%  US&NBSP: CPU percent occupied by user space         1.0% sy : CPU percentage in kernel space         0.0% NI&NBSP: CPU percentage of processes that have changed priority in user process space          98.7% ID : Idle cpu percent         0.0%  wa : Percentage of CPU time waiting for input and output         0.0%hi: Hardware CPU interrupt consumption percent          0.0%si: Soft interrupt occupancy percentage         0.0% ST: The Stolen CPU time 

Fourth to fifth behavior memory information:

Mem:

191272K Total Physical memory amount 173656k used total amount of physical memory used 17616k free memory total 22052k buffers as memory for kernel cache


Swap:

192772k Total swap volume 0k used the total amount of swap area used 192772k free Swap area total 123988k cached buffer swap area total, in-memory content is Swapped out to the swap area and then swapped into memory, but the used swap area has not been overwritten, the value is the size of the swap area that the content already exists in memory, and the corresponding memory is swapped out again without having to write to the swap area.


The content shown below is

Ordinal    column name      meaning a    pid      process IDB     PPID     Parent Process Idc    ruser   real User ide    of the  user named    UID      process owner  USER     the user name of the process owner f    group    the group name of the process owner g     TTY      the terminal name of the startup process. Processes that are not started from the terminal are displayed as  ?h    PR       priority i    The  ni      nice value. Negative values indicate high priority, positive values indicate low priority j    p        last used CPU, only meaningful in multi-CPU environment K     %CPU     last updated to current CPU time consumption percent l    time  Total CPU time used by the     process, total CPU time per second m    time+    process, Unit 1/100 sec n     %mem  &The percentage of physical memory used by the nbsp;  process o    virt     the total amount of virtual memory used by the process, in kilobytes. The virt=swap+resp    swap     process uses the amount of virtual memory that is swapped out, in kilobytes. The size, in kilobytes, of the physical memory used by the q    res      process and not swapped out. res=code+datar    code     The amount of physical memory the executable code occupies, in units kbs     data     The amount of physical memory that is used outside the executable code (data segment + stack), in units kbt    shr       shared memory size, Units kbu    nflt     page faults v     ndrt     the number of pages that were modified the last time it was written to. w    s        process Status (d= non-interruptible sleep state, r= run, s= sleep, t= track/Stop, z= zombie process) x    command  command name/command line y    wchan    If the process is sleeping, The system function name in sleep is displayed z    flags    task flag, reference  sched.h

You can select what you want to display by pressing F on the top interactive command. Press the o key to change the order in which the columns are displayed. A-Z in the lower case moves the corresponding column to the right, while the uppercase A-Z moves the corresponding column to the left. Finally, press ENTER to confirm.
Press the uppercase F or O key, and then press A-Z to sort the process by the appropriate column. The uppercase R Key can reverse the current sort.


Top parameters that can be used:

D: Specifies the time interval between each two screen information refresh. Of course the user can use the s interactive command to change it. P: Monitor only the state of a process by specifying the monitoring process ID. S: Specify 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 zombie processes. C: Display the entire command line instead of just displaying the command name

Use in an interactive environment:

H or? : Displays the help screen and gives a brief summary of the commands. K: Terminates a process. The user will be prompted for the process PID to be terminated and what signal needs to be sent to the process. The normal termination process can use a 15 signal, and if not, use signal 9 to force end the process. The default value is signal 15. This command is masked in safe mode. I: Ignore idle and zombie processes. This is a switch-type command. Q: Quit the program. R: Reschedule the priority level of a process. The user is prompted to enter the process PID that needs to be changed and the process priority value that needs to be set. Entering a positive value lowers the priority and, conversely, it gives the process a higher priority. The default value is 10. S: Switch to cumulative mode (don't know what to do) d: Change the delay time between two refreshes. The user will be prompted to enter a new time in S. If there are decimals, it is converted into M S. Enter a value of 0 and the system will refresh continuously, the default value is 5 S. It is important to note that if you set too small a time, it is likely to cause a constant refresh, so it is too late to see the display, and the system load will be greatly increased. F or F: Add or remove items from the current display. O or O: Change the order in which items are displayed. L: Toggle display of average load and start time information. M: Toggles display memory information. T: Toggles display of process and CPU status information. C: Toggle display command name and full command line. M: Sorts based on the size of the resident memory. P: Sorts according to the percentage size of CPU usage. T: Sort by Time/cumulative time. W: Writes the current settings to the ~/.TOPRC file. This is the recommended way to write top configuration files.


Third, Mpstat

In fact, finished the above 2 commands, CPU ah, memory ah, Io Ah view is no problem, the following is about the common methods of Mpstat.

[[email protected] ~]# mpstat -p all usage:  mpstat [  options  ] [ < time interval > [ < number > ] ] 
[[email protected] ~]# mpstat -p all 1 10linux 2.6.32-279.el6.x86_64   (node2.buranle.com)   2015 July 29   _x86_64_  (1&NBSP;CPU) 16:10 22 seconds   cpu     %usr   %nice    %sys %iowait     %irq   %soft  %steal  %guest   %idle16 10 minutes, 23 seconds    all    0.00    0.00    1.00     0.00    0.00    0.00    0.00     0.00   99.0016 10 minutes 23 seconds     0    0.00     0.00    1.00    0.00     0.00    0.00    0.00    0.00    99.00

The meaning of the field is as follows:

%user in internal time period, the user State CPU time (%), does not contain the Nice value is negative process (usr/total) *100%nice in internal time period, nice value is negative process CPU time (%)       (nice/total) *100%sys in internal time period, kernel time (%) (system/total) *100%iowait in internal time period, HDD io wait time (%)     (iowait/total) *100%irq in internal time period, hard interrupt time (%)     (irq/total) *100%soft in internal time period, soft interrupt time (%) (softirq/total) *100%idle in internal time period, the CPU is removed from waiting for the disk IO operation for any reason idle time idle time (%) (idle/total) *100


Iv. Iostat

[Email protected] ~]# iostat--help usage: iostat [options] [< time interval > [< times >]]

Commonly used methods are:

[[email protected] ~]# iostat -d -k 2linux 2.6.32-279.el6.x86_64  ( node2.buranle.com)   2015 July 29   _x86_64_  (1&NBSP;CPU) device:             tps    kb_read/s    kb _wrtn/s    kb_read    kb_wrtnsda                0.42          7.14         2.68     126231       47478dm-0               0.93         6.88          2.68  a   121641      47464dm-1               0.02          0.07         0.00        1188          0

The parameter-D indicates that the device (disk) usage status is displayed; k Some columns that use block are forced to use kilobytes, and 2 indicates that the data appears refreshed every 2 seconds.

The meaning of the parameter:

TPS: The number of times the device is transferred per second. "One-time transfer" means "one-time I/O request". Multiple logical requests may be merged into "one I/O request". The size of the "one transfer" request is unknown. KB_READ/S: The amount of data read from the device (drive expressed) per second, KB_WRTN/S: The amount of data written to the device (drive expressed) per second, Kb_read: Total amount of data read, KB_WRTN: Total amount of data written ; These units are kilobytes.

Iostat also has a more common option- x, which will be used to display and IO-related extended data.

[[email protected] ~]# iostat -d -k -x 2linux 2.6.32-279.el6.x86_64   (node2.buranle.com)   2015 July 29   _x86_64_  (1&NBSP;CPU) device:          rrqm/s   wrqm/s     r/s      w/s    rkb/s    wkb/s avgrq-sz  avgqu-sz   await  svctm  %utilsda                0.09     0.49     0.24    0.17     7.08     2.67     47.03     0.01   14.38   4.42    0.18dm-0               0.00     0.00    0.26    0.67     6.82      2.67    20.48     0.08   91.01    1.95   0.18dm-1               0.00     0.00    0.02     0.00     0.07     0.00      8.00     0.00    2.60   1.13   0.00

The meaning of the parameter:

RRQM/S: How much of this device-dependent read request is merged per second (when the system call needs to read the data, the VFS sends the request to each FS, and if FS finds that different read requests read the same block data, FS merges the request into the merge); wrqm/ S: How much of this device-related write request per second has been merge. RSEC/S: Number of sectors read per second; wsec/: Number of sectors written per second. rkb/s:the number of read requests that were issued to the  device per second;wkb/s:the number of write requests that were  The size of the issued to the device per second;avgrq-sz  average request sector avgqu-sz  is the length of the average request queue. There is no doubt that the shorter the queue, the better.    await: The average time (in milliseconds) of processing per IO request. This can be understood as the response time of IO, generally the system IO response time should be less than 5ms, if greater than 10ms is relatively large. This time includes the queue time and service time, that is, in general, await is greater than SVCTM, their difference is smaller, then the shorter the queue time, conversely, the greater the difference, the longer the queue time, indicating that the system has a problem. SVCTM: Represents the average service time (in milliseconds) for each device I/O operation. If the value of SVCTM is close to await, indicating that there is little I/O waiting, disk performance is good, and if the value of await is much higher than the value of SVCTM, the I/O queue waits too long for the applications running on the system to become slower. %util:  all processing IO time in the statistical time, divided by the total statistic time. For example, if the statistic interval is 1 seconds, the device has 0.8 seconds to process Io, and 0.2 seconds is idle, then the device is%util = 0.8/1 = 80%, so this parameter implies the device's busy level. Generally, if this parameter is 100% indicates that the device is already running close to full load (of course if it is a multi-disk, even if%util is 100% because of the concurrency of the disk, disk usage may not beto the bottleneck). 


Other such as free, iotop and so on are not introduced, the parameters of the interpretation of the main source of the network with their own understanding of a slight modification.

Linux system some system view instructions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.