CPU hot add of KVM virtualization technology

Keywords: CentOS

1, CPU hot add of KVM virtualization technology
1. Precautions
a. KVM virtualization can't reduce the CPU online, and CPU hot add technology is suitable for the scenario that can't be shut down, but the CPU performance is seriously insufficient
b. The technology of CPU hot add requires higher version of host and virtual machine operating system
c. CPU hot add, the total number cannot be greater than the maximum number of CPUs

 <vcpu placement='auto' current='1'>4</vcpu> #Maximum number of CPU s to view profile
[root@node3 qemu]# virsh setvcpus CentOS-7.3-X86_64  3  --live       #The number of cpu online is adjusted to 3 
[root@node3 qemu]# virsh setvcpus CentOS-7.3-X86_64  3  --config     #Write profile permanent
[root@node3 qemu]# virsh  dominfo  centos7.0
Id:             13
Name:           centos7.0
UUID:           775d07a2-9c58-4d21-9cae-775d1a67063b
OS Type:        hvm
State:          running
CPU(s):         4
CPU time:       65.0s
Max memory:     4096000 KiB
Used memory:    1048576 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: none
Security DOI:   0

#View CPU related information
[root@localhost ~]# cat /proc/interrupts  
[root@localhost ~]# cat /proc/cpuinfo 
[root@localhost ~]# lscpu 

2, KVM memory balloon technology
KVM memory balloon technology can adjust the memory used by virtual machine on demand, so as to improve the utilization of memory.
The virtual machine needs to install the virtio balloon driver, and the kernel turns on config? Virtio? Balloon. CentOS 6 / 7 has the driver installed and turned on by default.

[root@node3 qemu]# virsh  dumpxml centos7.2 | grep memballoon -C2

    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
# View memory balloon size
[root@node3 qemu]# virsh qemu-monitor-command centos7.2 --hmp --cmd info balloon 
balloon: actual=1024
# Configure memory balloon size
[root@node3 qemu]# virsh qemu-monitor-command centos7.2 --hmp --cmd balloon 2048 
[root@node3 qemu]# virsh qemu-monitor-command centos7.2 --hmp --cmd info balloon 
balloon: actual=2048

Posted by dujed on Wed, 01 Jan 2020 11:53:39 -0800