写在前面


  • 博文内容部分参考于《Linux性能优化》中文版一书,学习后记录,感兴趣小伙伴可以支持下译者
  • 博文涉及内容:
    • CPU相关的基础指标的解释:运行队列,平均负载,上下文切换,中断,CPU使用率
    • CPU监控信息统计的常用工具中关于CPU信息的统计方式:
      • vmstat
      • mpstat
      • sar
      • top(3.0)

人总是害怕去追求自己最重要的梦想,因为他们觉得自己不配拥有,或者觉得自己没有能力去完成。 ——保罗.柯艾略《牧羊少年奇幻之旅》


CPU相关的基础指标

运行队列统计

在Linux中,一个进程有可运行的,阻塞的(正在等待一个事件的完成)两种情况。阻塞进程可能在等待的是从I/O设备来的数据,或者是系统调用的结果。

如果进程是可运行的,那就意味着它要和其他也是可运行的进程竞争CPU时间。一个可运行的进程不一定会使用CPU,但是当Linux调度器决定下一个要运行的进程时,它会从可运行进程队列中挑选

如果进程是可运行的,同时又在等待使用处理器,这些进程就构成了运行队列。运行队列越长,处于等待状态的进程就越多 性能工具通常会给出可运行的进程个数和等待I/O的阻塞进程个数。

平均负载

系统的负载是指正在运行和可运行的进程总数。比如,如果正在运行的进程为两个,而可运行的进程为三个,那么系统负载就是5,平均负载是给定时间内的负载量。

上下文切换

制造出给定单处理器同时运行多个任务的假象, Linux内核就要不断地在不同的进程间切换。这种不同进程间的切换称为上下文切换

上下文切换时, CPU要保存旧进程的所有上下文信息,并取出新进程的所有上下文信息。上下文中包含了Linux跟踪新进程的大量信息,其中包括: 进程正在执行的指令,分配给进程的内存,进程打开的文件等

上下文切换涉及大量信息的移动,上下文切换的开销可以是相当大的

上下文切换可以是内核调度的结果。为了保证公平地给每个进程分配处理器时间,内核周期性地中断正在运行的进程, 在适当的情况下,内核调度器会决定开始另一个进程,而不是让当前进程继续执行。每次这种周期性中断或定时发生时,系统都可能进行上下文切换。每秒定时中断的次数与架构和内核版本有关

一个检查中断频率的简单方法是用/proc/interrupts文件,它可以确定已知时长内发生的中断次数

┌──[root@vms81.liruilongs.github.io]-[~]
└─$cat /proc/interrupts  | grep time; sleep 5 ;cat /proc/interrupts | grep time0:        337          0   IO-APIC-edge      timerLOC:    9896498    9871317   Local timer interrupts0:        337          0   IO-APIC-edge      timerLOC:    9901529    9876213   Local timer interrupts
┌──[root@vms81.liruilongs.github.io]-[~]
└─$

上面定时器的启动频率为(9896498-9901529)/5 =1000,即每秒要终端1000次,同时也可以理解为内核为sleep进程分配了1000次CPU,

如果你的上下文切换明显多于定时器中断,那么这些切换极有可能是由I/O请求或其他长时间运行的系统调用(如休眠)造成的。当应用请求的操作不能立即完成时,内核启动该操作,保存请求进程,并尝试切换到另一个已就绪进程。这能让处理器尽量保持忙状态。

中断

处理器还周期性地从硬件设备接收中断。当设备有事件需要内核处理时,它通常就会触发这些中断。

比如,如果磁盘控制器刚刚完成从驱动器取数据块的操作,并准备好提供给内核,那么磁盘控制器就会触发一个中断。对内核收到的每个中断,如果已经有相应的已注册的中断处理程序,就运行该程序,否则将忽略这个中断。

中断处理程序在系统中具有很高的运行优先级,并且通常执行速度也很快。查看/proc/interrupts文件可以显示出哪些CPU上触发了哪些中断。

┌──[root@vms81.liruilongs.github.io]-[~]
└─$cat /proc/interruptsCPU0       CPU10:        337          0   IO-APIC-edge      timer1:         10          0   IO-APIC-edge      i80428:          1          0   IO-APIC-edge      rtc09:          0          0   IO-APIC-fasteoi   acpi12:         16          0   IO-APIC-edge      i804214:          0          0   IO-APIC-edge      ata_piix15:          0          0   IO-APIC-edge      ata_piix17:      57939          0   IO-APIC-fasteoi   ioc018:         14       9800   IO-APIC-fasteoi   ens3224:          0          0   PCI-MSI-edge      PCIe PME, pciehp25:          0          0   PCI-MSI-edge      PCIe PME, pciehp26:          0          0   PCI-MSI-edge      PCIe PME, pciehp27:          0          0   PCI-MSI-edge      PCIe PME, pciehp
.......................THR:          0          0   Threshold APIC interruptsDFR:          0          0   Deferred Error APIC interruptsMCE:          0          0   Machine check exceptionsMCP:         37         37   Machine check pollsERR:          0MIS:          0PIN:          0          0   Posted-interrupt notification eventPIW:          0          0   Posted-interrupt wakeup event
┌──[root@vms81.liruilongs.github.io]-[~]
└─$

CPU使用率

在任何给定的时间, CPU可以执行以下七件事情中的一个
CPU可以是空闲的,这意味着处理器实际上没有做任何工作,并且等待有任务可以执行。
CPU可以运行用户代码,即指定的“用户”时间。
CPU可以执行Linux内核中的应用程序代码,这就是“系统”时间。
CPU可以执行“比较友好”的或者优先级被设置为低于一般进程的用户代码
CPU可以处于iowait状态,即系统正在等待10 (如磁盘或网络)完成。
CPU可以处于irq状态,即它正在用高优先级代码处理硬件中断。
CPU可以处于softirq模式,即系统正在执行同样由中断触发的内核代码,只不过其运行于较低优先级(下半部代码)

一个具有 高“系统”百分比 的系统表明其大部分时间都消耗在了内核上。像oprofile一样的工具可以帮助确定时间都消耗在了哪里。具有 高“用户”时间 的系统则将其大部分时间都用来运行应用程序。

CPU监控信息统计

vmstat (虚拟内存统计)

vmstat是一个很有用的命令,它能获取整个系统性能的粗略信息,包括:

  • 正在运行的进程个数
  • CPU的使用情况
  • CPU接收的中断个数
  • 调度器执行的上下文切换次数

语法

┌──(liruilong㉿Liruilong)-[/mnt/c/Users/lenovo]
└─$ vmstat -helpUsage:vmstat [options] [delay [count]]Options:-a, --active           active/inactive memory-f, --forks            number of forks since boot-m, --slabs            slabinfo-n, --one-header       do not redisplay header-s, --stats            event counter statistics-d, --disk             disk statistics-D, --disk-sum         summarize disk statistics-p, --partition <dev>  partition specific statistics-S, --unit <char>      define display unit-w, --wide             wide output-t, --timestamp        show timestamp-h, --help     display this help and exit-V, --version  output version information and exitFor more details see vmstat(8).┌──(liruilong㉿Liruilong)-[/mnt/c/Users/lenovo]
└─$

CPU性能相关的选项

$vmstat [-n] [-s] [delay [count ]]

vmstat运行于两种模式:采样模式平均模式。如果不指定参数,则vmstat统计运行于平均模式下.

vmstat显示从系统启动以来所有统计数据的均值。但是,如果指定了延迟,那么第一个采样仍然是系统启动以来的均值,但之后vmstat按延迟秒数采样系统并显示统计数据。

参数

-n 参数的区别

┌──[root@vms81.liruilongs.github.io]-[~]
└─$vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st2  0      0 1064772   2072 1764796    0    0    60    26 1501  832  8  4 87  1  00  0      0 1064964   2072 1764800    0    0     0    70 2993 4939 19  8 73  0  00  0      0 1064400   2072 1764800    0    0     0     0 2832 6916 24 10 66  0  0
..............0  0      0 1064156   2072 1764952    0    0     0    32 2449 3900  3  2 95  0  00  0      0 1064196   2072 1764860    0    0     0    16 2647 4124  6  2 91  0  0
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st4  0      0 1058828   2072 1764860    0    0     0    24 3121 5182  8  4 88  0  01  0      0 1064608   2072 1764820    0    0     0     0 3070 5297 10  6 83  0  00  0      0 1064608   2072 1764820    0    0     0    32 2674 4136  3  2 95  0  00  0      0 1064296   2072 1764820    0    0     0     0 2560 3943  3  1 95  0  0
^C
┌──[root@vms81.liruilongs.github.io]-[~]
└─$vmstat -n  1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st1  0      0 1063952   2072 1764808    0    0    59    26 1501  838  8  4 87  1  07  0      0 1064472   2072 1764812    0    0     0    38 2869 4611  9  4 87  0  02  0      0 1063476   2072 1764876    0    0     0    28 3467 8176 31 15 54  0  00  0      0 1063476   2072 1764876    0    0     0     0 2482 3629 14  2 84  0  00  0      0 1063476   2072 1764876    0    0     0    28 2459 3691  3  2 96  0  00  0      0 1063368   2072 1764864    0    0     0    36 2691 4061  5  1 94  0  00  0      0 1062864   2072 1764864    0    0     0    44 2714 4420  6  2 92  0  00  0      0 1063104   2072 1764864    0    0     0    32 2963 4514  8  3 88  0  0
............1  0      0 1063868   2072 1765000    0    0     0   107 2657 6989 33 14 52  0  00  0      0 1063868   2072 1765000    0    0     0     0 2830 4315  6  3 91  0  00  0      0 1063868   2072 1765000    0    0     0    28 2430 3908  5  3 92  0  00  0      0 1063868   2072 1765000    0    0     0     0 2358 3551  2  2 96  0  0
.........1  0      0 1064136   2072 1765112    0    0     0     0 2736 4000  6  3 91  0  04  0      0 1063764   2072 1765112    0    0     0    48 2492 3779  5  2 93  1  00  0      0 1063484   2072 1765112    0    0     0     0 2650 4071  4  2 94  0  00  0      0 1063304   2072 1765116    0    0     0    99 2727 4430  7  3 90  0  00  0      0 1063392   2072 1765116    0    0     0    12 2554 3811  2  1 97  0  00  0      0 1064012   2072 1765120    0    0     0    48 2585 4291 14  5 81  0  00  0      0 1064136   2072 1765120    0    0     0     0 2576 4057  4  2 94  0  0
^C
┌──[root@vms81.liruilongs.github.io]-[~]
└─$

-s 的统计

┌──[root@vms81.liruilongs.github.io]-[~]
└─$vmstat -s4030172 K total memory1199020 K used memory1277200 K active memory1428408 K inactive memory1064028 K free memory2072 K buffer memory1765052 K swap cache0 K total swap0 K used swap0 K free swap206387 non-nice user cpu ticks3 nice user cpu ticks100381 system cpu ticks2184710 idle cpu ticks12604 IO-wait cpu ticks0 IRQ cpu ticks4699 softirq cpu ticks0 stolen cpu ticks1473622 pages paged in652550 pages paged out0 pages swapped in0 pages swapped out37633050 interrupts64361523 CPU context switches1642162657 boot time210962 forks
┌──[root@vms81.liruilongs.github.io]-[~]
└─$

CPU相关的列名含义

CPU相关的列名含义

vmstat的开销很低,可以让它在控制台上或窗口中持续运行,甚至是在负载非常重的服务器上是很实用的。

┌──[root@vms81.liruilongs.github.io]-[~]
└─$vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st2  0      0 1057540   2072 1761012    0    0    68    27 1501  595  8  4 87  1  0
┌──[root@vms81.liruilongs.github.io]-[~]
└─$

查看CPU平均值,当前系统中,可运行进程为2®,被阻塞的进程为0(b),系统发生中断次数1501(in),系统发生上下文切换次数为595(cs),系统代码消耗CPU为4%(sy),用户代码消耗CPU为8%(us),系统空闲占比87%(id),剩余1%属于等待IO消耗的CPU空闲状态(wa),

上下文切换的数量小于中断的数量。调度器切换进程的次数少于定时器中断触发的次数 。这很可能是因为系统基本上是空闲的,在定时器中断触发的大多数时候,调度器没有任何工作要做,因此它也不需要从空闲进程切换出去。

CPU 统计的含义

┌──[root@vms81.liruilongs.github.io]-[~]
└─$vmstat -s..........206387 non-nice user cpu ticks3 nice user cpu ticks100381 system cpu ticks2184710 idle cpu ticks12604 IO-wait cpu ticks0 IRQ cpu ticks4699 softirq cpu ticks0 stolen cpu ticks............37633050 interrupts64361523 CPU context switches...........210962 forks

这里的ticks为一个时间单位,相关数据为自系统启动时间以来的数据。forks表示系统创建以来的进程数,CPU context switches表示上下文文切换次数,interrupts即中断次数,剩下的参数对应上面的列理解即可,stolen cpu 这个不太理解

top(3.0.X 版本)

top 小伙伴应该不陌生,不多讲,直接看语法

语法

┌──[root@vms81.liruilongs.github.io]-[~]
└─$top -helpprocps-ng version 3.3.10
Usage:top -hv | -bcHiOSs -d secs -n max -u|U user -p pid(s) -o field -w [cols]
┌──[root@vms81.liruilongs.github.io]-[~]
└─$

top呈现为一个降序列表,排在最前面的是最占用CPU的进程。

CPU性能相关的选项

$top [-d delay] [-n iter] [-i] [-b]

top实际有两种模式的选项:命令行选项运行时选项

命令行选项

命令行选项决定top如何显示其信息。

命令行选项

下面问间隔3s统计2次的top信息

┌──[root@vms81.liruilongs.github.io]-[~]
└─$top -d 3 -n 2
top - 09:26:22 up 13:08,  1 user,  load average: 0.56, 0.48, 0.55
Tasks: 215 total,   1 running, 214 sleeping,   0 stopped,   0 zombie
%Cpu(s):  9.9 us,  5.5 sy,  0.0 ni, 84.3 id,  0.2 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem :  4030172 total,  1079708 free,  1204872 used,  1745592 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  2470484 avail MemPID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND2195 root      20   0 1174904 380988  47392 S  10.0  9.5  95:15.71 kube-apiserver963 root      20   0 1777988 142376  59968 S   5.6  3.5  41:04.34 kubelet2204 root      20   0  823728  98312  36136 S   5.6  2.4  47:06.26 kube-controller4348 root      20   0 1657820  47488  21052 S   5.3  1.2  42:28.29 calico-node2266 root      20   0 10.696g  77632  19904 S   3.0  1.9  23:51.16 etcd1121 root      20   0 1369820  85076  28388 S   2.7  2.1  15:55.04 dockerd973 root      20   0 1099192  43512  16860 S   0.7  1.1   4:32.81 containerd3057 root      20   0  737756  29904  12424 S   0.7  0.7   3:34.82 speaker3564 root      20   0  713096  15152   4312 S   0.7  0.4   1:50.31 containerd-shim4313 root      20   0  713096  15596   4256 S   0.7  0.4   1:25.70 containerd-shim9 root      20   0       0      0      0 S   0.3  0.0   2:05.06 rcu_sched13 root      20   0       0      0      0 S   0.3  0.0   0:07.26 ksoftirqd/12214 root      20   0  754268  41856  19352 S   0.3  1.0   4:25.88 kube-scheduler3774 root      20   0  751232  34032  15932 S   0.3  0.8   1:25.77 coredns4261 root      20   0  751488  30832  15880 S   0.3  0.8   1:30.06 coredns4369 polkitd   20   0  745532  33232  14124 S   0.3  0.8   0:21.00 kube-controller1 root      20   0  191024   4028   2516 S   0.0  0.1   0:47.38 systemd2 root      20   0       0      0      0 S   0.0  0.0   0:00.05 kthreadd3 root      20   0       0      0      0 S   0.0  0.0   0:07.85 ksoftirqd/04 root      20   0       0      0      0 S   0.0  0.0   0:06.99 kworker/0:0
.......

下面为只显示非空闲进程

┌──[root@vms81.liruilongs.github.io]-[~]
└─$top -i
top - 09:35:45 up 13:18,  1 user,  load average: 0.17, 0.45, 0.53
Tasks: 216 total,   3 running, 213 sleeping,   0 stopped,   0 zombie
%Cpu(s):  7.4 us,  3.2 sy,  0.0 ni, 89.1 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem :  4030172 total,  1070632 free,  1213464 used,  1746076 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  2461980 avail MemPID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND2195 root      20   0 1174904 380988  47392 S  14.3  9.5  96:25.19 kube-apiserver2204 root      20   0  823728  98312  36136 S   6.3  2.4  47:40.78 kube-controller4348 root      20   0 1657820  47516  21052 S   5.3  1.2  42:59.36 calico-node963 root      20   0 1777988 141712  59968 S   4.3  3.5  41:34.55 kubelet2266 root      20   0 10.696g  78684  19904 S   3.3  2.0  24:08.17 etcd40370 root      20   0  745236  17168   8388 R   2.3  0.4   0:00.07 calico1121 root      20   0 1369820  85496  28388 S   1.7  2.1  16:06.78 dockerd2214 root      20   0  754268  41856  19352 S   0.7  1.0   4:28.98 kube-scheduler3057 root      20   0  737756  30136  12424 S   0.7  0.7   3:37.40 speaker9 root      20   0       0      0      0 S   0.3  0.0   2:06.53 rcu_sched3023 root      20   0  713096  12892   3636 S   0.3  0.3   0:05.56 containerd-shim┌──[root@vms81.liruilongs.github.io]-[~]
└─$

-b 显示全部的进程,默认只显示当前的页能容纳的进程

┌──[root@vms81.liruilongs.github.io]-[~]
└─$top -d 3 -n 1 -b
top - 09:31:42 up 13:14,  1 user,  load average: 1.21, 0.70, 0.61
Tasks: 215 total,   1 running, 214 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.6 us,  3.6 sy,  0.0 ni, 92.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  4030172 total,  1078040 free,  1206028 used,  1746104 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  2469136 avail MemPID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND963 root      20   0 1777988 141592  59968 S  12.5  3.5  41:21.46 kubelet36906 root      20   0  157716   2124   1496 R  12.5  0.1   0:00.02 top2195 root      20   0 1174904 380988  47392 S   6.2  9.5  95:55.13 kube-apiserver2266 root      20   0 10.696g  78684  19904 S   6.2  2.0  24:00.85 etcd3057 root      20   0  737756  30460  12424 S   6.2  0.8   3:36.32 speaker4348 root      20   0 1657820  47304  21052 S   6.2  1.2  42:45.70 calico-node1 root      20   0  191024   4028   2516 S   0.0  0.1   0:47.68 systemd2 root      20   0       0      0      0 S   0.0  0.0   0:00.05 kthreadd3 root      20   0       0      0      0 S   0.0  0.0   0:07.90 ksoftirqd/04 root      20   0       0      0      0 S   0.0  0.0   0:07.03 kworker/0:0........31 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kswapd032 root      25   5       0      0      0 S   0.0  0.0   0:00.00 ksmd33 root      39  19       0      0      0 S   0.0  0.0   0:01.02 khugepaged34 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 crypto42 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kthrotld44 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kmpath_rdacd45 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kpsmoused46 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/0:2........259 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 scsi_tmf_4260 root      20   0       0      0      0 S   0.0  0.0   0:00.00 scsi_eh_6261 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 scsi_tmf_6262 root      20   0       0      0      0 S   0.0  0.0   0:00.00 scsi_eh_7.........273 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 scsi_tmf_12274 root      20   0       0      0      0 S   0.0  0.0   0:00.00 scsi_eh_13275 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 scsi_tmf_13276 root      20   0       0      0      0 S   0.0  0.0   0:00.00 scsi_eh_14277 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 scsi_tmf_14278 root      20   0       0      0      0 S   0.0  0.0   0:00.00 scsi_eh_15279 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 scsi_tmf_15...........4297 root      20   0    4228    400    328 S   0.0  0.0   0:00.00 runsv4313 root      20   0  713096  15340   4256 S   0.0  0.4   1:26.26 containerd-shim4344 root      20   0 1141184  35748  16600 S   0.0  0.9   0:08.70 calico-node4345 root      20   0 1583576  39300  18152 S   0.0  1.0   0:08.09 calico-node4346 root      20   0 1141184  36808  17568 S   0.0  0.9   0:11.15 calico-node4369 polkitd   20   0  745532  33232  14124 S   0.0  0.8   0:21.13 kube-controller4526 root      20   0     756    260    196 S   0.0  0.0   0:24.63 bird64534 root      20   0     772    520    340 S   0.0  0.0   0:24.92 bird14142 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/u256:121599 root      20   0       0      0      0 S   0.0  0.0   0:00.21 kworker/1:126382 root      20   0       0      0      0 S   0.0  0.0   0:00.49 kworker/1:035491 root      20   0       0      0      0 S   0.0  0.0   0:00.00 kworker/1:277429 root      20   0  148316   5532   4232 S   0.0  0.1   0:00.50 sshd77553 root      20   0  120900   7556   1704 S   0.0  0.2   0:00.18 bash83235 root      20   0       0      0      0 S   0.0  0.0   0:01.76 kworker/u256:087183 postfix   20   0   89648   4024   3012 S   0.0  0.1   0:00.01 pickup
┌──[root@vms81.liruilongs.github.io]-[~]
└─$
运行时top选项
运行时top

输入 A 后,显示为各个系统资源的最大消耗者,这个看不太懂,以后再研究

┌──[root@vms81.liruilongs.github.io]-[~]
└─$top -i
1:Def - 09:40:01 up 13:22,  1 user,  load average: 0.17, 0.35, 0.47
Tasks: 215 total,   1 running, 214 sleeping,   0 stopped,   0 zombie
%Cpu(s): 11.6 us,  6.6 sy,  0.0 ni, 81.6 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem :  4030172 total,  1076864 free,  1206808 used,  1746500 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  2468492 avail Mem1   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND2204 root      20   0  823728  98312  36136 S   6.3  2.4  47:55.47 kube-controller4348 root      20   0 1657820  47444  21052 S   5.3  1.2  43:12.72 calico-node1121 root      20   0 1369820  85496  28388 S   2.6  2.1  16:11.81 dockerd2266 root      20   0 10.696g  78948  19904 S   2.6  2.0  24:15.45 etcd973 root      20   0 1099192  43784  16860 S   1.0  1.1   4:37.63 containerd2214 root      20   0  754268  41856  19352 S   0.7  1.0   4:30.34 kube-scheduler1 root      20   0  191024   4028   2516 S   0.3  0.1   0:48.12 systemd
2   PID   PPID     TIME+  %CPU %MEM  PR  NI S    VIRT    RES   UID COMMAND83235      2   0:01.82   0.0  0.0  20   0 S       0      0     0 kworker/u256:077553  77429   0:00.20   0.0  0.2  20   0 S  120900   7556     0 bash77429    966   0:00.71   0.0  0.1  20   0 S  148316   5532     0 sshd43368   1085   0:00.02   0.0  0.1  20   0 S   89648   4024    89 pickup40247      2   0:00.17   0.3  0.0  20   0 S       0      0     0 kworker/1:140239  77553   0:01.26   0.3  0.1  20   0 R  157720   2332     0 top                                      35491      2   0:00.00   0.0  0.0  20   0 S       0      0     0 kworker/1:2
3   PID %MEM    VIRT    RES   CODE    DATA    SHR nMaj nDRT  %CPU COMMAND2195  9.5 1174904 380988  60052 1052908  47392   33    0   8.9 kube-apiserver963  3.5 1778244 141228  88848 1618204  59968  520    0   7.0 kubelet2204  2.4  823728  98312  56280  708052  36136   33    0   6.3 kube-controller1121  2.1 1369820  85496  57240 1239752  28388   34    0   2.6 dockerd2266  2.0 10.696g  78948  11824  706828  19904    6    0   2.6 etcd4348  1.2 1657820  47444  30688 1590736  21052    0    0   5.3 calico-node973  1.1 1099192  43784  33752 1041340  16860  488    0   1.0 containerd2214  1.0  754268  41856  23924  706288  19352   16    0   0.7 kube-scheduler
4   PID   PPID   UID USER     RUSER    TTY          TIME+  %CPU %MEM S COMMAND975      1    29 rpcuser  rpcuser  ?          0:00.01   0.0  0.0 S rpc.statd567      1    32 rpc      rpc      ?          0:00.19   0.0  0.0 S rpcbind1      0     0 root     root     ?          0:48.12   0.3  0.1 S systemd2      0     0 root     root     ?          0:00.05   0.0  0.0 S kthreadd3      2     0 root     root     ?          0:07.97   0.0  0.0 S ksoftirqd/04      2     0 root     root     ?          0:07.09   0.0  0.0 S kworker/0:05      2     0 root     root     ?          0:00.00   0.0  0.0 S kworker/0:0H7      2     0 root     root     ?          0:01.09   0.0  0.0 S migration/0

输入F时进入配置界面,通过界面显示可以配置详细信息

┌──[root@vms81.liruilongs.github.io]-[~]
└─$top -i
top - 09:48:03 up 13:30,  1 user,  load average: 0.85, 0.64, 0.57
Tasks: 215 total,   1 running, 214 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.4 us,  3.4 sy,  0.0 ni, 93.1 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  4030172 total,  1076900 free,  1206184 used,  1747088 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  2469016 avail MemPID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND2204 root      20   0  823728  98312  36136 S  12.5  2.4  48:24.22 kube-controller963 root      20   0 1778244 142228  59968 S   6.2  3.5  42:12.13 kubelet2266 root      20   0 10.696g  79468  19904 S   6.2  2.0  24:29.30 etcd4348 root      20   0 1657820  47396  21052 S   6.2  1.2  43:37.87 calico-node50999 root      20   0  157720   2200   1500 R   6.2  0.1   0:00.01 top
Fields Management for window 1:Def, whose current sort field is %CPUNavigate with Up/Dn, Right selects for move then <Enter> or Left commits,'d' or <Space> toggles display, 's' sets sort.  Use 'q' or <Esc> to end!* PID     = Process Id             SUPGIDS = Supp Groups IDs
* USER    = Effective User Name    SUPGRPS = Supp Groups Names
* PR      = Priority               TGID    = Thread Group Id
* NI      = Nice Value             ENVIRON = Environment vars
* VIRT    = Virtual Image (KiB)    vMj     = Major Faults delta
* RES     = Resident Size (KiB)    vMn     = Minor Faults delta
* SHR     = Shared Memory (KiB)    USED    = Res+Swap Size (KiB)
* S       = Process Status         nsIPC   = IPC namespace Inode
* %CPU    = CPU Usage              nsMNT   = MNT namespace Inode
* %MEM    = Memory Usage (RES)     nsNET   = NET namespace Inode
* TIME+   = CPU Time, hundredths   nsPID   = PID namespace Inode
* COMMAND = Command Name/Line      nsUSER  = USER namespace InodePPID    = Parent Process pid     nsUTS   = UTS namespace InodeUID     = Effective User IdRUID    = Real User IdRUSER   = Real User NameSUID    = Saved User IdSUSER   = Saved User NameGID     = Group IdGROUP   = Group NamePGRP    = Process Group IdTTY     = Controlling TtyTPGID   = Tty Process Grp IdSID     = Session IdnTH     = Number of ThreadsP       = Last Used Cpu (SMP)TIME    = CPU TimeSWAP    = Swapped Size (KiB)CODE    = Code Size (KiB)DATA    = Data+Stack (KiB)nMaj    = Major Page FaultsnMin    = Minor Page FaultsnDRT    = Dirty Pages CountWCHAN   = Sleeping in FunctionFlags   = Task Flags <sched.h>CGROUPS = Control Groups

在配置统计信息时,所有当前被选择的字段将会以大写形式显示在Current Field. Order行,并在其名称旁出现一个星号(*),使用d来选择删除,使用s保存,q退出

修改只留5个列名展示

Fields Management for window 1:Def, whose current sort field is %CPUNavigate with Up/Dn, Right selects for move then <Enter> or Left commits,'d' or <Space> toggles display, 's' sets sort.  Use 'q' or <Esc> to end!* PID     = Process Id             SUPGIDS = Supp Groups IDs
* USER    = Effective User Name    SUPGRPS = Supp Groups NamesPR      = Priority               TGID    = Thread Group IdNI      = Nice Value             ENVIRON = Environment varsVIRT    = Virtual Image (KiB)    vMj     = Major Faults deltaRES     = Resident Size (KiB)    vMn     = Minor Faults deltaSHR     = Shared Memory (KiB)    USED    = Res+Swap Size (KiB)S       = Process Status         nsIPC   = IPC namespace Inode
* %CPU    = CPU Usage              nsMNT   = MNT namespace Inode
* %MEM    = Memory Usage (RES)     nsNET   = NET namespace InodeTIME+   = CPU Time, hundredths   nsPID   = PID namespace Inode
* COMMAND = Command Name/Line      nsUSER  = USER namespace InodePPID    = Parent Process pid     nsUTS   = UTS namespace InodeUID     = Effective User IdRUID    = Real User IdRUSER   = Real User NameSUID    = Saved User IdSUSER   = Saved User NameGID     = Group IdGROUP   = Group NamePGRP    = Process Group IdTTY     = Controlling Tty
.....

返回后发现只显示了5列

top - 09:55:38 up 13:38,  1 user,  load average: 2.16, 1.20, 0.80
Tasks: 215 total,   2 running, 213 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.1 us,  4.7 sy,  0.0 ni, 87.0 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 st
KiB Mem :  4030172 total,  1085120 free,  1197260 used,  1747792 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  2477772 avail MemPID USER      %CPU %MEM COMMAND2195 root      14.3  9.5 kube-apiserver2266 root       8.0  1.7 etcd2204 root       6.0  2.4 kube-controller4348 root       5.0  1.2 calico-node963 root       4.7  3.5 kubelet1121 root       1.3  2.1 dockerd3057 root       0.7  0.8 speaker9 root       0.3  0.0 rcu_sched542 root       0.3  0.2 vmtoolsd973 root       0.3  1.1 containerd2214 root       0.3  1.0 kube-scheduler49390 root       0.3  0.0 kworker/1:2

top性能统计信息

top性能统计信息

%Cpu(s): 5.3 us(用户消耗), 2.8 sy(系统消耗), 0.0 ni(友好值进程消耗), 91.9 id(空闲CPU), 0.0 wa(等待I/O的CPU时间), 0.0 hi(irp处理程序消耗的CPU时间), 0.0 si(softirq处理消耗), 0.0 st(这个不知道)

top - 09:26:22 up 13:08, 1 user, load average: 0.56, 0.48, 0.55(1分钟、5分钟和15分钟的平均负载)

列名 command为当前进程执行的命令,更多小伙伴可以结合命令列表理解

mpstat (多处理器统计)

mpstat是一个相当简单的命令,向你展示随着时间变化的CPU行为。mpstat最大的优点是在统计信息的旁边显示时间,由此,你可以找出CPU使用率与时间的关系。

如果你有多个CPU或超线程CPU, mpstat还能够把CPU使用率按处理器进行区分,因此你可以发现与其他处理器相比,是否某个处理器做了更多的工作。你可以选择想要监控的单个处理器,也可以要求mpstat对所有的处理器都进行监控。

语法

┌──[root@liruilongs.github.io]-[~]
└─$ mpstat -help
用法: mpstat [ 选项 ] [ <时间间隔> [ <次数> ] ]
选项:
[ -A ] [ -u ] [ -V ] [ -I { SUM | CPU | SCPU | ALL } ]
[ -P { <cpu> [,...] | ON | ALL } ]
┌──[root@liruilongs.github.io]-[~]
└─$

CPU性能相关的选项

mpstat -P { cpu | ALL} | delay [ count ]]
CPU性能相关的选项

使用-P监控0所在的CPU

┌──[root@liruilongs.github.io]-[~]
└─$ mpstat  -P 0
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)11时31分09秒  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
11时31分09秒    0    0.53    0.00    0.53    0.06    0.00    0.06    0.00    0.00    0.00   98.82
┌──[root@liruilongs.github.io]-[~]
└─$ mpstat  -P 1
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)11时31分13秒  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
11时31分13秒    1    0.52    0.00    0.53    0.06    0.00    0.05    0.00    0.00    0.00   98.84
┌──[root@liruilongs.github.io]-[~]
└─$

监控所有的CPU

┌──[root@liruilongs.github.io]-[~]
└─$ mpstat  -P ALL
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)11时35分17秒  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
11时35分17秒  all    0.53    0.00    0.53    0.06    0.00    0.06    0.00    0.00    0.00   98.83
11时35分17秒    0    0.53    0.00    0.53    0.06    0.00    0.06    0.00    0.00    0.00   98.82
11时35分17秒    1    0.52    0.00    0.52    0.06    0.00    0.05    0.00    0.00    0.00   98.84
┌──[root@liruilongs.github.io]-[~]
└─$

监控3次,间隔1秒

┌──[root@liruilongs.github.io]-[~]
└─$ mpstat  -P 0 1 3
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)11时33分15秒  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
11时33分16秒    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11时33分17秒    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11时33分18秒    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
平均时间:    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
┌──[root@liruilongs.github.io]-[~]
└─$
CPU统计信息
┌──[root@liruilongs.github.io]-[~]
└─$ mpstat  -P ALL 1 2
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)11时37分52秒  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
11时37分53秒  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11时37分53秒    0    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
11时37分53秒    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.0011时37分53秒  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
11时37分54秒  all    0.51    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.49
11时37分54秒    0    1.02    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   98.98
11时37分54秒    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00平均时间:  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
平均时间:  all    0.26    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.74
平均时间:    0    0.51    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.49
平均时间:    1    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
┌──[root@liruilongs.github.io]-[~]
└─$

sar (系统活动报告)

sar是一种低开销的、记录系统执行情况信息的方法

sar命令可以用于记录性能信息,回放之前的记录信息,以及显示当前系统的实时信息。sar命令的输出可以进行格式化,使之易于导入数据库,或是输送给其他Linux命令进行处理。

如果没有命令,可以启动服务看看

┌──[root@liruilongs.github.io]-[/usr/lib/systemd/system]
└─$ pwd
/usr/lib/systemd/system
┌──[root@liruilongs.github.io]-[/usr/lib/systemd/system]
└─$ cat sysstat.service
# /usr/lib/systemd/system/sysstat.service
# (C) 2012 Peter Schiffer (pschiffe <at> redhat.com)
#
# sysstat-10.1.5 systemd unit file:
#        Insert a dummy record in current daily data file.
#        This indicates that the counters have restarted from 0.[Unit]
Description=Resets System Activity Logs[Service]
Type=oneshot
RemainAfterExit=yes
User=root
ExecStart=/usr/lib64/sa/sa1 --boot[Install]
WantedBy=multi-user.target┌──[root@liruilongs.github.io]-[/usr/lib/systemd/system]
└─$ systemctl status  sysstat.service
● sysstat.service - Resets System Activity LogsLoaded: loaded (/usr/lib/systemd/system/sysstat.service; enabled; vendor preset: enabled)Active: active (exited) since Wed 2021-10-13 01:53:41 CST; 1 weeks 3 days agoMain PID: 584 (code=exited, status=0/SUCCESS)CGroup: /system.slice/sysstat.serviceOct 13 01:53:41 liruilongs.github.io systemd[1]: Starting Resets System Activity Logs...
Oct 13 01:53:41 liruilongs.github.io systemd[1]: Started Resets System Activity Logs.

语法

命令帮助文档

┌──[root@liruilongs.github.io]-[~]
└─$ sar  -h
用法: sar [ 选项 ] [ <时间间隔> [ <次数> ] ]
主选项和报告:-b      I/O 和传输速率信息状况-B      分页状况-d      块设备状况-F [ MOUNT ]Filesystems statistics-H      交换空间利用率-I { <中断> | SUM | ALL | XALL }中断信息状况-m { <关键词> [,...] | ALL }电源管理统计信息关键字:CPU     CPU 频率FAN     风扇速度
\t\tFREQ\tCPU 平均时钟频率IN      输入电压TEMP    设备温度
\t\tUSB\t连接的USB 设备-n { <关键词> [,...] | ALL }网络统计信息关键词可以是:DEV     网卡EDEV    网卡 (错误)NFS     NFS 客户端NFSD    NFS 服务器SOCK    Sockets (套接字)        (v4)IP      IP 流   (v4)EIP     IP 流   (v4) (错误)ICMP    ICMP 流 (v4)EICMP   ICMP 流 (v4) (错误)TCP     TCP 流  (v4)ETCP    TCP 流  (v4) (错误)UDP     UDP 流  (v4)SOCK6   Sockets (套接字)        (v6)IP6     IP 流   (v6)EIP6    IP 流   (v6) (错误)ICMP6   ICMP 流 (v6)EICMP6  ICMP 流 (v6) (错误)UDP6    UDP 流  (v6)-q      队列长度和平均负载-r      内存利用率-R      内存状况-S      交换空间利用率-u [ ALL ]CPU 利用率-v      Kernel table 状况-w      任务创建与系统转换统计信息-W      交换信息-y      TTY 设备状况
┌──[root@liruilongs.github.io]-[~]
└─$

红帽8没有,需要自己开启,红帽7有,下面为历史监控的存放位置

┌──[root@liruilongs.github.io]-[/]
└─$ cd /var/log/sa
┌──[root@liruilongs.github.io]-[/var/log/sa]
└─$ ls
sa01  sa03  sa04  sa05  sa06  sa08  sa09  sa13  sa14  sa23  sa24  sa30  sar03

CPU性能相关的选项

$sar [options] [] delay [ count ]]

尽管sar的报告涉及Linux多个不同领域,其统计数据有两种不同的形式。一组统计数据是采样时的瞬时值。另一组则是自上一次采样后的变化值。

sar命令行选项
┌──[root@liruilongs.github.io]-[~]
└─$ sar
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)11时00分01秒     CPU     %user     %nice   %system   %iowait    %steal     %idle
11时10分01秒     all      0.12      0.00      0.12      0.00      0.00     99.76
11时20分01秒     all      0.11      0.00      0.11      0.00      0.00     99.78
11时30分01秒     all      0.13      0.00      0.13      0.00      0.00     99.73
11时40分01秒     all      0.11      0.00      0.11      0.00      0.00     99.78
平均时间:     all      0.12      0.00      0.12      0.00      0.00     99.76

使用 -o 选项输出到指定文件

┌──[root@liruilongs.github.io]-[~]
└─$ sar -o /tmp/apache_tets 1 3
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)18时02分24秒     CPU     %user     %nice   %system   %iowait    %steal     %idle
18时02分25秒     all      0.00      0.00      0.56      0.00      0.00     99.44
18时02分26秒     all      0.00      0.00      0.00      0.00      0.00    100.00
18时02分27秒     all      0.00      0.00      0.00      0.00      0.00    100.00
平均时间:     all      0.00      0.00      0.18      0.00      0.00     99.82

通过 -f 来查看指定文件信息

┌──[root@liruilongs.github.io]-[~]
└─$ sar -f /tmp/apache_tets
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)18时02分24秒     CPU     %user     %nice   %system   %iowait    %steal     %idle
18时02分25秒     all      0.00      0.00      0.56      0.00      0.00     99.44
18时02分26秒     all      0.00      0.00      0.00      0.00      0.00    100.00
18时02分27秒     all      0.00      0.00      0.00      0.00      0.00    100.00
平均时间:     all      0.00      0.00      0.18      0.00      0.00     99.82
┌──[root@liruilongs.github.io]-[~]
└─$

使用 -P指定CPU

┌──[root@liruilongs.github.io]-[~]
└─$ sar -P 0  | head -5
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)11时00分01秒     CPU     %user     %nice   %system   %iowait    %steal     %idle
11时10分01秒       0      0.12      0.00      0.12      0.01      0.00     99.75
11时20分01秒       0      0.12      0.00      0.11      0.00      0.00     99.77
┌──[root@liruilongs.github.io]-[~]
└─$

-w 上下文切换次数

┌──[root@liruilongs.github.io]-[~]
└─$ sar -P 0 -w | head -5
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)11时00分01秒    proc/s   cswch/s
11时10分01秒      0.92    313.58
11时20分01秒      0.81    316.81
┌──[root@liruilongs.github.io]-[~]
└─$

-q 运行队列长度和平均负载

┌──[root@liruilongs.github.io]-[~]
└─$ sar  -q | head -5
Linux 3.10.0-693.el7.x86_64 (liruilongs.github.io)      2022年01月15日  _x86_64_        (2 CPU)11时00分01秒   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
11时10分01秒         0       219      0.01      0.08      0.53         0
11时20分01秒         0       219      0.03      0.03      0.29         0
sar CPU统计信息

procinfo (从/proc文件系统显示信息)

procinfo也为系统整体信息特性提供总览,它提供的有些信息与vmstat相同,但它还会给出CPU从每个设备接收的中断数量

CPU性能相关的选项

$procinfo [-f] [-d] [-D] [-n sec] [-f file]

嗯,这个命令没找到,以后再研究下

gnome-system-monitor

嗯,用SSH连接的机器,这个也以后再研究下

oprofile

oprofile是性能工具包,它利用几乎所有现代处理器都有的性能计数器来跟踪系统整体以及单个进程中CPU时间的消耗情况。除了测量CPU周期消耗在哪里之外, oprofile还可以测量关于CPU执行的非常底层的信息。

根据由底层处理器支持的事件,它可以测量的内容包括: cache缺失、分支预测错误和内存引用,以及浮点操作。profile不会记录发生的每个事件,相反,它与处理器性能硬件一起工作,每count个事件采样一次,这里的count是一个数值,由用户在启动oprofile时指定。count的值越·低,结果的准确度越高,而oprofile的开销越大。若count保持在一个合理的数值,那么,oprofile不仅运行开销非常低,并且还能以令人惊讶的准确性描述系统性能。

