W command
Use W to view system load
#load average the load value of the system within a minute, five minutes, 15 minutes, the number of active processes using the CPU # value for the system logical CPU (not the physical CPU) is the optimal state [[email protected] ~]# W 19 : 54:39 up 2 days, 11:28, 4 users, Load average:0.00, 0.01, 0.05USER TTY from [email protected ] IDLE jcpu PCPU whatroot pts/0 49.77.222.241 19:10 44:39 0.00s 0.00s-bashroot pts/1 49.77.22 2.241 19:47 7:11 0.00s 0.00s-bashroot pts/2 49.77.222.241 19:39 15:27 0.00s 0.00s-bashroot p TS/3 49.77.222.241 19:54 7.00s 0.00s 0.00s w[[email protected] ~]# datesat Nov 19:55:10 CST 2017# per physical CP You have a lot of logic on the cpu,1 physical CPU can have two cores, a lot of logic on each core cpu# see the number of CPUs, processor 0 means 1 logical CPUs, so 1 is the ideal state [[email protected] ~]# CAT/ PROC/CPUINFOPROCESSOR:0VENDOR_ID:GENUINEINTELCPU Family:6model:79model Name:inte L (R) Xeon (r) CPU e5-2682 v4 @ 2.50GHz ... #w命令第一行与uptime一样 [[email protected] ~]# uptime 20:06:05 up 2 days, 11:39, 5 users, Load average:0.00, 0.03, 0.05
vmstat Command
For example, through the W command to learn that the CPU load is too high, you can know by Vmstat which processes consume CPU and view system bottleneck.
[[email protected] ~]# vmstatprocs-----------memory-------------Swap-------io-----system--------CPU-----R B SWPD free buff cache si so bi bo in CS us sy ID WA St 4 0 0 78048 127452 437872 0 0 2 196 1 1 98 0 0#vmstat Digital Dynamic How many seconds display [[email protected] ~]# vmstat 3procs-----------Memory---------- ---swap-------io-----system--------CPU-----r B swpd free buff cache si so bi bo in CS us sy ID WA St 4 0 0 78112 127456 437900 0 0 2 10 12 197 1 1 98 0 0 0 0 0 77740 127460 437908 0 0 0 24 1281 2660 1 1 97 0 0 0 0 0 77740 127460 437916 0 0 0 9 1268 2657 0 1 99 0 The 0^c# is displayed every three seconds, showing 4 ends [[email protected] ~]# vmstat 3 4procs-----------memory-------------Swap-------IO----- System--------CPU-----r B swpd free buff cache si so bi bo in CS us sy ID WA St 4 0 0 77732 127476 438056 0) 0 2 10 13 198 1 1 98 0 0 1 0 0 77732 127476 438056 0 0 0 8 1235 2611 1 1 98 0 0 0 0 0 77764 127476 438088 0 0 0 0 1180 2563 1 0 99 0 0 0 0 0 77392 127476 438092 0 0 0 0 1191 2582 1 0 0 0# R is run shorthand, which indicates how many processes are in progress, waiting for the CPU to be counted. # b process waiting number block# swap when memory is not enough, the system can temporarily put part of the memory data into the swap, the number In the continuous transformation of the memory is not enough to use the # free buff Cache#si so by the swap, si how many kilobytes of data from the swap into memory, so is from the memory of the data #bi Bo is related to the disk, the data from the disk to enter into the memory of Bi,bo for writing to disk Data #us The percentage of the CPU that runs on the system will be displayed in us. User state resource consumes CPU percentage #sy system itself process service consumes CPU percentage #id idle, US + sy + ID =100% #wa Wait, how many processes are waiting for CPU
Top command
View Process Usage Resource conditions
#三秒更新一次, Zombie is that the main process has been terminated and its child processes still exist called Zombie process #st stolen CPU percent # physical Memory #交换分区 # The default is sorted by CPU percent usage. Res physical Memory size KB, press the M key to install memory using sort, press p to return to CPU sort # Press the number 1 to list all individual CPU sorts # can be killed by PID process, kill pid[[email protected] ~]# toptop- 20:33:35 up 2 days, 12:07, 6 users, load average:0.00, 0.09, 0.13tasks:83 Total, 1 running, sleeping, 0 Stopp Ed, 0 zombie%cpu (s): 0.3 us, 0.3 sy, 0.0 ni, 99.3 ID, 0.0 wa, 0.0 hi, 0.0 si, 0.0 stkib mem:1016396 Total, 74024 free, 375752 used, 566620 Buff/cachekib swap:0 Total, 0 free, 0 used. 421600 avail Mem PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND 1017 Root 20 0 1006112 15304 10308 s 0.3 1.5 23:30.54 staragent-c+ 1047 root 0 130484 12840 8848 S 0.3 1.3 3:50.11 Aliyundu N 1 Root 0 43204 3596 2412 s 0.0 0.4 0:04.26 systemd 2 root 0 0 0 0 S 0.0 0.0 0:00.01 Kthreadd 3 Root 0 0 0 0 S 0.0 0.0 0:02.72ksoftirqd/0 5 root 0-20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0h 7 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0 8 root 0 0 0 0 S 0.0 0.0 0:00.00 RCU_BH 9 Root 0 0 0 0 S 0.0 0.0 0:10.18 rcu_sched root RT 0 0 0 0 s 0 .0 0.0 0:00.51 watchdog/0 root 0 0 0 0 S 0.0 0.0 0:00.00 KDEVTMPFS Root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns Root 0 0 0 0 S 0.0 0.0 0:00.07 k HUNGTASKD Root 0-20 0 0 0 S 0.0 0.0 0:00.00 writeback root 0-20 0 0 0 S 0.0 0.0 0:00.00 kintegrityd root 0-20 0 0 0 S 0.0 0.0 0:00.00 bioset RO OT 0-20 0 0 0 S 0.0 0.0 0:00.00 kblockd# can view specific commands top-c[[email protected] ~]# top-ctop- 20:46:40 up 2 days, 12:20, 7 users, load average:0.00, 0.01, 0.07tasks:85 Total, 1 running, sleeping, 0 stopped, 0 zombie%cpu (s): 1.0 us, 0.7 sy, 0.0 ni, 98.3 ID, 0.0 wa, 0.0 hi, 0.0 si, 0.0 stkib mem:1016396 Total, 70888 free, 378232 use D, 567276 Buff/cachekib swap:0 Total, 0 free, 0 used. 418940 avail Mem PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND 1017 Root 20 0 1006112 15304 10308 S 1.0 1.5 23:35.66 Staragent-core 1516 root 0 2070408 69488 11024 S 0.7 6.8 12:39.07/usr/l ocal/cloudmoni+ 1047 Root 0 130484 12840 8848 S 0.3 1.3 3:50.87/usr/local/aegis/aeg+11782 Root 20 0 0 0 0 S 0.3 0.0 0:00.01 [kworker/0:2]11909 root 0 157600 2216 1616 R 0.3 0.2 0: 00.01 top-c 1 root 0 43204 3596 2412 S 0.0 0.4 0:04.27/usr/lib/systemd/sys+ 2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 [Kthreadd] 3 root 0 0 0 0 S 0.0 0.0 0:02.73 [ksoftirqd/0] 5 root 0-20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:0h] 7 root RT 0 0 0 0 S 0.0 0.0 0:00.00 [migration/0] 8 root 0 0 0 0 S 0.0 0.0 0:00.00 [RCU_BH] 9 root 0 0 0 0 S 0.0 0.0 0: 10.21 [rcu_sched] root RT 0 0 0 0 S 0.0 0.0 0:00.51 [watchdog/0] root 20 0 0 0 0 S 0.0 0.0 0:00.00 [KDEVTMPFS] root 0-20 0 0 0 S 0.0 0.0 0:00.00 [NE TNS] Root 0 0 0 0 S 0.0 0.0 0:00.07 [KHUNGTASKD] root 0-20 0 0 0 S 0.0 0.0 0:00.00 [writeback] #top-bn1 static One-time display, suitable for write script use
SAR command
Comprehensive analysis of system status commands, often used for traffic monitoring
#如果sar命令不加任何选项, the System-reserved history file is automatically called # every 10 minutes the system state is filtered over and saved in the file, [[email protected] ~]# sarcannot open/var/log/sa/sa25: The directory where No such file or Directory#sar history files [[[email protected] ~]# ls/var/log/sa[[email protected] ~]# #网卡流量, Displayed three times per second [[email protected] ~]# sar-n DEV 1 3Linux 3.10.0-514.26.2.el7.x86_64 (Chyuanliunj) 11/25/2017 _x86 _64_ (1 CPU) 08:57:29 pm IFACE rxpck/s txpck/s rxkb/s txkb/s rxcmp/s txcmp/s rxmcst/s08:57:30 pm Eth0 1.01 1.01 0.05 0.12 0.00 0.00 0.0008:57:30 PM Lo 3.03 3.03 0.18 0.18 0.00 0.00 0.0008:57:30 PM IFACE rxpck/s txpck/s rxkb/s txkb/s rxcmp/s txcmp/s rxmcst/s08:57:31 PM eth0 0.00 2.00 0.00 0.56 0.00 0.00 0.0008:57:31 PM Lo 0.00 0.00 0.00 0.00 0.00 0.00 0.0008:57:31 PM IFACE rxpck/s txpck/s rxkb/s txkb/s rxcmp/s txcmp/s RXMCst/s08:57:32 pm eth0 0.00 1.01 0.00 0.38 0.00 0.00 0.0008:57:32 PM Lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00average:iface rxpck/s txpck/s rxkb/s txk b/S rxcmp/s txcmp/s rxmcst/saverage:eth0 0.34 1.34 0.02 0.35 0.00 0.00 0. 00average:lo 1.01 1.01 0.06 0.06 0.00 0.00 0.00#RXPCK received Packet TXPCK send RXKB The amount of data received TXKB send # packets thousands of or more normal, tens of thousands is not normal. #查看历史数据, save one months of data, 25 is 25th numbers of data [[email protected] ~]# sar-f/var/log/sa/sa25linux 3.10.0-514.26.2.el7.x86_64 ( Chyuanliunj) 11/25/2017 _x86_64_ (1 CPU) #-Q system load, often view historical data without adding numbers [[email protected] ~]# sar-q 1 4Linux 3.1 0.0-514.26.2.el7.x86_64 (Chyuanliunj) 11/25/2017 _x86_64_ (1 CPU) 09:09:04 PM runq-sz Plist-sz ldavg-1 L Davg-5 ldavg-15 blocked09:09:05 PM 1 409 0.03 0.05 0.07 009:09:06 PM 1 409 0.03 0.05 0.07 009:09:07 PM 3 409 0.03 0.05 0.07 00 9:09:08 PM 1 409 0.03 0.05 0.07 0average:2 409 0.03 0.05 0.07 0#-B disk Read and write [[email protected] ~]# sar-b 1 4Linux 3.10.0-514.26.2.el7.x86_64 (Chyuanliunj) 11/25/20 _x86_64_ (1 CPU) 09:09:57 pm TPS Rtps Wtps bread/s bwrtn/s09:09:58 PM 0.00 0.00 0.00 0.00 0.0009:09:59 PM 0.00 0.00 0.00 0.00 0.0009:10:00 PM 0.00 0.00 0.00 0.00 0.0009:10:01 PM 1.98 0.00 1.98 0.00 47.52average:0.50 0.00 0.50 0.00 12.03
In the/var/log/sa/directory there will be two kinds of file record data, one sa25 another sar25 will be generated at number 26th, Sa25 cannot use the cat command can only sar-f view, SAR25 can use the cat command to view
nload command
The NIC name is in the upper-left corner. Dynamic display of network card traffic
Device eth0 [172.16.252.69] (1/2): =============================================================================== =incoming: curr:856.00 bit/s avg:2.05 kbit/s min:0.00 bit/s max:10.12 kbit/s ttl:102.76 Mbyteoutgoing: curr:8.08 kbit/s avg:13.55 kbit/s min:4.34 kbit/s max:70.05 kbit/s ttl:206.95 MByte
Monitoring IO Performance
Monitoring Disk Status command
#iostat的数据通过sar-B can also be seen in # Iostat-x%util is important [[email protected] ~]# iostat-xlinux 3.10.0-514.26.2.el7.x86_64 ( Chyuanliunj) 11/25/2017 _x86_64_ (1 CPU) avg-cpu:%user%nice%system%iowait%steal%idle 1.0 1 0.00 0.57 0.03 0.00 98.39device:rrqm/s wrqm/s r/s w/s rkb/s wkb/s avgrq-sz avgqu- SZ await r_await w_await SVCTM%utilvda 0.00 1.13 0.06 0.94 2.04 9.97 24.02 0.0 0 2.02 3.22 1.95 0.43 0.04%util: How much time in a second is spent on I/O operations, or how many times in a second I/O queues are non-empty. That is, Delta (USR)/s/1000 (because the use is in milliseconds) if the%util is close to 100%, indicating that there are too many I/O requests and that the I/O system is already full load, the disk may have a bottleneck. %util: How much time in a second is spent on I/O operations, or how many times in a second I/O queues are non-empty SVCTM: Average service time Per device I/O await: Average wait time per device I/O operation Avgqu-sz: Average I/O Queue Length if %util close to 100%, indicating that I/O requests too much, I/O system is full load, the disk may have a bottleneck, general%util greater than 70%,i/o pressure is relatively large, reading speed has more wait. You can also combine vmstat to see the b parameter (the number of processes waiting for a resource) and the WA parameter (the percentage of CPU time the I/O wait takes up, and the I/O pressure is high when I am over 30%) the size of vmstat-d 5await generally depends on the service time (SVCTM) and i/ o The length of the queue and the emit mode of the I/O request. If the SVCTM is closer to await, it indicates that I/O has little waiting time;The await is much larger than SVCTM, which indicates that the I/O queue is too long and the application gets slower response times.
See which process uses IO more frequently
#类似top命令 [[email protected] ~]# iotoptotal DISK read:0.00 b/S | Total DISK write:0.00 b/sactual DISK read:0.00 b/S | Actual disk write:0.00 b/S TID PRIO USER DISK READ DISK WRITE swapin io> COMMAND 1 BE/4 Root 0.00 B/S 0.00 B/s 0.00% 0.00% Systemd-~rialize 2 BE/4 root 0.00 b/S 0.00 B/S 0.00 0.00 % [Kthreadd] 3 BE/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% [ksoftirqd/0] 5 be/0 root 0.00 B/S 0. XX b/s 0.00% 0.00% [kworker/0:0h] 7 RT/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% [migration/0] 8 BE/4 R Oot 0.00 B/S 0.00 B/S 0.00% 0.00 [RCU_BH] 9 BE/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% [rcu_s CHED] RT/4 root 0.00 b/S 0.00 B/s 0.00% 0.00% [watchdog/0] BE/4 root 0.00 b/S 0.00 B/S 0.00% 0.00% [KDEVTMPFS] be/0 root 0.00 b/S 0.00 B/0.00% 0.00% [Netns] BE/4 root 0.00 B /s 0.00 B/S 0.00% 0.00% [KHUNGTASKD] (be/0 root 0.00 b/S 0.00 B/s 0.00% 0.00% [Writeback] ...
Linux8.1 Viewing system load