Recomended Hyper-V Memory Settings

  • I am seeking insight on memory management for Hyper-V. I have reviewed much of the material on Virtual Memory available on the net. I have a couple generation 2 VM's, allocating 8 GB from the host machine on each (host machine has 16 GB RAM.) and using standard Dynamic Memory settings. Application of the VM is for a SQL Server sandbox. I am puzzled in that 1) I am allocating 8,192 MB, Hyper-V Manager says Assigned Memory of 1,636 but the VM says 7.4 of 8.0 GB. This is the state when I end any MSSQL related tasks, there looks to be low utilization in TaskManager. The memory the VM is using doesn't seem to be proportionate to what I allocated - I feel I am missing something here or something is not performing correctly.

    Hyper-V settings

    Comparing Hyper-V Manager with Task Manager on the VM

    _____________________________________________________________________
    As soon as you see something, you already start to intellectualize it. As soon as you intellectualize something, it is no longer what you saw. Suzuki-roshi

  • OK. So you have 16gb of memory. You can't allocate all of it to the VMs. You have to have memory left behind on the physical box to ensure there's memory there for managing the OS and the hypervisor. If you do attempt this, what happens is that you start getting all sorts of swapping of memory pages out to disk. This is a bad situation. Instead, drop down to about 14gb and allocate 7gb to each SQL Server instance. Then go from there.

    Is this meant to be a production server? If so, 16gb is exceedingly tiny. My tablet-style laptop has 16gb of memory. I wouldn't attempt to run a production load on the system.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • >>Is this meant to be a production server? If so, 16gb is exceedingly tiny

    I suspect that depends on the system. We have a system with a 12GByte DB and about 20 concurrent users which runs adequately with 4GB of memory for the DB instance. Admittedly a lot of the data is historical and rarely used. Also write latency is slightly high at 32ms but no one has complained.

  • One thing I've picked up about running VMs is, you can't trust the RAM utilization reported by the guest OS (the VM.)  It will *always* claim to be seeing the max available RAM that was granted in the hypervisor.  Instead, on the Hyper-V server (this is easier if it's a full OS) there are specialized performance counters in PerfMon for tracking the RAM used by a VM.

    I believe with the dynamic RAM settings, when "actual" RAM isn't being "actively" used by the guest OS, it's swapped to disk (so the VM still has X amount of RAM, but Y amount has been swapped to disk) rather than actually "removed" from the OS.

    As for the "Assigned Memory" field, I *think* that might be how much "real" RAM on the Host is currently being used / given to the VM.

  • Grant Fritchey - Monday, April 3, 2017 2:43 AM

    OK. So you have 16gb of memory. You can't allocate all of it to the VMs. You have to have memory left behind on the physical box to ensure there's memory there for managing the OS and the hypervisor. If you do attempt this, what happens is that you start getting all sorts of swapping of memory pages out to disk. This is a bad situation. Instead, drop down to about 14gb and allocate 7gb to each SQL Server instance. Then go from there.

    Is this meant to be a production server? If so, 16gb is exceedingly tiny. My tablet-style laptop has 16gb of memory. I wouldn't attempt to run a production load on the system.

    Thanks for contributing Grant, I read a lot of your published material. I said I had 2 VM's @ 8GB each - I do not run these simultaneously but one at the time always reserving <=8GB to the host. It is not a production server but a learning environment on ThinkPad. My confusion is the seeming differential between what Hyper-V manager says is allocated to the VM and what the VM utilization seems to be via task manager- that is I know I'm not using 90% of 8GB with just SSMS open.

    _____________________________________________________________________
    As soon as you see something, you already start to intellectualize it. As soon as you intellectualize something, it is no longer what you saw. Suzuki-roshi

  • jasona.work - Monday, April 3, 2017 12:22 PM

    One thing I've picked up about running VMs is, you can't trust the RAM utilization reported by the guest OS (the VM.)  It will *always* claim to be seeing the max available RAM that was granted in the hypervisor.  Instead, on the Hyper-V server (this is easier if it's a full OS) there are specialized performance counters in PerfMon for tracking the RAM used by a VM.

    I believe with the dynamic RAM settings, when "actual" RAM isn't being "actively" used by the guest OS, it's swapped to disk (so the VM still has X amount of RAM, but Y amount has been swapped to disk) rather than actually "removed" from the OS.

    As for the "Assigned Memory" field, I *think* that might be how much "real" RAM on the Host is currently being used / given to the VM.

    jasona, this is exactly the scenario I feel I am facing. So don't freak out when utilization on the guest says 80+% but I'm pretty sure I'm leveraging more like 40%? Will the surplus RAM swapped to disk ever "kick in"? Are there any best practices that I should consider in use going forward?

    p.s. when the utilization on the VM spiked past 80% I feel I hear the fan more prominently as if m actually leveraging more resources.

    _____________________________________________________________________
    As soon as you see something, you already start to intellectualize it. As soon as you intellectualize something, it is no longer what you saw. Suzuki-roshi

  • SQL Server within the VM is going to claim all the memory it can (as usual) and it won't release any. So it's not a surprise that you get 90% usage pretty quick. That's what I would expect.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply