Linux性能检测常用基本命令

uptime

查看计算机的整体负载情况

[root@ljh2020 java]# uptime 
21:14:25 up  3:21,  1 user,  load average: 0.00, 0.01, 0.05

在这里插入图片描述
load average后的数字分别表示计算机在1min、5min、15min内的平均负载。

dmesg

语法:dmesg [-cn][-s <缓冲区大小>]
参数说明:
-c  显示信息后,清除ring buffer中的内容。
-s<缓冲区大小>  预设置为8196,刚好等于ring buffer的大小。
-n  设置记录信息的层级。

[root@ljh2020 ~]# dmesg

显示开机信息, kernel会将开机信息存储在ring buffer中。开机时来不及查看信息,可利用dmesg来查看。开机信息亦保存在/var/log/dmesg.

判断系统性能异常

快速判断是否有导致系统性能异常的问题

[root@ljh2020 java]# dmesg | tail
[    2.363395] alg: No test for __generic-gcm-aes-aesni (__driver-generic-gcm-aes-aesni)
[    2.642058] type=1305 audit(1589104356.538:3): audit_pid=568 old=0 auid=4294967295 ses=4294967295 res=1
[    3.798999] usb 1-1: New USB device found, idVendor=0627, idProduct=0001
[    3.799003] usb 1-1: New USB device strings: Mfr=1, Product=3, SerialNumber=5
[    3.799006] usb 1-1: Product: QEMU USB Tablet
[    3.799008] usb 1-1: Manufacturer: QEMU
[    3.799009] usb 1-1: SerialNumber: 42
[    4.799182] input: QEMU QEMU USB Tablet as /devices/pci0000:00/0000:00:01.2/usb1/1-1/1-1:1.0/input/input5
[    4.799364] hid-generic 0003:0627:0001.0001: input,hidraw0: USB HID v0.01 Pointer [QEMU QEMU USB Tablet] on usb-0000:00:01.2-1/input0
[    7.236986] random: crng init done
列出加载到内核中的所有驱动

我们可以使用如‘more’。 ‘tail’, ‘less ’或者‘grep’文字处理工具来处理‘dmesg’命令的输出。由于dmesg日志的输出不适合在一页中完全显示,因此我们使用管道(pipe)将其输出送到more或者less命令单页显示。

[root@ljh2020 ~]# dmesg | more
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] smpboot: Allowing 2 CPUs, 0 hotplug CPUs
[    0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
[    0.000000] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[    0.000000] PM: Registered nosave memory: [mem 0x14000000-0x1511ffff]
[    0.000000] PM: Registered nosave memory: [mem 0xbffce000-0xbfffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xc0000000-0xfeffbfff]
[    0.000000] PM: Registered nosave memory: [mem 0xfeffc000-0xfeffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xff000000-0xfffbffff]
[    0.000000] PM: Registered nosave memory: [mem 0xfffc0000-0xffffffff]
[    0.000000] e820: [mem 0xc0000000-0xfeffbfff] available for PCI devices
[    0.000000] Booting paravirtualized kernel on KVM
[    0.000000] setup_percpu: NR_CPUS:5120 nr_cpumask_bits:2 nr_cpu_ids:2 nr_node_ids:1
[    0.000000] PERCPU: Embedded 38 pages/cpu @ffff9efa75000000 s118784 r8192 d28672 u1048576
[    0.000000] pcpu-alloc: s118784 r8192 d28672 u1048576 alloc=1*2097152
[    0.000000] pcpu-alloc: [0] 0 1 
[    0.000000] KVM setup async PF for cpu 0
[    0.000000] kvm-stealtime: cpu 0, msr 13501c040
[    0.000000] PV qspinlock hash table entries: 256 (order: 0, 4096 bytes)
[    0.000000] Built 1 zonelists in Node order, mobility grouping on.  Total pages: 984364
[    0.000000] Policy zone: Normal
列出所有被检测到的硬件

要显示所有被内核检测到的硬盘设备,你可以使用‘grep’命令搜索‘sda’关键词

[root@ljh2020 java]# dmesg | grep sda
只输出dmesg命令的前20行日志

在‘dmesg’命令后跟随‘head’命令来显示开始几行,‘dmesg | head -20′命令将显示开始的前20行。

[root@ljh2020 java]# dmesg | head  -20
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.10.0-957.21.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Tue Jun 18 16:35:19 UTC 2019
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.10.0-957.21.3.el7.x86_64 root=UUID=1114fe9e-2309-4580-b183-d778e6d97397 ro crashkernel=auto rhgb quiet LANG=en_US.UTF-8 idle=halt biosdevname=0 net.ifnames=0 console=tty0 console=ttyS0,115200n8 noibrs
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000013ffffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000014000000-0x000000001511ffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000015120000-0x00000000bffcdfff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bffce000-0x00000000bfffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x00000001353fffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000135400000-0x000000013fffffff] reserved
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] SMBIOS 2.8 present.
[    0.000000] DMI: Alibaba Cloud Alibaba Cloud ECS, BIOS 8c24b4c 04/01/2014
只输出dmesg命令最后20行日志

