Linux 性能调优之硬件资源监控

1写在前面


  • 考试整理相关笔记

  • 博文内容涉及 Linux 硬件资源监控常见的命令介绍,涉及

  • 理解不足小伙伴帮忙指正

对每个人而言,真正的职责只有一个:找到自我。然后在心中坚守其一生,全心全意,永不停息。所有其它的路都是不完整的,是人的逃避方式,是对大众理想的懦弱回归,是随波逐流,是对内心的恐惧 ——赫尔曼·黑塞《德米安》


系统出现问题,或者存在异常的日志信息,某些进程运行缓慢,往往可能需要排除是否存在硬件问题,所以需要对硬件信息进行监控,查看是否存在异常信息

启动系统时会进行系统硬件检测,这些检测信息同时还会被写到 dmesg buffer 中, 在 Linux 系统中 ,dmesg buffer 记录下面一些信息:

  • 启动系统硬件检测信息

  • 驱动程序的信息

  • 查看系统警告或者错误

使用 dmesg 和 jounalctl -k选项 可以查看 dmesg buffer 的信息。

查看最后 10 行的数据信息,系统事件和操作的信息

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$dmesg  | tail -f -n 10

  3. [56429.310740] br0: port 3(vnet4) entered blocking state

  4. [56429.310741] br0: port 3(vnet4) entered forwarding state

  5. [56431.360035] privbr0: port 3(vnet3) entered learning state

  6. [56433.408995] privbr0: port 3(vnet3) entered forwarding state

  7. [56433.409013] privbr0: topology change detected, propagating

  8. [56440.853859] kvm [45569]: vcpu0, guest rIP: 0xffffffff9e060e38 disabled perfctr wrmsr: 0xc2 data 0xffff

  9. [59043.415922] device-mapper: uevent: version 1.0.3

  10. [59043.416104] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com

  11. [59176.644265] kvm [45401]: vcpu0, guest rIP: 0xffffffffa0260e38 disabled perfctr wrmsr: 0xc2 data 0xffff

  12. [59463.089835] bash (2579): drop_caches: 3

dmesg -T 可以将时间转化为人类可读的形式

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$dmesg -T | tail -f -n 10

  3. [Sun Sep 17 02:19:18 2023] br0: port 3(vnet4) entered blocking state

  4. [Sun Sep 17 02:19:18 2023] br0: port 3(vnet4) entered forwarding state

  5. [Sun Sep 17 02:19:20 2023] privbr0: port 3(vnet3) entered learning state

  6. [Sun Sep 17 02:19:22 2023] privbr0: port 3(vnet3) entered forwarding state

  7. [Sun Sep 17 02:19:22 2023] privbr0: topology change detected, propagating

  8. [Sun Sep 17 02:19:29 2023] kvm [45569]: vcpu0, guest rIP: 0xffffffff9e060e38 disabled perfctr wrmsr: 0xc2 data 0xffff

  9. [Sun Sep 17 03:02:52 2023] device-mapper: uevent: version 1.0.3

  10. [Sun Sep 17 03:02:52 2023] device-mapper: ioctl: 4.39.0-ioctl (2018-04-03) initialised: dm-devel@redhat.com

  11. [Sun Sep 17 03:05:05 2023] kvm [45401]: vcpu0, guest rIP: 0xffffffffa0260e38 disabled perfctr wrmsr: 0xc2 data 0xffff

  12. [Sun Sep 17 03:09:52 2023] bash (2579): drop_caches: 3

查看前 10 行的数据信息.Linux内核启动过程的信息

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$dmesg -T | head -n 10

  3. [Sat Sep 16 10:38:49 2023] Linux version 4.18.0-193.el8.x86_64 (mockbuild@x86-vm-08.build.eng.bos.redhat.com) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Fri Mar 27 14:35:58 UTC 2020

  4. [Sat Sep 16 10:38:49 2023] Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-193.el8.x86_64 root=UUID=893bf4a5-f929-4a4f-9bb3-f1694d8ad757 ro resume=UUID=56504db0-34ca-458f-970b-1591a6af18bb rhgb quiet rd.shell=0

  5. [Sat Sep 16 10:38:49 2023] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'

  6. [Sat Sep 16 10:38:49 2023] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'

  7. [Sat Sep 16 10:38:49 2023] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'

  8. [Sat Sep 16 10:38:49 2023] x86/fpu: Supporting XSAVE feature 0x020: 'AVX-512 opmask'

  9. [Sat Sep 16 10:38:49 2023] x86/fpu: Supporting XSAVE feature 0x040: 'AVX-512 Hi256'

  10. [Sat Sep 16 10:38:49 2023] x86/fpu: Supporting XSAVE feature 0x080: 'AVX-512 ZMM_Hi256'

  11. [Sat Sep 16 10:38:49 2023] x86/fpu: Supporting XSAVE feature 0x200: 'Protection Keys User registers'

  12. [Sat Sep 16 10:38:49 2023] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256

  13. ┌──[root@liruilongs.github.io]-[~]

  14. └─$

