Share E-Book

KVM实战:原理、进阶与性能调优 (云计算与虚拟化技术丛书) (任永杰 程舟)(Z-Library)

Author 任永杰 & 程舟

Other
Language Chinese

自《KVM虚拟化技术:实战与原理解析》(以下简称“上一本书”)出版以来,受到了读者的热烈欢迎,几度脱销重印。这给了笔者强烈的鼓舞和责任感,觉得有必要与时俱进给读者介绍最新的KVM虚拟化技术的相关知识。 从上一本书出版后到现在近5年时间里,国内虚拟化技术迅速普及,云计算应用风起云涌,阿里云、腾讯云、华为云等国内云服务提供商迅速崛起,使得云计算、虚拟化不再是原来象牙塔里虚无缥缈的技术概念,而是与普通大众日常生活息息相关的新名词,KVM被这几大云服务提供商广泛采用 [1] ,使得它成为云计算世界里事实上的虚拟化标准。在这样的市场背景下,以Intel为代表的x86硬件厂商,这些年也愈加重视虚拟化技术的硬件支持与创新 [2] ,ARM平台的硬件虚拟化支持也愈加完善。硬件层面的创新也促使QEMU、KVM在软件层面日新月异。比如,从2013年第1版发行至今,KVM(内核)版本从3.5发展到了4.8;QEMU版本从1.3发展到了2.7;专门针对KVM的qemu-kvm代码树已经废弃(被合并到了主流QEMU中)……因此,上一本书中的很多用例、方法和结论等,在新的代码环境下已经有些不合时宜,甚至会出错。我们有必要给读者提供最新且正确的信息。

Format EPUB
Size 10.1 MB
192
Views
1
Downloads
0.00
Total Donations

AI Guide

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