在‘dmesg’命令后跟随‘tail’命令(‘ dmesg | tail -20’)来输出‘dmesg’命令的最后20行日志,当你插入可移动设备时它是非常有用的。

[root@ljh2020 java]# dmesg | tail -20
[    1.651661] systemd[1]: Inserted module 'ip_tables'
[    1.962467] EXT4-fs (vda1): re-mounted. Opts: (null)
[    2.039612] systemd-journald[396]: Received request to flush runtime journal from PID 1
[    2.243248] piix4_smbus 0000:00:01.3: SMBus Host Controller at 0x700, revision 0
[    2.243492] input: PC Speaker as /devices/platform/pcspkr/input/input4
[    2.340900] ppdev: user-space parallel port driver
[    2.346105] cryptd: max_cpu_qlen set to 1000
[    2.361083] AVX2 version of gcm_enc/dec engaged.
[    2.361085] AES CTR mode by8 optimization enabled
[    2.363340] alg: No test for __gcm-aes-aesni (__driver-gcm-aes-aesni)
[    2.363395] alg: No test for __generic-gcm-aes-aesni (__driver-generic-gcm-aes-aesni)
[    2.642058] type=1305 audit(1589104356.538:3): audit_pid=568 old=0 auid=4294967295 ses=4294967295 res=1
[    3.798999] usb 1-1: New USB device found, idVendor=0627, idProduct=0001
[    3.799003] usb 1-1: New USB device strings: Mfr=1, Product=3, SerialNumber=5
[    3.799006] usb 1-1: Product: QEMU USB Tablet
[    3.799008] usb 1-1: Manufacturer: QEMU
[    3.799009] usb 1-1: SerialNumber: 42
[    4.799182] input: QEMU QEMU USB Tablet as /devices/pci0000:00/0000:00:01.2/usb1/1-1/1-1:1.0/input/input5
[    4.799364] hid-generic 0003:0627:0001.0001: input,hidraw0: USB HID v0.01 Pointer [QEMU QEMU USB Tablet] on usb-0000:00:01.2-1/input0
[    7.236986] random: crng init done
搜索包含特定字符串的被检测到的硬件

由于‘dmesg’命令的输出实在太长了,在其中搜索某个特定的字符串是非常困难的。因此,有必要过滤出一些包含‘usb’ ‘dma’ ‘tty’ ‘memory’等字符串的日志行。grep命令 的‘-i’选项表示忽略大小写。

[root@ljh2020 java]# dmesg | grep -i usb
[    0.239101] ACPI: bus type USB registered
[    0.239117] usbcore: registered new interface driver usbfs
[    0.239124] usbcore: registered new interface driver hub
[    0.239138] usbcore: registered new device driver usb
[    0.572496] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.572507] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.572517] uhci_hcd: USB Universal Host Controller Interface driver
[    0.595889] uhci_hcd 0000:00:01.2: new USB bus registered, assigned bus number 1
[    0.596074] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
[    0.596076] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    0.596078] usb usb1: Product: UHCI Host Controller
[    0.596079] usb usb1: Manufacturer: Linux 3.10.0-957.21.3.el7.x86_64 uhci_hcd
[    0.596081] usb usb1: SerialNumber: 0000:00:01.2
[    0.596178] hub 1-0:1.0: USB hub found
[    0.596309] usbcore: registered new interface driver usbserial_generic
[    0.596314] usbserial: USB Serial support registered for generic
[    0.598599] usbcore: registered new interface driver usbhid
[    0.598600] usbhid: USB HID core driver
[    0.910536] usb 1-1: new full-speed USB device number 2 using uhci_hcd
[    3.798999] usb 1-1: New USB device found, idVendor=0627, idProduct=0001
[    3.799003] usb 1-1: New USB device strings: Mfr=1, Product=3, SerialNumber=5
[    3.799006] usb 1-1: Product: QEMU USB Tablet
[    3.799008] usb 1-1: Manufacturer: QEMU
[    3.799009] usb 1-1: SerialNumber: 42
[    4.799182] input: QEMU QEMU USB Tablet as /devices/pci0000:00/0000:00:01.2/usb1/1-1/1-1:1.0/input/input5
[    4.799364] hid-generic 0003:0627:0001.0001: input,hidraw0: USB HID v0.01 Pointer [QEMU QEMU USB Tablet] on usb-0000:00:01.2-1/input0
清空dmesg缓冲区日志