通过  journalctl -k 命令来查看

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$ journalctl -k

  3. -- Logs begin at 五 2023-11-10 10:32:56 CST, end at 五 2023-11-10 10:36:16 CST. --

  4. 11月 10 10:32:56 vms81.liruilongs.github.io kernel: Initializing cgroup subsys cpuset

  5. 11月 10 10:32:56 vms81.liruilongs.github.io kernel: Initializing cgroup subsys cpu

  6. 11月 10 10:32:56 vms81.liruilongs.github.io kernel: Initializing cgroup subsys cpuacct

  7. 11月 10 10:32:56 vms81.liruilongs.github.io kernel: Linux version 3.10.0-1160.76.1.el7.x86_64 (mockbuild@kbuilder.bsys.c

  8. 11月 10 10:32:56 vms81.liruilongs.github.io kernel: Command line: BOOT_IMAGE=/boot/vmlinuz-3.10.0-1160.76.1.el7.x86_64 r

  9. ......

在日常维护中,往往结合 grep 快速定位问题

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$ dmesg -T | grep -i error

  3. [五 11月 10 10:32:57 2023] BERT: Boot Error Record Table support is disabled. Enable it by using bert_enable as kernel parameter.

  4. ┌──[root@liruilongs.github.io]-[~]

  5. └─$ dmesg -T | grep -i warn

  6. [五 11月 10 10:32:54 2023] Warning: Intel Processor - this hardware has not undergone upstream testing. Please consult http://wiki.centos.org/FAQ for more information

  7. ┌──[root@liruilongs.github.io]-[~]

  8. └─$

2硬件信息查看

当前系统中一般会使用多个 CPU,每个 CPU 有多个核心,每个内核还可能具备超线程并具备不同级别的共享缓存

lscpu 命令可以查看系统的 CPU 的信息

Intel CPU 信息

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$lscpu

  3. Architecture:        x86_64

  4. CPU op-mode(s):      32-bit, 64-bit

  5. Byte Order:          Little Endian

  6. CPU(s):              8

  7. On-line CPU(s) list: 0-7

  8. Thread(s) per core:  1

  9. Core(s) per socket:  4

  10. Socket(s):           2

  11. NUMA node(s):        1

  12. Vendor ID:           GenuineIntel

  13. CPU family:          6

  14. Model:               140

  15. Model name:          11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz

  16. Stepping:            1

  17. CPU MHz:             2419.226

  18. BogoMIPS:            4838.45

  19. Virtualization:      VT-x

  20. Hypervisor vendor:   VMware

  21. Virtualization type: full

  22. L1d cache:           48K

  23. L1i cache:           32K

  24. L2 cache:            1280K

  25. L3 cache:            8192K

  26. NUMA node0 CPU(s):   0-7

  27. Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid movdiri movdir64b md_clear flush_l1d arch_capabilities

简单的输出信息说明

系统架构是 x86_64(64 位),支持 32 位和 64 位的 CPU 操作模式。字节顺序为小端(Little Endian)。系统有 8 个 CPU 核心,每个核心有 1 个线程。每个 CPU 插槽有 4 个核心,共有 2 个插槽。NUMA 节点数为 1。

以下是有关您的 CPU 的信息:

  • 厂商 ID:GenuineIntel

  • CPU 家族:6

  • 型号:140

  • 型号名称:11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz

  • 步进:1

  • CPU 频率:2419.226 MHz

  • BogoMIPS:4838.45

  • 支持虚拟化技术:VT-x

  • Hypervisor 厂商:VMware

  • 虚拟化类型:full

  • 关于 CPU 缓存的信息:

  • L1d 缓存:48K

  • L1i 缓存:32K

  • L2 缓存:1280K

  • L3 缓存:8192K

  • 系统具有许多 CPU 功能和特性,包括浮点运算单元(fpu)、虚拟化扩展(vmx)、超线程(ht)、AES 指令集(aes)、AVX 指令集(avx)等等。

服务器 CPU 信息查看

  1. ┌──[root@hp-ProLiant-SL270s-Gen8-SE]-[~]

  2. └─$ lscpu

  3. 架构:                   x86_64

  4.   CPU 运行模式:         32-bit, 64-bit

  5.   Address sizes:         46 bits physical, 48 bits virtual

  6.   字节序:               Little Endian

  7. CPU:                     32

  8.   在线 CPU 列表:        0-31

  9. 厂商 ID:                GenuineIntel

  10.   型号名称:             Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz

  11.     CPU 系列:           6

  12.     型号:               45

  13.     每个核的线程数:     2

  14.     每个座的核数:       8

  15.     座:                 2

  16.     步进:               7

  17.     CPU 最大 MHz:       3300.0000

  18.     CPU 最小 MHz:       1200.0000

  19.     BogoMIPS:           5187.49

  20.     标记:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fx

  21.                          sr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_go

  22.                          od nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est

  23.                          tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx

  24.                          lahf_lm epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm ida

  25.                          arat pln pts md_clear flush_l1d

  26. Virtualization features:

  27.   虚拟化:               VT-x

  28. Caches (sum of all):

  29.   L1d:                   512 KiB (16 instances)

  30.   L1i:                   512 KiB (16 instances)

  31.   L2:                    4 MiB (16 instances)

  32.   L3:                    40 MiB (2 instances)

  33. NUMA:

  34.   NUMA 节点:            2

  35.   NUMA 节点0 CPU:       0-7,16-23

  36.   NUMA 节点1 CPU:       8-15,24-31

  37. Vulnerabilities:

  38.   Itlb multihit:         KVM: Mitigation: VMX disabled

  39.   L1tf:                  Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable

  40.   Mds:                   Mitigation; Clear CPU buffers; SMT vulnerable

  41.   Meltdown:              Mitigation; PTI

  42.   Mmio stale data:       Unknown: No mitigations

  43.   Retbleed:              Not affected

  44.   Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl

  45.   Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization

  46.   Spectre v2:            Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling, PBRSB-eIBRS

  47.                          Not affected

  48.   Srbds:                 Not affected

  49.   Tsx async abort:       Not affected

  50. ┌──[root@hp-ProLiant-SL270s-Gen8-SE]-[~]

  51. └─$

基本信息:

  • CPU: Intel Xeon E5-2670, Sandy Bridge-EP微架构,双芯片(Socket)每个Socket 8核心

  • 多线程支持:每个核心支持两个线程

  • 缓存结构:每个核心有512KB L1缓存,4MB L2缓存,两颗CPU共享40MB L3缓存

  • NUMA结构:有两个NUMA节点,第一个节点CPU为0-7,第二个为8-15

  • 虚拟化支持:支持Intel VT-x虚拟化技术

  • 性能信息:基准指标5187.49 Bogomips

  • 支持特性:SSE,AVX,虚拟化、数据本地性等

  • 漏洞修复:针对Meltdown、Spectre等已修复

AMD CPU 信息

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$ lscpu

  3. Architecture:          x86_64

  4. CPU op-mode(s):        32-bit, 64-bit

  5. Byte Order:            Little Endian

  6. CPU(s):                4

  7. On-line CPU(s) list:   0-3

  8. Thread(s) per core:    1

  9. Core(s) per socket:    2

  10. 座:                 2

  11. NUMA 节点:         1

  12. 厂商 ID:           AuthenticAMD

  13. CPU 系列:          23

  14. 型号:              17

  15. 型号名称:        AMD Ryzen 7 2700U with Radeon Vega Mobile Gfx

  16. 步进:              0

  17. CPU MHz:             2195.781

  18. BogoMIPS:            4391.56

  19. 超管理器厂商:  VMware

  20. 虚拟化类型:     完全

  21. L1d 缓存:          32K

  22. L1i 缓存:          64K

  23. L2 缓存:           512K

  24. L3 缓存:           4096K

  25. NUMA 节点0 CPU:    0-3

  26. Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc art rep_good nopl tsc_reliable nonstop_tsc extd_apicid eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec arat overflow_recov succor

  27. ┌──[root@liruilongs.github.io]-[~]

  28. └─$

dmidecode 可以查看 主板设备信息

  1. ┌──[root@hp-ProLiant-SL270s-Gen8-SE]-[~]

  2. └─$ dmidecode | head -n 10

  3. # dmidecode 3.3

  4. Getting SMBIOS data from sysfs.

  5. SMBIOS 2.8 present.

  6. 188 structures occupying 5969 bytes.

  7. Table at 0xBFBD8000.

  8. Handle 0x0000, DMI type 0, 24 bytes

  9. BIOS Information

  10.         Vendor: HP

  11.         Version: P75

  12. ┌──[root@hp-ProLiant-SL270s-Gen8-SE]-[~]

  13. └─$

查看 usb 设备信息,通过 -vv 可以查看详细信息

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$lsusb

  3. Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

  4. Bus 003 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse

  5. Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  6. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  7. Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub

  8. Bus 002 Device 002: ID 0e0f:0008 VMware, Inc.

  9. Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

lspci命令用于列出连接到 PCI 总线的设备信息,它可以显示计算机上安装的 PCI 设备的详细信息,包括网络适配器、显卡、声卡、存储控制器等。 -vv 选项可以查看详细的信息

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$lspci -vv

  3. 00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)

  4.         Subsystem: VMware Virtual Machine Chipset

  5.         Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-

  6.         Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

  7.         Latency: 0

  8. 00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01) (prog-if 00 [Normal decode])

  9.         Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV+ VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-

  10.         Status: Cap- 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

  11.         Latency: 0

  12.         Bus: primary=00, secondary=01, subordinate=01, sec-latency=64

  13.         I/O behind bridge: None

  14.         Memory behind bridge: None

  15.         Prefetchable memory behind bridge: None

  16.         Secondary status: 66MHz+ FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- <SERR- <PERR-

  17.         BridgeCtl: Parity- SERR- NoISA+ VGA- MAbort- >Reset- FastB2B+

  18.                 PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-

  19. 00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)

  20.         Subsystem: VMware Virtual Machine Chipset

  21.         Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-

  22.         Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

  23.         Latency: 0

  24. 00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) (prog-if 8a [ISA Compatibility mode controller, supports both channels switched to PCI native mode, supports bus mastering])

  25.         Subsystem: VMware Virtual Machine Chipset

  26.         Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-

  27.         Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

  28.         Latency: 64

  29.         Region 0: [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]

  30.         Region 1: [virtual] Memory at 000003f0 (type 3, non-prefetchable)

  31.         Region 2: [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]

  32.         Region 3: [virtual] Memory at 00000370 (type 3, non-prefetchable)

  33.         Region 4: I/O ports at 1060 [size=16]

  34.         Kernel driver in use: ata_piix

  35.         Kernel modules: ata_piix, ata_generic

  36.         ...............

