SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Recomended Hyper-V Memory Settings


Recomended Hyper-V Memory Settings

Author
Message
vega805
vega805
SSChasing Mays
SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)

Group: General Forum Members
Points: 648 Visits: 282
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
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)

Group: General Forum Members
Points: 298729 Visits: 33922
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

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Ken McKelvey
Ken McKelvey
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12742 Visits: 9416
>>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.
jasona.work
jasona.work
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32578 Visits: 15169
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.
vega805
vega805
SSChasing Mays
SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)

Group: General Forum Members
Points: 648 Visits: 282
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
vega805
vega805
SSChasing Mays
SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)SSChasing Mays (648 reputation)

Group: General Forum Members
Points: 648 Visits: 282
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
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)SSC Guru (298K reputation)

Group: General Forum Members
Points: 298729 Visits: 33922
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

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search