Normal management memory of a KVM virtual machine is about 1.2GB, normal no more than 2GB
Standard virtual machine available memory calculation method:
Host physical memory-system reserved Memory 4gb-n virtual Machine physical memory-(n virtual machines * 2GB virtual machine management memory)
Memory waste that may exist:
System normal Memory usage is: 2.5GB, idle 1.5GB
Virtual machine management memory is typically: 1.2GB, idle 0.8GB
Virtual machine internal business unused physical memory: variable size (usually not reusable)
Ways to avoid memory waste:
Increase the virtual memory and use the swap partition.
How is the swap partition size set?
The normal size should be set to a possible wasted memory size plus 2GB of guaranteed memory. Assuming that the host needs to start 8 virtual machines at the same time, the swap partition size should be set to:
System may waste 1.5GB + virtual machine management possible memory waste 0.8GB * 8 VM = 8GB
In the light load environment, the use of increasing the swap partition to avoid memory waste is still more reliable, at this time the virtual machine available memory calculation method is:
Host virtual memory Size-system reserved Memory 4gb-n virtual Machine physical memory-(n virtual machines * 2GB virtual machine management memory)
In principle, virtual machines cannot use swap partitions, which can cause a dramatic decrease in performance.
Using the swap partitioning scheme can be used in low-load VM environments to take full advantage of physical memory and avoid waste.
If the virtual machine load on the host is generally heavier, it should be allocated according to the standard available memory calculation method, based on the physical memory size.
A certain swap partition should be allocated in the light or heavy load environment to prevent the virtual machine from being killed by oom due to insufficient memory.
This article is from the "Members Doukua" blog, make sure to keep this source http://dangzhiqiang.blog.51cto.com/7961271/1782256
KVM Host physical Memory reservation scheme