VM's Don't Over commit RAM ( set Dynamic RAM on HYPER-V)


  1. Posts : 11,247
    Windows / Linux : Arch Linux
       #1

    VM's Don't Over commit RAM ( set Dynamic RAM on HYPER-V)


    Hi there

    Even if you are using a 64 Bit OS don't over commit RAM when the VM starts - HYPER-V allows you to set DYNAMIC RAM which means the OS will grab more when it needs it - and then of course you can run MORE VM's or have a better throughput on your HOST.

    If you are using HYPER-V set DYNAMIC RAM - check the box on Memory configuration for the VM.

    Here's my current memory use on a W10 HYPER-V VM -- running a 32 bit version of OFFICE 2010 (EXCEL).

    Maybe I should have used 500MB as start up instead of 2000 MB - (2GB).

    Cheers.

    jimbo
    Attached Thumbnails Attached Thumbnails VM's Don't Over commit RAM ( set Dynamic RAM on HYPER-V)-memory.png  
    Last edited by jimbo45; 08 Oct 2014 at 11:42.
      My Computer


  2. Posts : 17,661
    Windows 10 Pro
       #2

    Jimbo, set the max RAM value lower, you have now the default value of 1 TB there!

    VM's Don't Over commit RAM ( set Dynamic RAM on HYPER-V)-2014-10-08_18h52_07.png
    Last edited by Kari; 08 Oct 2014 at 11:53.
      My Computer


  3. Posts : 1,255
    Windows 10 Pro
       #3

    Jimbo45 and Kari understand this well but others may have difficulty.

    With most virtual machines such as VirtualPC and VirtualBox you must specify how much memory will be assigned to the client OS. When the client OS starts the virtual machine grabs this amount of RAM from the host and keeps it until it terminates. This is simple but has a serious potential problem. If the client OS isn't actively using the memory assigned it will be depriving it's use to the host system which may run short. The host memory manager can't use this memory because it belongs to the virtual machine. This permanent allocation of RAM is a very system unfriendly thing to do but that is the way most virtual machines are designed. With normal applications the system memory manager has almost full control over how much memory each application will get and how long it can keep it.

    HYPER-V has a better way. You can specify a minimum and maximum range of memory the virtual machine can use. The memory usage of the client varies dynamically according to it's needs, not some fixed value set by the user. The problem occurs when you set the upper limit too high.

    I don't know if this dynamic behavior is ultimately under the control of HYPER-V or the system memory manager. Maybe Jimbo or Kari knows.
      My Computer


  4. Posts : 17,661
    Windows 10 Pro
       #4

    LMiller7 said:
    I don't know if this dynamic behavior is ultimately under the control of HYPER-V or the system memory manager.
    Not completely, the system has some design flaws. An example scenario;

    I run Windows 7 Ultimate vm in Hyper-V with dynamic memory, startup 2 GB, min 512 MB max 4 GB. In this Windows 7 vm I have installed Virtual PC and XP Mode (yes, just for fun of it!). XP Mode has 1 GB RAM assigned to it.

    When I launch XP Mode immediately after booting the Win7 vm, it has enough RAM to run. The same if I launch it after first having a bunch of apps open in Win 7 vm and then closing them all. In these both cases Win 7 vm has enough RAM to give 1 GB to XP Mode and let it run.

    However, if the Win 7 vm is idle a few minutes, it drops excessive RAM and only uses something in between the min assigned 512 MB and 1 GB. Launching XP Mode now fails due "Not enough memory", (as far as I have noticed) Hyper-V can only assign more RAM on the run slowly; launching apps which bring the used RAM close to what the vm at that point has to offer, Hyper-V gives more bit by bit.

    The above example might not be a very good one, usually Hyper-V is quite good with RAM allocating, the problem is apps and programs like XP Mode in my example which require more than usual startup RAM.
    Last edited by Kari; 08 Oct 2014 at 14:38.
      My Computer


  5. Posts : 3,502
    Win_8.1-Pro, Win_10.1607-Pro, Mint_17.3
       #5

    Kari said:
    Jimbo, set the max RAM value lower, you have now the default value of 1 TB there!
    I don't think Jim set the max that high, but he should set it lower than the physical memory, leaving some memory for the host and other machines.

    I noticed that Hyper-V sets an unrealistic max memory - so users have to explicitly lower it when they choose dynamic memory. I don't recall this when I first started playing with Hyper-V, but noticed it after a few VM were built.

    I think that was because I initially set up the machne(s) with a fixed amount and then changed it to dynamic in the VM settings. In other words, if I set dynamic memory in the VM wizard, the max is crazy high. If I set a fixed memory amount and after the VM is created, change it to dynamic the max is ???? (I forget if it was blank or the physical memory amount).

    Host OS is Win8 with two guest machines (Win7 Home Premium & Win10 preview)
      My Computer


  6. Posts : 17,661
    Windows 10 Pro
       #6

    Slartybart said:
    I don't think Jim set the max that high
    I don't think that either, as I mentioned in the post you quoted it looks as he was using the default value which is 1 TB.

    Especially some Linux guests take incredible amount of RAM if allowed. My rule of thumb is to always leave 2 GB minimum for host, setting the max value in virtual machines never higher than host RAM minus 2 GB.
      My Computer


  7. Posts : 11,247
    Windows / Linux : Arch Linux
    Thread Starter
       #7

    Hi there.

    Thanks everybody --

    I left the default -- wish I did have 1TB of RAM in the system -- have changed it now.

    However the point was that if you CAN set dynamic RAM (as in HYPER-V) then the VM will normally only use what it needs rather than being fixed at start time.

    VM's on the whole will EAT RAM for breakfast if they are allowed to.

    Cheers
    jimbo
      My Computer


  8. Posts : 11,247
    Windows / Linux : Arch Linux
    Thread Starter
       #8

    Kari said:
    Not completely, the system has some design flaws. An example scenario;

    I run Windows 7 Ultimate vm in Hyper-V with dynamic memory, startup 2 GB, min 512 MB max 4 GB. In this Windows 7 vm I have installed Virtual PC and XP Mode (yes, just for fun of it!). XP Mode has 1 GB RAM assigned to it.

    When I launch XP Mode immediately after booting the Win7 vm, it has enough RAM to run. The same if I launch it after first having a bunch of apps open in Win 7 vm and then closing them all. In these both cases Win 7 vm has enough RAM to give 1 GB to XP Mode and let it run.

    However, if the Win 7 vm is idle a few minutes, it drops excessive RAM and only uses something in between the min assigned 512 MB and 1 GB. Launching XP Mode now fails due "Not enough memory", (as far as I have noticed) Hyper-V can only assign more RAM on the run slowly; launching apps which bring the used RAM close to what the vm at that point has to offer, Hyper-V gives more bit by bit.

    The above example might not be a very good one, usually Hyper-V is quite good with RAM allocating, the problem is apps and programs like XP Mode in my example which require more than usual startup RAM.
    Hi there

    I think that's the problem of running a 2nd level Virtual Machine -- The HYPER-V only has knowledge of what your W7 wants - when it's idle the RAM will reduce until it's just enough for the minimum of your W7 guest.

    Now starting XP mode in a W7 VIRTUAL Machine - well the XP machine thinks ITS HOST is the W7 machine which is a virtual machine - and currently only has say the idle RAM - 512MB or so -- so the XP mode fails since in ITS HOST there isn't enough RAM.


    I remember playing around with this sort of stuff when I was messing around with ESXI in a Virtual machine and then running 2nd level VM's in the ESXI virtual machine.

    Cheers

    jimbo
      My Computer


  9. Posts : 803
    10 Pro Preview x64
       #9

    Kari said:
    Jimbo, set the max RAM value lower, you have now the default value of 1 TB there!
    VM's Don't Over commit RAM ( set Dynamic RAM on HYPER-V)-2014-10-08_18h52_07.png
    Careful setting the startup value higher than minimum also Kari. It may not boot at all if you have insufficient avaliable RAM on your system. Generally you should set the startup to the minimum.
      My Computer


  10. Posts : 17,661
    Windows 10 Pro
       #10

    adamf said:
    Careful setting the startup value higher than minimum also Kari. It may not boot at all if you have insufficient avaliable RAM on your system. Generally you should set the startup to the minimum.
    I most politely disagree, my esteemed fellow geek, for two reasons:

    1. Setting the values as in my screenshot (I use those values in Seven and Linux virtual machines) I force system to check that there's sufficient RAM available to run vm smoothly. In case of Seven and most Linux distros 1 GB is enough whereas 512 MB makes them "sticky", especially when booting up. If the assigned 1 GB is not available I don't even want to run my vm, it would be slow as hell with a 512 MB vm and less than that available on host. When booted up, I then allow the RAM be dropped to 512 MB when the vm is idle; when idle I am usually working on host which then have more resources.
    2. I quite often trust default settings in most Microsoft programs. The 1 GB startup and 512 MB minimum are both default Hyper-V values when setting up a new vm.

    Kari
    Last edited by Kari; 08 Oct 2014 at 17:45.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 11:37.
Find Us




Windows 10 Forums