我们可以使用如下命令来清空dmesg的日志。该命令会清空dmesg环形缓冲区中的日志。但是你依然可以查看存储在‘/var/log/dmesg’文件中的日志。你连接任何的设备都会产生dmesg日志输出。

[root@ljh2020 java]# dmesg -c
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.10.0-957.21.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Tue Jun 18 16:35:19 UTC 2019
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.10.0-957.21.3.el7.x86_64 root=UUID=1114fe9e-2309-4580-b183-d778e6d97397 ro crashkernel=auto rhgb quiet LANG=en_US.UTF-8 idle=halt biosdevname=0 net.ifnames=0 console=tty0 console=ttyS0,115200n8 noibrs
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000013ffffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000014000000-0x000000001511ffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000015120000-0x00000000bffcdfff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bffce000-0x00000000bfffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x00000001353fffff] usable
[    0.000000] BIOS-e820: [mem 0x0000000135400000-0x000000013fffffff] reserved

实时监控dmesg日志输出

在某些发行版中可以使用命令‘tail -f /var/log/dmesg’来实时监控dmesg的日志输出。

[root@ljh2020 java]# watch "dmesg | tail -20"
vmstat 1
[root@ljh2020 ~]# vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
1  0      0 3324184  16992 182600    0    0     6     1  261  497  0  0 100  0  0
0  0      0 3324060  16992 182632    0    0     0     0  610 1079  0  1 100  0  0
0  0      0 3324060  16992 182632    0    0     0     0  529 1012  0  0 100  0  0
0  0      0 3324060  16992 182632    0    0     0     0  541 1038  1  0 100  0  0
0  0      0 3324060  16992 182632    0    0     0     0  517  983  0  1 100  0  0
0  0      0 3324060  16992 182632    0    0     0     0  518  978  0  0 100  0  0
0  0      0 3324060  17000 182624    0    0     0    16  493  968  0  0 100  0  0
0  0      0 3324060  17000 182632    0    0     0     0  526  977  0  0 99  0  0

打印进程、内存、交换分区、IO和CPU等的统计信息;
vmstat的格式如下:
vmstat [options] [delay [count]]
vmstat第一次输出表示从开机到vmstat运行时的平均值;剩余输出的都是在指定的时间间隔内的平均值,上述例子中delay的值设置为1,除第一次以外,剩余的都是1秒统计一次,count未设置,将会一直循环打印。

[root@ljh2020 ~]# vmstat 10 3
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
1  0      0 3324084  17016 182632    0    0     6     1  261  497  0  0 100  0  0
0  0      0 3324060  17016 182632    0    0     0     0  524  986  0  0 100  0  0
0  0      0 3324052  17016 182640    0    0     0     0  536 1014  0  0 100  0  0

上述的例子中delay设置为10,count设置为3,表示每行打印10秒内的平均值,只打印3次。
需要检查的列

  • r:表示正在运行或者等待CPU调度的进程数。因为该列数据不包含I/O的统计信息,因此可以用来检测CPU是否饱和。若r列中的数字大于CPU的核数,表示CPU已经处于饱和状态。
  • free:当前剩余的内存;
  • si, so:交换分区换入和换出的个数,若换入换出个数大于0,表示内存不足;
  • us, sy, id, wa:CPU的统计信息,分别表示user time、system time(kernel)、idle、wait I/O。I/O处理所用的时间包含在system time中,因此若system time超过20%,则I/O可能存在瓶颈或异常;
mpstat -P ALL 1
[root@ljh2020 ~]# mpstat -P ALL 1
Linux 3.10.0-957.21.3.el7.x86_64 (ljh2020)  05/10/2020  _x86_64_ (2 CPU) 10:08:15 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
10:08:15 PM  all    0.20    0.00    0.19    0.01    0.00    0.00    0.00    0.00    0.00   99.60
10:08:15 PM    0    0.20    0.00    0.18    0.01    0.00    0.00    0.00    0.00    0.00   99.61
10:08:15 PM    1    0.21    0.00    0.19    0.01    0.00    0.00    0.00    0.00    0.00   99.59
[...]

该命令用于每秒打印一次每个CPU的统计信息,可用于查看CPU的调度是否均匀。

pidstat 1
[root@ljh2020 ~]# pidstat 1
Linux 3.10.0-957.21.3.el7.x86_64 (ljh2020)  05/10/2020  _x86_64_ (2 CPU)
10:10:36 PM   UID       PID    %usr %system  %guest    %CPU   CPU  Command
10:10:37 PM     0      1209    1.00    1.00    0.00    2.00     1  AliYunDun10:10:37 PM   UID       PID    %usr %system  %guest    %CPU   CPU  Command10:10:38 PM   UID       PID    %usr %system  %guest    %CPU   CPU  Command
10:10:39 PM     0       944    0.00    1.00    0.00    1.00     0  AliYunDunUpdate
10:10:39 PM     0      1841    0.00    1.00    0.00    1.00     1  pidstat10:10:39 PM   UID       PID    %usr %system  %guest    %CPU   CPU  Command
10:10:40 PM     0      1209    0.00    1.00    0.00    1.00     1  AliYunDun10:10:40 PM   UID       PID    %usr %system  %guest    %CPU   CPU  Command
10:10:41 PM     0      1209    1.00    0.00    0.00    1.00     1  AliYunDun

该命令用于打印各个进程对CPU的占用情况,类似top命令中显示的内容。
pidstat的优势在于,可以滚动的打印进程运行情况,而不像top那样会清屏。

iostat -xz 1

类似vmstat,第一次输出的是从系统开机到统计这段时间的采样数据;

[root@ljh2020 ~]#  iostat -xz 1
Linux 3.10.0-957.21.3.el7.x86_64 (ljh2020)  05/10/2020  _x86_64_ (2 CPU)
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.20    0.00    0.19    0.01    0.00   99.60
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
vda               0.07     0.10    0.42    0.27    10.76     1.68    36.45     0.00    5.01    3.68    7.09   0.31   0.02

[...]

检查列

  • r/s, w/s, rkB/s, wkB/s,表示每秒向I/O设备发出的reads、writes、read Kbytes、write Kbytes的数量。
  • await,表示应用程序排队等待和被服务的平均I/O时间,该值若大于预期的时间,这表示I/O设备处于饱和状态或者异常。
  • avgqu-sz,表示请求被发送给I/O设备的平均时间,若该值大于1,则表示I/O设备可能已经饱和;
  • %util,每秒设备的利用率;若该利用率超过60%,则表示设备出现性能异常;