┌──[root@liruilongs.github.io]-[~]
└─$ yum -y install oprofile

CPU性能相关的选项

oprofile实际上是一组协同工作的组件,用于收集CPU性能统计信息。oprofile主要有三个部分:

  • oprofile核心模块控制处理器并允许和禁止采样,
  • oprofile后台模块收集采样,并将它们保存到磁盘。
  • oprofile报告工具获取收集的采样,并向用户展示它们与在系统上运行的应用程序的关系

oprofile工具包使用opcontrol命令中。opcontrol命令用于选择处理器采样的事件并启动采样。进行后台控制时,你可以使用如下命令行调用

$opcontrol [--start] [--stop] [--dump]
┌──[root@liruilongs.github.io]-[~]
└─$ opcontrol -s
ATTENTION: Use of opcontrol is discouraged.  Please see the man page for operf.
No vmlinux file specified. You must specify the correct vmlinux file, e.g.
opcontrol --vmlinux=/path/to/vmlinux
If you do not have a vmlinux file, use
opcontrol --no-vmlinux
Enter opcontrol --help for full options

这个貌似有些复杂,先不看了,之后遇到有机会再学习

关于CPU的性能调优工具就学到这里,欢迎小伙伴指正

关于Linux性能调优中系统CPU监测信息统计的一些笔记相关推荐

  1. 运维基础(9)Linux性能调优三大系统

    这个系统好慢.网站又打不开了,太卡了,又没响应了!"相信大家都遇到过这种抱怨,这是应用系统出现了性能问题,需要性能调优. 性能调优,要求对计算机硬件.操作系统和应用有相当深入的了解. 调节三 ...

  2. 关于Linux性能调优中磁盘IO调优的一些笔记

    写在前面 和小伙伴分享一些Linux 磁盘 IO优化的笔记,内容很浅,可以用作入门 博文内容结合<Linux性能优化>读书笔记整理 涉及内容包括 使用vmstat 统计系统内磁盘分区I/O ...

  3. Linux性能调优用这个“必杀技”,稳了!

    " "这个系统好慢.网站又打不开了,太卡了,又没响应了!"相信大家都遇到过这种抱怨,这是应用系统出现了性能问题,需要性能调优. 性能调优,要求对计算机硬件.操作系统和应用 ...

  4. linux性能调优命令精华

    linux性能调优命令精华 2010年07月18日 linux性能调优命令精华 时间:2010-6-23 一. 查看硬盘读取速度 命令:hdparm -t /dev/sda5 打印:Timing bu ...

  5. JVM性能调优中的命令总结

    1. jps jps主要用来输出JVM中运行的进程状态信息. -q只输出进程ID,而不输出类的短名称 -m用于输出传递给Java进程(主函数)的参数 -l完整路径 -v显示传递给jvm的参数 2. j ...

  6. 理解统计信息(3/6):谁创建和管理统计信息?在性能调优中,统计信息的作用。...

    在理解统计信息(2/6):直方图 中,我们讨论了直方图,密度向量,还有SQL Server如何用统计信息做基数计算(cardinality estimation).这篇文章会讨论统计信息如何被创建,还 ...

  7. linux性能调优原创翻译系列

    Linux进程管理: 进程是可以运行在处理器CPU上的一个可执行的实例.进程完成工作需要所有linux内核需要的资源. 所有的在linux操作系统上运行的内存都是由task_struct 体系来管理的 ...

  8. 基本linux性能调优技巧

    导读 Linux是一种开源操作系统,它支持各种硬件平台,Linux服务器全球知名,它和Windows之间最主要的差异在于,Linux服务器默认情况下一般不提供GUI(图形用户界面),而是命令行界面,它 ...

  9. 关于Linux性能调优之内存负载调优

    写在前面 整理一些Linux内存调优的笔记,分享给小伙伴 博文没有涉及的Demo,理论方法偏多,可以用作内存调优入门 博文内容涉及: Linux内存管理的基本理论 寻找内存泄露的进程 内存交换空间调优 ...

  10. Linux性能调优的优化思路

    Linux操作系统是一个开源产品,也是一个开源软件的实践和应用平台,在这个平台下有无数的开源软件支撑,我们常见的有apache.tomcat.nginx.mysql.php等等,开源软件的最大理念就是 ...

最新文章

  1. angular下拉框点击无反应_固定床反应器,你知道多少?
  2. 什么甜食可以代表你的家乡?
  3. bzoj 2007 [Noi2010]海拔——最小割转最短路
  4. 直播软件自动化测试,基于SRS-Bench工具的直播平台性能测试
  5. 聊聊这些天收到的简历
  6. 信息学奥数一本通(1170:计算2的N次方)
  7. 我的天!我靠这个拥有了自己第一架无人机!
  8. 携程apollo系列-个人开发环境搭建
  9. Nginx(一):Nginx介绍
  10. 学习笔记—前端移动端开发知识点总结
  11. 湖南师范大学学科综合评价计算机,师范类高校自主招生/综合评价相关问答,2020届参考...
  12. ZZNU 1992: 情人节的尴尬
  13. BGP Aggregation – Suppress Map
  14. 数学在计算机科学中的作用,计算机科学中数学的重要性及其运用
  15. YUV数据格式与YUV_420_888
  16. IB学霸分享学习经验(家长如何助孩子一臂之力)
  17. 令人愉悦的性能统计分析工具-hiper 【发个copy】
  18. 记录(Record)
  19. 前端开发如何获取视频第一帧作为封面
  20. ERP 系统最重要的是什么?

热门文章

  1. tpadmin的坑收集 nginx下配置tp5失败
  2. Java 冒泡排序的使用
  3. Rasa课程、Rasa培训、Rasa面试系列之: Rasa客户案例nib Group 保险公司
  4. 很酷的软件WinDirStat
  5. 最近发现的一个c# winform的一个很好用的excel控件 reogrid控件
  6. 开源车牌数据集CCPD介绍
  7. Qt信号和槽机制详解
  8. JDK8 toMap之key重复报Duplicate key xxxx异常解决
  9. 阿里月薪6W招程序员,看到要求我傻眼了!
  10. su必备插件_21款SU常用插件集合