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|i9|zh|os|rv|y7|6c|d0|a2|wz|me|c0|dw|vm|uy|zq|bp|db|6n|v7|o3|yy|o4|9e|vr|m8|rp|hj|ji|ik|7d|qe|xl|wt|2q|vi|r3|nw|hv|pm|ch|f2|bf|gw|73|oe|zq|5f|me|by|sr|8v|3z|n5|lk|i6|rq|6y|yg|un|bu|al|uc|gw|vx|v4|ol|en|dy|wk|27|si|ul|6p|yy|6i|g6|cg|9r|vk|52|vg|xr|z6|ct|zb|l8|p2|qm|o0|to|ct|wh|sp|q6|xs|bk|sy|ns|ny|lv|xc|nk|tk|2y|ee|xd|pd|ye|38|ck|5c|qk|xe|qr|zm|ko|en|h9|b1|al|9k|gi|e0|hr|u4|lk|dn|zr|pp|by|ig|yo|px|o1|sr|ro|sd|bq|ck|q7|ue|dy|5w|l7|gh|zh|uh|1 Hyper-V, Virtual RAM and Virtual CPUs – Win10.Guru
Go to ...

RSS Feed

Hyper-V, Virtual RAM and Virtual CPUs

Quite a number of IT pros and advanced users alike use virtual machines to test Windows Insider builds, to run legacy operating systems for intermittent needs, to have a sandbox environment to test new software, or for a myriad of other reasons. My choice for virtualization software is Hyper-V, and has been since it was included in the consumer version of Windows 8.

There are two things to consider when creating a virtual machine to assure it will run properly: first, the amount of virtual RAM (vRAM from here on) and second, the number of virtual processors (vCPU). Both of these give you some choices.

Assigning vRAM you can elect if you use dynamic RAM giving VM minimum and maximum values for assigned RAM which it then takes and frees from host RAM according to its needs. Selecting the count for vCPUs lets you choose the number of virtual processors, where the maximim count is restricted on Windows 10 hosts by the hardware setup and by Non-Uniform Memory Access (NUMA). For more information about NUMA please consult: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/dn282282(v=ws.11).

For instance, if I try to add more than 4 vCPUs to virtual machines on this laptop, I get an error message that in my case, four vCPUs is maximum:

Virtual RAM

As a concept, dynamic RAM  is pretty nice. The VM uses the amount of RAM it needs within assigned minimum and maximum values, taking more from the host RAM when it needs it and freeing it when it’s no longer needed. However, the VM will be and is a bit slow in demanding more RAM when it needs it, which causes issues when you want to launch a process or program that needs more RAM than is currently allocated.

I very strongly advice against selecting and using dynamic RAM for Hyper-V VMs. It is OK if the VM will never be used to anything else than simple browsing and email, but it is not recommended for “work horse” virtual machines. For example: A Windows 8.1 PRO VM in Hyper-V with dynamic RAM, minimum set to 1 GB, maximum 4 GB. When idle, it uses less than 2 GB:

Trying to run a program that requires more RAM that is currently available, or which has a built-in check for minimum RAM for program to run whose requirements exceed currently allocated RAM, you will get an error message. The following screenshot shows what happens if you try to run a Windows 10 upgrade on the previously described Windows 8.1 VM:

Alas, the VM sends the demand for more vRAM to the host too late, or as in the case of this VM and a Windows upgrade, it does not demand it at all. Thus, the upgrade can’t be completed without first switching the VM off and either increasing minimum dynamic vRAM or changing to fixed vRAM.

This is just one simple example. You can of course “trick” the VM to temporarily increase the amount of vRAM by slowly opening various programs demanding more and more vRAM until VM has enough to do the task required, then close those apps and rapidly start the process requiring all that vRAM, but it is much more efficient and in fact time saving to set VM not to use dynamic vRAM in the first place and instead assign it a fixed (and sufficient) amount of vRAM to work with.

How much vRAM should I assign to a VM?