hwloc是一个开源软件包,提供了命令行和图形工具,用于收集和展示硬件信息。它可以帮助用户了解系统中的硬件拓扑结构,包括处理器、缓存、内存、PCI设备和网络设备等

lstopo:是hwloc的主要命令行工具,用于展示硬件拓扑结构。它会生成一个图形化的拓扑图,显示处理器、缓存、内存和其他设备的层次结构和拓扑关系,如果没有图形环境,Istopo-no-graphics 可以提供命令行文字信息输出

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$ yum  -y install  hwloc

  3. ┌──[root@liruilongs.github.io]-[~]

  4. └─$  lstopo-no-graphics

  5. Machine (4226MB)

  6.   L3 L#0 (4096KB)

  7.     Package L#0

  8.       L2 L#0 (512KB) + L1d L#0 (32KB) + L1i L#0 (64KB) + Core L#0 + PU L#0 (P#0)

  9.       L2 L#1 (512KB) + L1d L#1 (32KB) + L1i L#1 (64KB) + Core L#1 + PU L#1 (P#1)

  10.     Package L#1

  11.       L2 L#2 (512KB) + L1d L#2 (32KB) + L1i L#2 (64KB) + Core L#2 + PU L#2 (P#2)

  12.       L2 L#3 (512KB) + L1d L#3 (32KB) + L1i L#3 (64KB) + Core L#3 + PU L#3 (P#3)

  13.   HostBridge L#0

  14.     PCI 8086:7111

  15.     PCI 15ad:0405

  16.     PCI 1000:0030

  17.       Block(Disk) L#0 "sda"

  18.     PCIBridge

  19.       PCI 8086:100f

  20.         Net L#1 "ens32"

  21.       PCI 15ad:07e0