free -m
[root@ljh2020 ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           3602         160        3246           0         195        3221
Swap:             0           0           0

检查的列

  • buffers: For the buffer cache, used for block device I/O.
  • cached: For the page cache, used by file systems.
  • 若buffers和cached接近0,说明I/O的使用率过高,系统存在性能问题。
  • Linux中会用free内存作为cache,若应用程序需要分配内存,系统能够快速的将cache占用的内存回收,因此free的内存包含cache占用的部分。
sar -n DEV 1

sar是System Activity Reporter的缩写,系统活动状态报告。
-n { keyword [,…] | ALL },用于报告网络统计数据。keyword可以是以下的一个或者多个:DEV, EDEV, NFS, NFSD, SOCK, IP, EIP, ICMP, EICMP, TCP, ETCP, UDP, SOCK6, IP6, EIP6, ICMP6, EICMP6 和UDP6。

  • -n DEV 1, 每秒统计一次网络的使用情况;
  • -n EDEV 1,每秒统计一次错误的网络信息;
[root@ljh2020 ~]# sar -n DEV 1
Linux 3.10.0-957.21.3.el7.x86_64 (ljh2020)  05/10/2020  _x86_64_ (2 CPU)
10:38:27 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
10:38:28 PM      eth0      5.00      3.00      0.29      1.73      0.00      0.00      0.00
10:38:28 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
^C
10:38:28 PM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
10:38:29 PM      eth0      2.17      3.26      0.16      0.55      0.00      0.00      0.00
10:38:29 PM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
Average:         eth0      3.65      3.12      0.23      1.16      0.00      0.00      0.00
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00

参数说明

  • IFACE ,网络接口名称;
  • rxpck/s ,每秒接收到包数;
  • txpck/s ,每秒传输的报数;
  • (transmit packages)rxkB/s ,每秒接收的千字节数;
  • txkB/s ,每秒发送的千字节数;
  • rxcmp/s ,每秒接收的压缩包的数量;
  • txcmp/s ,每秒发送的压缩包的数量;
  • rxmcst/s,每秒接收的组数据包数量;
sar -n TCP,ETCP 1

该命令可以用于粗略的判断网络的吞吐量,如发起的网络连接数量和接收的网络连接数量;

  • TCP, 报告关于TCPv4网络流量的统计信息;
  • ETCP, 报告有关TCPv4网络错误的统计信息;
[root@ljh2020 ~]# sar -n TCP,ETCP 1
Linux 3.10.0-957.21.3.el7.x86_64 (ljh2020)  05/10/2020  _x86_64_ (2 CPU)
^C
10:42:47 PM  active/s passive/s    iseg/s    oseg/s
10:42:47 PM      0.00      0.00      7.14      9.52
10:42:47 PM  atmptf/s  estres/s retrans/s isegerr/s   orsts/s
10:42:47 PM      0.00      0.00      0.00      0.00      0.00
Average:     active/s passive/s    iseg/s    oseg/s
Average:         0.00      0.00      7.14      9.52
Average:     atmptf/s  estres/s retrans/s isegerr/s   orsts/s
Average:         0.00      0.00      0.00      0.00      0.00

检测的列

  • active/s: Number of locally-initiated TCP connections per second (e.g., via connect()),发起的网络连接数量;
  • passive/s: Number of remotely-initiated TCP connections per second (e.g., via accept()),接收的网络连接数量;
  • retrans/s: Number of TCP retransmits per second,重传的数量;
top

相当于Windows下的资源管理器,能够动态实时的显示系统中进程的资源占用情况。

[root@ljh2020 ~]# top
top - 22:46:26 up  4:53,  1 user,  load average: 0.08, 0.03, 0.05
Tasks:  76 total,   1 running,  75 sleeping,   0 stopped,   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 st
KiB Mem :  3688712 total,  3322636 free,   165132 used,   200944 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  3298336 avail Mem 
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                   
 1209 root      10 -10  122880  11352   8752 S   1.0  0.3   2:33.92 AliYunDun                 
  894 root      20   0   41860   3140   2452 S   0.3  0.1   0:14.16 aliyun-service            
    1 root      20   0   43396   3772   2580 S   0.0  0.1   0:00.67 systemd                   
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kthreadd                  
    3 root      20   0       0      0      0 S   0.0  0.0   0:00.00 ksoftirqd/0               
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.01 kworker/0:0H              
    7 root      rt   0       0      0      0 S   0.0  0.0   0:00.60 migration/0               
    8 root      20   0       0      0      0 S   0.0  0.0   0:00.00 rcu_bh                    
    9 root      20   0       0      0      0 S   0.0  0.0   0:01.17 rcu_sched                 
   10 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 lru-add-drain             
   11 root      rt   0       0      0      0 S   0.0  0.0   0:00.04 watchdog/0                
   12 root      rt   0       0      0      0 S   0.0  0.0   0:00.03 watchdog/1                
   13 root      rt   0       0      0      0 S   0.0  0.0   0:00.15 migration/1               

统计信息分析:
前五行是当前系统情况整体的统计信息区。

  • 第一行,任务队列信息,同 uptime 命令的执行结果,具体参数说明情况如下:
    22:46:26 — 当前系统时间
    up 4:53 — 系统运行时间
    1 users — 当前有1个用户登录系统
    load average: 1.15, 1.42, 1.44 — load average后面的三个数分别是1分钟、5分钟、15分钟的负载情况。
    load average数据是每隔5秒钟检查一次活跃的进程数,然后按特定算法计算出的数值。如果这个数除以逻辑CPU的数量,结果高于5的时候就表明系统在超负荷运转了。
  • 第二行,Tasks — 任务(进程),具体信息说明如下:
    系统现在共有76个进程,其中处于运行中的有1个,75个在休眠(sleep),stoped状态的有0个,zombie状态(僵尸)的有0个。
  • 第三行,cpu状态信息,具体属性说明如下:
    0.3%us — 用户空间占用CPU的百分比。
    0.3% sy — 内核空间占用CPU的百分比。
    0.0% ni — 改变过优先级的进程占用CPU的百分比
    99.3% id — 空闲CPU百分比
    0.0% wa — IO等待占用CPU的百分比
    0.0% hi — 硬中断(Hardware IRQ)占用CPU的百分比
    0.0% si — 软中断(Software Interrupts)占用CPU的百分比
  • 第四行,内存状态,具体信息如下:
    3688712k total — 物理内存总量
    3322636k used — 使用中的内存总量
    165132k free — 空闲内存总量
    200944k buffers — 缓存的内存量
  • 第五行,swap交换分区信息,具体信息说明如下:
    0k total — 交换区总量
    0k used — 使用的交换区总量
    0k free — 空闲交换区总量
    3298336k cached — 缓冲的交换区总量
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值