It depends. The rule of thumb (read: my rule!) is to always leave the host at least 2 GB available RAM. Using this laptop of mine as an example, I have 16 GB of RAM. When Windows 10 PRO installed on it has booted to desktop, and I have my chosen browser Edge opened with six or seven tabs, I usually have about 11 GB free. To assure that there will be at least 2 GB free available RAM on host at any given time, I can in other words simultaneously use virtual machines that consume a total of 9 GB of vRAM:

Total RAM 16 GB - RAM host is using to run smoothly 5 GB - 2 GB reserve = 9 GB.

A Windows 10 x64 VM runs really smoothly when it has 3 GB. On the other hand, based on my own experience a VM used for instance for video editing requires 5 GB or more. Yes, that’s right, no typos there: 3 GB and 5 GB! Somewhat surprisingly, I’ve noticed that we IT pros are so accustomed to RAM amounts as 1 GB, 2 GB, 4 GB, 8 GB and so on that we tend to forget that in Hyper-V, you really can set the amount as you wish with increments of 1 MB. Hyper-V accepts any amount of vRAM above the required minimum. If you want to assign a VM 5673 MB it’s totally OK, as would be 1789 or 3197 MB.

Personally, my Linux and Windows XP virtual machines get 512 MB to 1 GB, Windows 7 and 8.1 virtual machines 1 GB to 2 GB, and Windows 10 virtual machines 3 or 4 GB, exception being my video editing VM which gets 6 GB.

Virtual CPU

One host CPU core can support 8 virtual CPUs. Let’s take a look of this laptop of mine:

Four cores, meaning the theoretical maximum of vCPUs to be used at any given time is 32. Of course I cannot assign all these 32 vCPUs to be used at the same time because then the host would be left without any resources, and that system, including both the host and all of its virtual machines would halt. When deciding how many vCPUs a VM gets, we must think about how many VMs we will be running at the same time. In any case I do not want to use more than half of my host CPU resources for virtual machines. Assigning four vCPUs to each VM, I can be sure that I can quite smoothly run three or four virtual machines at any given time, subject to having enough RAM.

My recommendation is to use four vCPUs on each VM with a quad core host CPU, and scale it according to your host CPU. No issues in running virtual machines on dual core CPU host, but in that case I would not give more than two vCPUs per VM.

Hyper-V Quick Create

By default, Quick Create assigns 2 GB of vRAM to each new VM. If / when using Quick Create, please check the settings and change vRAM amount as required before launching the new VM.

I use and recommend you to use Quick Create to create your own VM repository as told in this earlier post of mine. In my case, I use it to create a new repository after each Windows 10 semi-annual feature upgrade. Using for instance my current version 1803 repository, I can quickly create a new VM selecting from four languages and all editions of Windows 10 whenever I have a need to check or test something.

That’s it this time geeks! Possible questions in comments, please.


Author: Kari Finn

A Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

3 Responses “Hyper-V, Virtual RAM and Virtual CPUs”

  1. CountMike
    June 23, 2018 at 09:31

    I use VMware almost exclusively now, number of vCOREs and memory are set as necessary but always 1GB of RAM per vCore as that’s some minimum for physical machines.
    This host machine has more than enough resources to assign half of them and still have more than enough left for host OS.
    Most Linux distros and XP are happy with 2C/2GB. W7 4/4 and for W10 that’s minimum and depending what I’m doing I usually set 8/8.
    The only thing I never checked (tnx. for reminder) is how many threads of each core is actually engaged. This CPU has 2 threads per core and show in Windows 16 “processor” count.

  2. One very useful enhancement in Hyper-V on 2016 and 10 is the ability to change static memory at runtime – you can have a machine running with a certain _fixed_ amount of memory, and change that fixed amount while the VM is live. So you can get the benefits of both a smaller fixed amount moment to moment, but increase for the times when you need to increase. This is of course not as “cool” as dynamic, but it avoids the issue you mention of dynamic not picking up on demand appropriately. (cf. https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/what-s-new-in-hyper-v-on-windows#BKMK_hot )

  3. June 25, 2018 at 16:02

    That is true. I have almost completely given up using dynamic vRAM and use static instead, modifying the amount “on the fly” as needed.

Leave a Reply

This website stores some user agent data. These data are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to opt-out of any future tracking, a cookie will be set up in your browser to remember this choice for one year. I Agree, Deny