3

I have three VMs running on Red Hat Enterprise Linux with 8 GB RAM, each of the VMs has 3 GB allocated, and I also run a 512 MB VM. If we also consider the guest OS's memory usage (usually 1.5 GB due to a mandatory corporate-issued antivirus), this adds up to 11 GB of RAM. In order to be able to run all that stuff without grinding my computer to a halt, I use ZRAM with 7 GB of maximum memory usage. Most of the time I hardly have any trouble this way, but in return, my memory is usually very full, with about 700 MB of free physical RAM and roughly the same amount of free ZRAM.

What I have found from this setup, is that in order to successfully save a VM's state using virt-manager's Save command (which translates to virsh's managedsave), I must add some extra swap space, and when this happens my VM will save at about the rate at which the swap space is read, because it would seem as if the VM state saving algorithm is to copy blocks of guest memory to the host's memory and then save these blocks to hard disk, which means saving a VM's state requires some amount of extra memory. By trial and error I found the minimum extra virtual memory required to save my 3 GB VMs to be 1 GB, i.e. I must issue swapon <pagefile> on a 1 GB file formatted as swap space, which leads me to believe that you need at least 30% of your VM's assigned memory available in order to save its state. Also, when I have enough ZRAM available but my main memory is almost full, I can see on GKrellm how my system is fumbling pages at full speed on in-memory swap space.

So, does anyone know exactly why does KVM-QEMU requires extra memory in order to save a VM's state?

  • i dont use virsh or virt-manager and typically just script qemu with cli options. i think that a good deal of what you ask about is directly related to the v* management app here - maybe they are copying the guests mem image in a tmpfs or maybe it has to do w/ the shadow mmu? or perhaps a compression algorithm needs it while it packs the image? in any case, when interacting w/ qemu directly you can use pre-existing fds to handle this kind of thing - which is probably what they do too - though you might tweak it better yourself at the cli directly. do man qemu maybe to read more – mikeserv Dec 6 '14 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.