Full assistant
AI guide
# KVM实战:原理、进阶与性能调优 — Reading Guide ## 【One-Line Pitch】 A comprehensive, hands-on guide to KVM virtualization—covering everything from CPU virtualization principles and environment building to management tools and performance tuning—ideal for Linux engineers, cloud infrastructure developers, and anyone deploying or operating KVM-based virtualization platforms. ## 【Book Arc】 - **Opening (~0%–9%)**: Introduces virtualization concepts, cloud computing history, and the landscape of virtualization solutions (Xen, Container, etc.), positioning KVM as the de facto standard in cloud environments. Covers the fundamental distinction between full virtualization, paravirtualization, and hardware-assisted virtualization. - **Early (~9%–24%)**: Dives into KVM's core principles—CPU virtualization with Intel VMX/AMD SVM, memory virtualization with EPT/NPT, and the KVM/QEMU architecture. Explains the VM Entry/VM Exit lifecycle and the role of VMCS. Also covers building a KVM environment from scratch: downloading kernel source, compiling KVM modules, and installing QEMU. - **Early (~24%–33%)**: Walks through the complete build process—installing the compiled kernel, loading kvm and kvm_intel modules, verifying /dev/kvm, configuring and compiling QEMU, and launching the first guest machine. Includes practical command-line examples and troubleshooting checkpoints. - **Middle (~33%–48%)**: Introduces KVM management tools, with deep coverage of libvirt—its architecture (API library, libvirtd daemon, virsh CLI), the eight categories of libvirt APIs (connection, domain, node, network, storage volume, etc.), and remote management capabilities via SSH/TLS. - **Middle (~48%–60%)**: Continues with practical tool usage—virsh command-line operations (interactive and non-interactive modes), virt-manager GUI workflows for creating and managing guests, and the ecosystem of supporting tools like vhost-net, Open vSwitch, DPDK, SPDK, Ceph, and libguestfs for specialized use cases. - **Late (~60%–100%)**: Covers advanced topics including performance tuning, storage and network optimization, and production deployment considerations. (Excerpts provide limited detail on this section—see Coverage Limits.) ## 【Key Takeaways】 - **KVM is a Linux kernel module, not a standalone hypervisor** (Early): It leverages the kernel's process scheduler and memory management, making it a Type 2 hypervisor that inherits Linux's performance and scalability—supporting up to 288 vCPUs and 4TB RAM per guest. - **Hardware-assisted virtualization is the foundation** (Early): Intel VMX and AMD SVM provide root/non-root operation modes; the VMCS structure controls transitions between them. Understanding VM Entry/VM Exit is essential for grasping KVM's execution model. - **Memory virtualization has evolved from software to hardware** (Early): The traditional GVA→GPA→HVA→HPA translation via shadow page tables has been replaced by EPT (Intel) and NPT (AMD), where hardware handles address translation automatically—now enabled by default in KVM. - **QCOW2 is KVM's native disk format** (Early): It supports sparse allocation, snapshots (including multi-level), compression, and encryption—making it superior to raw format for most use cases, though raw still has performance advantages in certain workloads. - **libvirt is the de facto management layer** (Middle): Its API library, libvirtd daemon, and virsh CLI provide unified management across hypervisors. The API is organized into eight functional groups (connection, domain, node, network, storage, etc.), enabling everything from lifecycle control to remote management. - **The KVM ecosystem extends beyond core virtualization** (Middle): Tools like vhost-net (in-kernel virtio backend), Open vSwitch (SDN), DPDK/SPDK (high-performance packet/storage processing), and Ceph (distributed storage) address specific performance and scalability requirements in production environments. - **Building KVM from source is a valuable learning exercise** (Early): The process of downloading kvm.git, compiling the kernel, and configuring QEMU reveals the underlying architecture—though for production, using distribution packages is recommended for stability. ## 【Reading Tips】 - **Skim the cloud computing history in Chapter 1** (~0%–6%): The AWS/Aliyun revenue comparisons and Xen history are context, not core knowledge. Focus instead on the virtualization taxonomy (full vs. paravirtualization) and KVM's architectural advantages. - **Deep-read Chapter 2 on KVM principles** (~9%–15%): The CPU virtualization lifecycle (VMXON→VMLAUNCH→VM Exit→VMXOFF) and memory virtualization with EPT/NPT are the conceptual foundation for everything that follows. Don't rush through this. - **Follow the build process hands-on** (~15%–33%): The kernel compilation and QEMU configuration steps are best learned by doing. If you're not building from source, still read through to understand the components and their relationships (e.g., /dev/kvm as the QEMU-KVM interface). - **Use the libvirt API chapter as a reference** (~39%–48%): The eight API categories are presented systematically—skim the function lists initially, then return when you need to write management scripts or understand how tools like virt-manager work under the hood. - **Pay attention to the ecosystem tools section** (~15%): vhost-net, DPDK, SPDK, and Ceph are increasingly important in production KVM deployments. Even if you don't need them immediately, understanding their roles helps you make informed architecture decisions later. ## 【Coverage Limits】 The excerpts cover approximately the first 60% of the book in detail (foundations, environment building, and management tools). The later sections on performance tuning, advanced networking/storage optimization, and production troubleshooting are not represented in the available material—readers seeking those topics should consult the book directly. ##

Passage locations

Excerpt 1
: 1)客户机完全不知道自己运行在虚拟化环境中,还以为自己运行在原生环境里。 2)完全不需要VMM介入客户机的运行过程。 纯软件的虚拟化可以做到第一个目标,但性能不是很好,而且软件设计的复杂度大大增加。 那么如果放弃第一个目标呢?让客户机意识到自己是运行在虚拟化环境里,并做相应修改以配合VMM,这就是半虚拟化(P...
View in text
Excerpt 2
M 3.3.1 下载KVM源代码 KVM作为Linux kernel中的一个module而存在,是从Linux 2.6.20版本开始被完全正式加入内核的主干开发和正式发布代码中。所以,只需要下载2.6.20版本,Linux kernel代码即可编译和使用KVM。当然,如果是为了学习KVM,推荐使用最新正式发布或者...
View in text
Excerpt 3
--interp-prefix=PREFIX where to find shared libraries, etc. use %M for cpu name [/usr/gnemul/qemu-%M] --target-list=LIST set target list (default: build ever...
View in text
Excerpt 4
获取一个存储卷对象,virStorageVolLookupByPath函数可以根据它在节点上的路径来获取一个存储卷对象。有一些函数用于查询存储卷的信息,如virStorageVolGetInfo函数可以查询某个存储卷的使用情况,virStorageVolGetName函数可以获取存储卷的名称,virStorage...
View in text

Recommended for You

Loading recommended books...
Failed to load, please try again later

Tip the Site

Scan the WeChat Pay or Alipay code to tip. No login required.

WeChat Pay
Alipay
Back to List