根据输出,可以看到以下组件:

  • 机器(Machine):总共有 4226MB 的内存容量。

  • L3 缓存(L3 L#0):具有 4096KB 的容量。

  • 处理器包(Package):存在两个处理器包(Package L#0 和 Package L#1)。

    • L2 缓存(L2 L#0 和 L2 L#1):每个 L2 缓存具有 512KB 的容量。

    • L1 数据缓存(L1d L#0 和 L1d L#1):每个 L1 数据缓存具有 32KB 的容量。

    • L1 指令缓存(L1i L#0 和 L1i L#1):每个 L1 指令缓存具有 64KB 的容量。

    • 核心(Core L#0、Core L#1、Core L#2 和 Core L#3):每个处理器包中有四个核心。

    • 处理单元(PU L#0、PU L#1、PU L#2 和 PU L#3):每个核心有一个处理单元。

    • 每个处理器包中包含以下组件:

  • 主机桥接器(HostBridge L#0):用于连接其他组件的主机桥接器。

    • 网络设备(Net):标识为 "ens32" 的网络设备。

    • 硬盘块(Block):标识为 "sda" 的磁盘块。

    • PCI 设备:显示了一些 PCI 设备的信息,包括厂商和设备的 ID。

    • PCI 8086:7111

    • PCI 15ad:0405

    • PCI 1000:0030

    • PCI 8086:100f

    • PCI 15ad:07e0

通过 -v 选项,可以查看更详细的信息

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$  lstopo-no-graphics -v

  3. Machine (P#0 local=4327132KB total=4327132KB DMIProductName="VMware Virtual Platform" DMIProductVersion=None DMIProductSerial="VMware-56 4d 75 ae f9 4e 9f ad-ba a0 f4 a3 26 c9 6f ae" DMIProductUUID=AE754D56-4EF9-AD9F-BAA0-F4A326C96FAE DMIBoardVendor="Intel Corporation" DMIBoardName="440BX Desktop Reference Platform" DMIBoardVersion=None DMIBoardSerial=None DMIBoardAssetTag= DMIChassisVendor="No Enclosure" DMIChassisType=1 DMIChassisVersion=N/A DMIChassisSerial=None DMIChassisAssetTag="No Asset Tag" DMIBIOSVendor="Phoenix Technologies LTD" DMIBIOSVersion=6.00 DMIBIOSDate=07/22/2020 DMISysVendor="VMware, Inc." Backend=Linux LinuxCgroup=/ OSName=Linux OSRelease=3.10.0-693.el7.x86_64 OSVersion="#1 SMP Tue Aug 22 21:09:27 UTC 2017" HostName=liruilongs.github.io Architecture=x86_64 hwlocVersion=1.11.8 ProcessName=lstopo-no-graphics)

  4.   L3Cache L#0 (size=4096KB linesize=64 ways=16 Inclusive=0)

  5.     Package L#0 (P#0 CPUVendor=AuthenticAMD CPUFamilyNumber=23 CPUModelNumber=17 CPUModel="AMD Ryzen 7 2700U with Radeon Vega Mobile Gfx" CPUStepping=0)

  6.       L2Cache L#0 (size=512KB linesize=64 ways=8 Inclusive=0)

  7.         L1dCache L#0 (size=32KB linesize=64 ways=16 Inclusive=0)

  8.           L1iCache L#0 (size=64KB linesize=64 ways=4 Inclusive=0)

  9.             Core L#0 (P#0)

  10.               PU L#0 (P#0)

  11.       L2Cache L#1 (size=512KB linesize=64 ways=8 Inclusive=0)

  12.         L1dCache L#1 (size=32KB linesize=64 ways=16 Inclusive=0)

  13.           L1iCache L#1 (size=64KB linesize=64 ways=4 Inclusive=0)

  14.             Core L#1 (P#1)

  15.               PU L#1 (P#1)

  16. ...................................

  17. ┌──[root@liruilongs.github.io]-[~]

  18. └─$

支持通过以下方式来查看硬件拓扑结构信息

  • lstopo-no-graphics --output-format txt:以文本格式输出硬件拓扑结构。

  • lstopo-no-graphics --output-format xml:以XML格式输出硬件拓扑结构。

  • lstopo-no-graphics --output-format fig:以FIG格式输出硬件拓扑结构。

图片

在这里插入图片描述

从上面 lstopo 的输出可以看到这个系统的拓扑结构:

  • 这是一台双插槽双 处理器(processor) 的服务器,每个 processor 插槽默认安装了一个 AMD EPYC 7002 系列的 CPU

  • 每个 CPU 有多个核心,每个核有各级 cache,如 L1,L2,L3 缓存

  • 多个核心通过高速互联交换机连接在一起,组成一个 numa 节点

  • 每个 numa 节点有固定容量的内存,这里的是 64GB

  • 系统一共有两个 numa 节点,总内存为 128GB

  • 还安装了多块 OpenCL 加速卡,分布在两个 numa 节点上(CoProc: 加速卡,这里是AMD RadeonOpenCL计算卡)

  • 另外还有两个网卡,连接外部网络,OpenFabrics: InfiniBand或者RoCE网络接口

  • 磁盘是 894GB的串行ATA 盘

部分参数信息:

  • Machine: 显示整体服务器硬件信息,总内存为 126GB

  • Package: CPU Socket,这里是两个Socket

  • NUMANode: NUMA节点,每个CPU Socket对应的是一个NUMA节点

  • L3: L3缓存,每个CPU有20MB L3缓存

  • PCI: PCIe插槽信息

  • L2: L2缓存,每个核有256KB L2缓存

  • OpenFabrics: InfiniBand或者RoCE网络接口

  • CoProc: 加速卡,这里是AMD RadeonOpenCL计算卡

  • L1d/L1i: L1数据缓存和指令缓存,每个核32KB

  • Core: 物理CPU核

  • PU: 指令处理单元,每个物理核内部资源分配

  • Block: 磁盘磁道

  • Net: 网络接口信息

lshw 命令可以列出机器硬件相关详细信息,lshw 命令可以列出内存,固件,主板,CPU,总线速度等信息

lshw 命令将硬件组件分多个类别,如系统,内存,网络

查看信息的 class 分类

  1. [root@workstation ~]# lshw -short

  2. H/W path          Device      Class          Description

  3. ========================================================

  4.                               system         KVM

  5. /0                            bus            Motherboard

  6. /0/0                          memory         96KiB BIOS

  7. /0/400                        processor      QEMU Virtual CPU version 2.5+

  8. /0/401                        processor      QEMU Virtual CPU version 2.5+

  9. /0/1000                       memory         2GiB System Memory

  10. /0/1000/0                     memory         2GiB DIMM RAM

  11. /0/100                        bridge         82G33/G31/P35/P31 Express DRAM Controller

  12. /0/100/1                      bridge         QEMU PCIe Root port

  13. /0/100/1/0                    network        Virtio network device

  14. /0/100/1/0/0      eth0        network        Ethernet interface

  15. /0/100/1.1                    bridge         QEMU PCIe Root port

  16. /0/100/1.1/0                  bus            QEMU XHCI Host Controller

  17. /0/100/1.1/0/0    usb1        bus            xHCI Host Controller

  18. /0/100/1.1/0/1    usb2        bus            xHCI Host Controller

  19. /0/100/1.2                    bridge         QEMU PCIe Root port

  20. /0/100/1.2/0                  communication  Virtio console

  21. /0/100/1.2/0/0                generic        Virtual I/O device

  22. /0/100/1.3                    bridge         QEMU PCIe Root port

  23. /0/100/1.3/0                  storage        Virtio block device

  24. /0/100/1.3/0/0    /dev/vda    disk           10GB Virtual I/O device

  25. /0/100/1.3/0/0/1              volume         10238MiB Linux filesystem partition

  26. /0/100/1.4                    bridge         QEMU PCIe Root port

  27. /0/100/1.4/0                  generic        Virtio memory balloon

  28. /0/100/1.4/0/0                generic        Virtual I/O device

  29. /0/100/1.5                    bridge         QEMU PCIe Root port

  30. /0/100/2                      display        Virtio GPU

  31. /0/100/2/0                    generic        Virtual I/O device

  32. /0/100/1f                     bridge         82801IB (ICH9) LPC Interface Controller

  33. /0/100/1f.2                   storage        82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode]

  34. /0/100/1f.3                   bus            82801I (ICH9 Family) SMBus Controller

  35. /0/1                          system         PnP device PNP0b00

  36. /0/2                          input          PnP device PNP0303

  37. /0/3                          input          PnP device PNP0f13

  38. /0/4                          communication  PnP device PNP0501

  39. /1                virbr0      network        Ethernet interface

  40. /2                virbr0-nic  network        Ethernet interface

查看特定类型的数据

  1. ┌──[root@hp-ProLiant-SL270s-Gen8-SE]-[~]

  2. └─$ lshw -c network

  3.   *-network:0

  4.        description: Ethernet interface

  5.        product: I350 Gigabit Network Connection

  6.        vendor: Intel Corporation

  7.        physical id: 0

  8.        bus info: pci@0000:02:00.0

  9.        logical name: eno1

  10.        version: 01

  11.        serial: 9c:b6:54:b5:e2:64

  12.        size: 100Mbit/s  #size 指的是网卡当前的连接速度(Negotiated Speed)。

  13.        capacity: 1Gbit/s #capacity 指的是网卡的最大理论连接速度能力(Maximum Speed)。

  14.        width: 32 bits

  15.        clock: 33MHz

  16.        capabilities: pm msi msix pciexpress vpd bus_master cap_list rom ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation

  17.        configuration: autonegotiation=on broadcast=yes driver=igb driverversion=5.19.0-32-generic duplex=full firmware=1.61, 0x80000cd5, 1.949.0 ip=10.255.0.101 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s

  18.        resources: irq:16 memory:efd00000-efdfffff ioport:5000(size=32) memory:efcf0000-efcf3fff memory:efa00000-efa7ffff memory:3cbfdfe0000-3cbfdffffff memory:3cbfdfc0000-3cbfdfdffff

  19.   *-network:1

  20.        description: Ethernet interface

  21.        product: I350 Gigabit Network Connection

  22.        vendor: Intel Corporation

  23.        physical id: 0.1

  24.        bus info: pci@0000:02:00.1

  25.        logical name: eno2

  26.        version: 01

  27.        serial: 9c:b6:54:b5:e2:65

  28.        capacity: 1Gbit/s

  29.        width: 32 bits

  30.        clock: 33MHz

  31.        capabilities: pm msi msix pciexpress vpd bus_master cap_list rom ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation

  32.        configuration: autonegotiation=on broadcast=yes driver=igb driverversion=5.19.0-32-generic firmware=1.61, 0x80000cd5, 1.949.0 latency=0 link=no multicast=yes port=twisted pair

  33.        resources: irq:17 memory:efb00000-efbfffff ioport:5020(size=32) memory:efaf0000-efaf3fff memory:efc00000-efc7ffff memory:3cbfdfa0000-3cbfdfbffff memory:3cbfdf80000-3cbfdf9ffff

  34.   *-network

  35.        description: Network controller

  36.        product: MT27520 Family [ConnectX-3 Pro]

  37.        vendor: Mellanox Technologies

  38.        physical id: 0

  39.        bus info: pci@0000:23:00.0

  40.        version: 00

  41.        width: 64 bits

  42.        clock: 33MHz

  43.        capabilities: pm vpd msix pciexpress bus_master cap_list rom

  44.        configuration: driver=mlx4_core latency=0

  45.        resources: iomemory:3e30-3e2f irq:46 memory:f6c00000-f6cfffff memory:3e3fc000000-3e3fdffffff memory:3e3dc000000-3e3fbffffff

  46. ┌──[root@hp-ProLiant-SL270s-Gen8-SE]-[~]

  47. └─$

lshw的输出可以得知这个系统的网络结构:

有2块Intel I350网卡,型号相同:

  • eno1在PCI插槽0000:02:00.0

  • eno2在PCI插槽0000:02:00.1

另外还有1块Mellanox ConnectX-3 Pro InfiniBand卡:

  • 在PCI插槽0000:23:00.0

  • 使用mlx4_core驱动

主要特点:

  • Intel I350是常见的1Gb以太网卡

  • MellanoxConnectX-3 Pro是InfiniBand卡,用于高性能计算集群

  • 一个InfiniBand卡,两个以太网卡

  • 以太网卡独立驱动与Mellanox卡单独驱动

  1. ┌──[root@hp-ProLiant-SL270s-Gen8-SE]-[~]

  2. └─$ lshw  -c disk

  3.   *-disk

  4.        description: SCSI Disk

  5.        product: LOGICAL VOLUME

  6.        vendor: HP

  7.        physical id: 1.0.0

  8.        bus info: scsi@1:1.0.0

  9.        logical name: /dev/sda

  10.        version: 3.22

  11.        serial: PBKTU0ARH3U005

  12.        size: 894GiB (960GB)

  13.        capabilities: 15000rpm gpt-1.00 partitioned partitioned:gpt

  14.        configuration: ansiversion=5 guid=525c7981-1a75-4223-a48b-cac0e40e44c2 logicalsectorsize=512 sectorsize=512

  15. ┌──[root@hp-ProLiant-SL270s-Gen8-SE]-[~]

  16. └─$

也可以直接把硬件信息输出到 html

[root@workstation ~]# lshw -html > hw.hhtml

3报告硬件错误

用户可以通过rasdaemon捕获并处理内核生成的错误事件,这些信息记录在/sys/kernel/debug/tracing/目录下,有 syslog/journald 报告使用rasdaemon 需要安装并启动服务

  1. [root@workstation ~]# yum -y install  rasdaemon

  2. [root@workstation ~]# systemctl enable --now rasdaemon.service

可以在目录下查看相关的文件信息

  1. ┌──[root@hp-ProLiant-SL270s-Gen8-SE]-[~]

  2. └─$ ls /sys/kernel/debug/tracing/

  3. available_events            dynamic_events            hwlat_detector   printk_formats         set_event_pid           snapshot            trace_clock       tracing_max_latency

  4. available_filter_functions  dyn_ftrace_total_info     instances        README                 set_ftrace_filter       stack_max_size      trace_marker      tracing_on

  5. available_tracers           enabled_functions         kprobe_events    saved_cmdlines         set_ftrace_notrace      stack_trace         trace_marker_raw  tracing_thresh

  6. buffer_percent              error_log                 kprobe_profile   saved_cmdlines_size    set_ftrace_notrace_pid  stack_trace_filter  trace_options     uprobe_events

  7. buffer_size_kb              events                    max_graph_depth  saved_tgids            set_ftrace_pid          synthetic_events    trace_pipe        uprobe_profile

  8. buffer_total_size_kb        free_buffer               options          set_event              set_graph_function      timestamp_mode      trace_stat

  9. current_tracer              function_profile_enabled  per_cpu          set_event_notrace_pid  set_graph_notrace       trace               tracing_cpumask

  10. ┌──[root@hp-ProLiant-SL270s-Gen8-SE]-[~]

  11. └─$

第一次运行可以会有如下报错信息,按照提示信息使用 rasdaemon --record

  1. [root@workstation ~]# ras-mc-ctl --summary

  2. DBD::SQLite::db prepare failed: no such table: mc_event at /usr/sbin/ras-mc-ctl line 1130.

  3. Can't call method "execute" on an undefined value at /usr/sbin/ras-mc-ctl line 1131.

  4. [root@workstation ~]# ras-mc-ctl  --errors

  5. DBD::SQLite::db prepare failed: no such table: mc_event at /usr/sbin/ras-mc-ctl line 1208.

  6. ras-mc-ctl: Error: mc_event table missing from /var/lib/rasdaemon/ras-mc_event.db. Run 'rasdaemon --record'.

  7. [root@workstation ~]# rasdaemon --record

运行 ras-mc-ctl --errors命令后,可以检测到以下类型的错误:

  • 内存错误(Memory errors)

  • PCIe AER 高速串行总线错误(PCIe Advanced Error Reporting errors)

  • Extlog 扩展日志错误(Extended Log errors)

  • MCE 机器检查异常错误(Machine Check Exception errors)

ras-mc-ctl --errors 命令用于列出当前系统中发生的机器检查错误。它会显示内存错误、PCIe AER 错误、Extlog 错误和 MCE 错误的详细信息(如果有的话)

  1. [root@workstation ~]# ras-mc-ctl  --errors

  2. No Memory errors.

  3. No PCIe AER errors.

  4. No Extlog errors.

  5. No MCE errors.

ras-mc-ctl --summary 命令用于提供机器检查错误的摘要信息。它会显示每个错误类型的总数,而不会提供每个具体错误的详细信息。这个命令适用于快速查看系统中错误的总体情况,以便对系统健康状况有一个概览。

  1. [root@workstation ~]# ras-mc-ctl --summary

  2. No Memory errors.

  3. No PCIe AER errors.

  4. No Extlog errors.

  5. No MCE errors.

4查看虚拟环境和云环境的资源

KVM 是基于内核的虚拟机技术,是内核可加载的模块,KVM 运行在内核空间。

  • libvirt 工具是虚拟机和相关设备的管理工具,需要安装工具包 apt install libvirt-daemon-system

  • virsh 命令使用 libvit 库和 API 访问虚拟机,当前命令需要安装工具包 apt install libvirt-clients

QEMU 是仿真器,可以将虚拟设备提供给虚拟机操作系统包括:

  • 网络 PCI 控制器(virtio-net-pci)

  • 存储控制器 (virtio-scsi-pci)

  • 存储 PCI 块控制器 (virtio-blk)

  • 内存 PCI 控制器 (virtio-balloon-pci)随机数发生器(virtio-rng-pci)

  • USB (ich9-usdb-uhci3 或 pciohci)网络设备动器 (e1000 或 virtio)

  • 视频设备 (cirrus-vga-vga 或 qxl-vga)

QEMU 可以与 KVM(Kernel-based Virtual Machine)结合使用,以提供完整的虚拟化解决方案。KVM 提供硬件虚拟化支持,而 QEMU 提供了虚拟机监控器和硬件仿真能力。结合使用时,KVM 负责处理虚拟化的底层操作,而 QEMU 负责模拟虚拟机的硬件设备。

列出所有的虚拟机

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$virsh list --all

  3.  Id    Name                           State

  4. ----------------------------------------------------

  5.  1     classroom                      running

  6.  2     workstation                    running

  7.  3     bastion                        running

  8.  -     servera                        shut off

  9.  -     serverb                        shut off

  10.  -     serverc                        shut off

  11.  -     serverd                        shut off

查看虚拟机的信息

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$virsh  dominfo workstation

  3. Id:             2

  4. Name:           workstation

  5. UUID:           3f09a13c-94ad-4d97-8f76-17e9a81ae61f

  6. OS Type:        hvm

  7. State:          running

  8. CPU(s):         2

  9. CPU time:       1015.4s

  10. Max memory:     2097152 KiB

  11. Used memory:    2097152 KiB

  12. Persistent:     yes

  13. Autostart:      disable

  14. Managed save:   no

  15. Security model: selinux

  16. Security DOI:   0

  17. Security label: system_u:system_r:svirt_t:s0:c249,c656 (enforcing)

查看虚拟机 CPU 信息

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$cat /etc/libvirt/qemu/workstation.xml  | grep cpu

  3.   <vcpu placement='static'>2</vcpu>

查看宿主机和虚拟机的 CPU 时间

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$virsh  cpu-stats workstation

  3. CPU0:

  4.         cpu_time           165.460132723 seconds

  5.         vcpu_time          128.590700314 seconds

  6. CPU1:

  7.         cpu_time           134.540034318 seconds

  8.         vcpu_time           98.868638312 seconds

  9. CPU2:

  10.         cpu_time            81.308894671 seconds

  11.         vcpu_time           49.496840393 seconds

  12. CPU3:

  13.         cpu_time            95.084166725 seconds

  14.         vcpu_time           57.692533169 seconds

  15. CPU4:

  16.         cpu_time           127.711824011 seconds

  17.         vcpu_time           93.085340637 seconds

  18. CPU5:

  19.         cpu_time           208.676280988 seconds

  20.         vcpu_time          172.028112759 seconds

  21. CPU6:

  22.         cpu_time            68.894659228 seconds

  23.         vcpu_time           38.683257218 seconds

  24. CPU7:

  25.         cpu_time           139.665723281 seconds

  26.         vcpu_time          103.899829328 seconds

  27. Total:

  28.         cpu_time          1021.341715945 seconds

  29.         user_time            1.360000000 seconds

  30.         system_time        144.920000000 seconds

获取名为 "workstation" 的虚拟机的 VCPU 信息

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$virsh  vcpuinfo workstation

  3. VCPU:           0

  4. CPU:            5

  5. State:          running

  6. CPU time:       573.3s

  7. CPU Affinity:   yyyyyyyy

  8. VCPU:           1

  9. CPU:            7

  10. State:          running

  11. CPU time:       169.2s

  12. CPU Affinity:   yyyyyyyy

  13. ┌──[root@liruilongs.github.io]-[~]

  14. └─$

内存气泡 memballoon/belun/

Memory Ballooning(内存气泡)是一种虚拟化技术,用于动态调整虚拟机的内存分配。它允许在运行的虚拟机之间共享和重新分配内存,以提高资源利用率。

Memory Ballooning 的工作原理如下:

  • 在虚拟机中安装并启动 Virtio-Balloon 驱动程序。Virtio-Balloon 是一种虚拟设备驱动程序,通过与宿主机(通常是 QEMU)通信来进行内存管理。

  • 虚拟机启动后,Virtio-Balloon 驱动程序会向宿主机报告虚拟机当前的内存使用情况。

  • 如果宿主机上的其他虚拟机需要更多内存,宿主机会发送请求给 Virtio-Balloon 驱动程序,要求虚拟机释放一部分内存。

  • 虚拟机的 Virtio-Balloon 驱动程序会响应请求,通过将一些内存页面释放回宿主机,从而减少虚拟机的内存使用量。

  • 宿主机收到释放的内存后,可以将其分配给其他虚拟机使用,从而实现内存的复用。

查看 linux 内核是否具备 virtio-ballon 模块

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$ lsmod | grep virtio_balloon

  3. ┌──[root@liruilongs.github.io]-[~]

  4. └─$ modprobe virtio_balloon

  5. ┌──[root@liruilongs.github.io]-[~]

  6. └─$ lsmod | grep virtio_balloon

  7. virtio_balloon         18015  0

  8. virtio_ring            22991  1 virtio_balloon

  9. virtio                 14959  1 virtio_balloon

  10. ┌──[root@liruilongs.github.io]-[~]

  11. └─$ modinfo virtio-balloon

  12. filename:       /lib/modules/3.10.0-1160.76.1.el7.x86_64/kernel/drivers/virtio/virtio_balloon.ko.xz

  13. license:        GPL

  14. description:    Virtio balloon driver

  15. retpoline:      Y

  16. rhelversion:    7.9

  17. srcversion:     52EDF3EAD03F14A066CA3BC

  18. alias:          virtio:d00000005v*

  19. depends:        virtio,virtio_ring

  20. intree:         Y

  21. vermagic:       3.10.0-1160.76.1.el7.x86_64 SMP mod_unload modversions

  22. signer:         CentOS Linux kernel signing key

  23. sig_key:        C6:93:65:52:C5:A1:E9:97:0B:A2:4C:98:1A:C4:51:A6:BC:11:09:B9

  24. sig_hashalgo:   sha256

  25. parm:           oom_pages:pages to free on OOM (int)

  26. ┌──[root@liruilongs.github.io]-[~]

  27. └─$

kvm_stat 命令是一个 python 脚本,通过读取内核的计数器信息,查看虚拟机数据,使用 ctrl+c 或者 q 键退出 kvm stat 命令,使用 x 键,查看 kvmexit 事件的细节

  1. ┌──[root@liruilongs.github.io]-[~]

  2. └─$kvm_stat

 
  1. kvm statistics - summary

  2.  Event                                         Total %Total CurAvg/s

  3.  kvm_entry                                      8663   17.3      377

  4.  kvm_exit                                       8663   17.3      377

  5.  kvm_apic                                       6442   12.8      285

  6.  kvm_msr                                        6377   12.7      283

  7.  kvm_hv_timer_state                             6295   12.5      282

  8.  kvm_pv_tlb_flush                               2069    4.1       90

  9.  kvm_inj_virq                                   1960    3.9       85

  10.  kvm_apic_accept_irq                            1960    3.9       85

  11.  kvm_eoi                                        1960    3.9       85

  12.  kvm_pv_eoi                                     1943    3.9       85

  13.  kvm_vcpu_wakeup                                1870    3.7       80

  14.  kvm_fpu                                         402    0.8       20

  15.  kvm_halt_poll_ns                                311    0.6       12

  16.  kvm_msi_set_irq                                 232    0.5       11

  17.  kvm_emulate_insn                                212    0.4       10

  18.  vcpu_match_mmio                                 201    0.4       10

  19.  kvm_userspace_exit                              201    0.4       10

  20.  kvm_mmio                                        201    0.4       10

  21.  kvm_apic_ipi                                     65    0.1        1

  22.  kvm_ack_irq                                      10    0.0        0

  23.  kvm_page_fault                                   83    0.2        0

  24.  kvm_cpuid                                        39    0.1        0

  25.  kvm_fast_mmio                                    11    0.0        0

  26.  kvm_ple_window_update                             2    0.0        0

  27.  kvm_pvclock_update                                1    0.0        0

  28.  Total                                         50173            2198

行动吧,在路上总比一直观望的要好,未来的你肯定会感 谢现在拼搏的自己!如果想学习提升找不到资料,没人答疑解惑时,请及时加入扣群: 320231853,里面有各种软件测试+开发资料和技术可以一起交流学习哦。

最后感谢每一个认真阅读我文章的人,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走:

这些资料,对于【软件测试】的朋友来说应该是最全面最完整的备战仓库,这个仓库也陪伴上万个测试工程师们走过最艰难的路程,希望也能帮助到你!

  • 14
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 《KVM实战:原理、进阶与性能调优》是一本介绍KVM虚拟化技术的书籍。KVM,全称为Kernel-based Virtual Machine,是一种基于Linux内核的虚拟化解决方案。 这本书首先介绍了KVM的原理。KVM利用Linux内核的虚拟化功能,通过将物理设备的请求转发到虚拟机(VM)来实现虚拟化。它利用虚拟化扩展(Intel VT或AMD-V)来实现快速的虚拟机切换。书中详细介绍了KVM的基本概念、VM的创建与配置以及与其他虚拟化解决方案的对比。 然后,书籍进一步探讨了KVM的进阶技术。它介绍了如何使用KVM进行网络配置、存储管理和虚拟机迁移。此外,书中还介绍了如何集成KVM与云计算、容器等技术,以提高整个系统的性能和可靠性。 最后,这本书还包括了性能调优的内容。它介绍了如何通过对KVM和虚拟机的配置进行调整来提高性能。书中讨论了虚拟CPU和内存管理的最佳实践,以及如何合理分配物理资源给虚拟机以提高性能。 通过阅读《KVM实战:原理、进阶与性能调优》,读者可以了解KVM虚拟化技术的原理、基本操作和进阶技术,以及如何通过调优来提高性能。这本书对于想要深入了解KVM技术的从业人员和技术爱好者来说,是一本很好的参考资料。 ### 回答2: KVM是一种开源的虚拟化技术,全称是Kernel-based Virtual Machine,它能够将Linux内核转变为一个虚拟机监控器,通过这种方式可以在一台物理计算机上运行多个虚拟机,提供类似于物理机的计算资源。在《kvm实战:原理,进阶与性能调优》这本书中,作者详细介绍了KVM虚拟化技术的原理、进阶应用和性能调优方法。 这本书首先讲解了KVM虚拟化技术的原理,包括虚拟化的基本概念、KVM的架构和工作原理等。读者可以了解KVM是如何通过虚拟化硬件和内核模块,实现虚拟机的创建、运行和管理的。 接着,书中详细介绍了KVM的进阶应用。例如,如何利用KVM创建高可用性的虚拟机集群,如何通过虚拟机快照功能实现快速备份和恢复等。同时,书中还介绍了与KVM相关的其他开源技术,如QEMU、libvirt等,以及它们在KVM中的应用。 最后一部分是关于KVM性能调优的内容。作者介绍了KVM虚拟化技术的性能瓶颈和优化方法,如CPU调度策略、内存和存储性能优化等。读者可以了解如何根据实际应用场景,调整KVM虚拟机的参数,以达到最佳的性能表现。 通过阅读《kvm实战:原理,进阶与性能调优》,读者可以全面了解KVM虚拟化技术的原理和应用。同时,书中提供了大量实例和案例,帮助读者更好地理解和应用这一技术。这本书对于计算机技术爱好者、系统管理员和云计算从业者来说,都是一本非常实用的参考书。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值