Hyper-V Dynamic Memory in Depth
-
Upload
microsoft-technet-belgium-and-luxembourg -
Category
Documents
-
view
3.141 -
download
0
description
Transcript of Hyper-V Dynamic Memory in Depth
![Page 1: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/1.jpg)
Hyper-V Dynamic Memory in Depth
Bryon Surace Senior Program ManagerWindows Server, Microsoft
![Page 2: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/2.jpg)
Agenda
•Memory & Virtualization •Memory Optimization Techniques• Hyper-V Dynamic Memory• Architecture & Concepts• Demo• System Impact
•Q&A
![Page 3: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/3.jpg)
Memory & Virtualization
![Page 4: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/4.jpg)
Virtualization & Memory•How much memory does a server actually need?• IIS Server?• Print server?• File server?• Branch Cache?• Direct Access?
•How much will performance be affected if you halved the amount of memory in a VM?
![Page 5: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/5.jpg)
No one wants to size VMs Memory
• “New virtual machines get 1GB of RAM [no matter what the VM is running]. I only give people more memory if they complain about performance”
• “All VMs get 4GB of RAM [I have no idea what is happening with that memory] and no one complains”
• “I take the minimum system requirements and add (insert one: 50%, 100%, 150%)”
• “A vendor tells me their app needs 4GB of RAM. I do not have the time to test this to find out if it is true or not”
![Page 6: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/6.jpg)
Virtualization & Memory• Memory• Key Factor to the number of running VMs• The most utilized asset in the system, but also a more expensive asset
• Statistics on resource utilization of workloads • CPU 10%• Memory 40%• Network I/O <5%• Disk I/O <5%
• Customer Requirements• Maximum density, without sacrificing performance• Maintain consistent performance• Don’t provide a feature that’s unsuitable for production use
![Page 7: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/7.jpg)
Dynamic Memory Goals•Higher VM consolidation ratios with minimal performance
impact• Dependent on:• How much variation in memory utilization the workloads have• How good a job you did of sizing the systems in the first place
•Work well for both server and desktop workloads•Add minimal overhead to the system• Pass the “that looks right” test
![Page 8: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/8.jpg)
Understanding philosophical differences
•Host and Guest Collaborate• Understands what guest information to use• Trying to get the “best bang for buck” in virtual memory
management
•Host works in Isolation• Does not trust guest information• Building a “black box” solution
![Page 9: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/9.jpg)
Dynamic Memory, not Overcommit
•Overloaded Term• Over-subscription vs. Over-committment
•No one wants to overcommit their resource• You don’t overcommit other resources (really – you do not)• VMware does not want you to overcommit memory (really)
•Dynamic Memory treat memory like we treat CPU resources• Dynamically schedulable resource
![Page 10: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/10.jpg)
Memory Management & Optimization Techniques
![Page 11: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/11.jpg)
Ballooning• How it works:• Increasing the size of the balloon forces the guest to react to memory pressure by
releasing unused pages• Decreasing the size makes more memory available to the guest
VM
Memory
Host Computer
Balloon
Disk
VM
Host Computer
Memory
Balloon
DiskInflate
Swap Out
Ballloon
Deflate
VM
Host Computer
Memory
Disk
Swap In
Balloon
Deflate
![Page 12: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/12.jpg)
Second Level Paging
•How it works: • Paging at the virtualization layer by swapping VMs
memory out to disk•Many problems:• Swapping Guest Kernel Resources•Double Paging•Disks are slow
•But it always works…
![Page 13: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/13.jpg)
External Page Sharing• How it works: • Eliminate redundant copies of memory pages common to more than one
virtual machine1. Hash all memory and store it in a table…2. Identify the common hashes and then…3. Perform a bit by bit comparison
• Problems• Page Sharing not dynamic• Can take hours to share pages• The largest benefit are zero pages• Doesn’t work with large pages
![Page 14: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/14.jpg)
Other Techniques•Guest directed page sharing•Memory compression•And on…
![Page 15: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/15.jpg)
Hyper-V R2 SP1Dynamic Memory Architecture & Concepts
![Page 16: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/16.jpg)
System Requirements
•Parent Requirements:•Windows Server 2008 R2 SP1, Windows Server 2012•Hyper-V Server 2008 R2 SP1, Hyper-V Server 2012
•Guest Requirements:•Windows Server 2003, 2008 & 2008 R2, 2012• 32-bit & 64-bit versions
•Windows Vista, Windows 7, Windows 8• Enterprise and Ultimate Editions only• 32-bit & 64-bit versions
![Page 17: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/17.jpg)
Adding/Removing Memory
•Adding Memory• Enlightened fashion• Synthetic Memory Driver (VSP/VSC Pair)
•No hardware emulation• Light weight
•Removing Memory•Wanted to remove memory•Ballooning is more efficient•Messes up task manager in the guest OS
![Page 18: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/18.jpg)
Adding/Removing Memory
•Active Memory addition•Memory is added immediately when VM needs it
• Passive Memory reclamation•Memory is not removed when there is no immediate need• Unutilized memory is collected every 5 minutes
![Page 19: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/19.jpg)
Startup & Max
Windows Server 2008 R2 SP1• Startup: amount of memory to boot VM• BIOS does not know about DM• Guest OS may not know about DM• Default: 512MB
•Max: don’t let the VM above this amount• Default: 64GB
Windows Server 2012• Startup: amount of memory to boot VM•Min: amount of memory the VM can balloon down to•Max: don’t let the VM above this amount
![Page 20: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/20.jpg)
Controlling Memory Availability
•Availability is a concept•How much memory does the VM have?•How much memory does the VM want?• The difference is the availability
•Mechanisms in place to control Memory Availability through Buffer and Priority settings
![Page 21: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/21.jpg)
Memory Buffer & Priority
• Buffer: How much “free” memory should we try and keep in the VM?• Allows for responsiveness to bursty workloads• Can be used for file cache
“I like to configure my virtual machines so that they have ~20% free memory”
• Priority: which VM gets the memory first• 1-10,000: default is 5,000• The higher the priority, the higher the availability
![Page 22: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/22.jpg)
Demo:Dynamic Memory in Action
![Page 23: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/23.jpg)
System Impact
![Page 24: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/24.jpg)
Changes to Root Reserve
•Hyper-V has always had the concept of a reserve of memory that is kept for the parent partition
Host Reserve - Auto-calculated based on:If the machine SLAT capabilityTotal size of host RAMNUMA architecture
Host Reserve VM Overhead Memory utilized by VMs
VM Reserve
![Page 25: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/25.jpg)
Changes to Root Reserve
•DM allows VMs to push up against the reserve consistently•New behavior to better protect the parent partition
from rampaging virtual machines•New registry key in place• Allows you to reserve static memory for the parent partition
•May result in less memory being available for VMs
![Page 26: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/26.jpg)
Changes to NUMA management…•Wait – what is NUMA?•Why do I care?• How does this work today?
![Page 27: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/27.jpg)
What is “NUMA”?• A traditional computer:
Computer
CPU CPU CPU CPU
BUS
Memory
VM VM VM VM
VM VM VM VM
![Page 28: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/28.jpg)
What is “NUMA”?• A NUMA computer:
Computer
CPU CPU CPU CPU
BUS
Memory
VM VM VM VM
VM VM VM VM
Back Channel
Memory
BUS
Node 1 Node 2
![Page 29: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/29.jpg)
Why do I care?• VM memory should come from the “local NUMA node”
Computer
CPU CPU CPU CPU
BUS
Memory
VM VM VM VM
VM VM VM VM
Back Channel
Memory
BUS
Node 1 Node 2
Good!
![Page 30: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/30.jpg)
Why do I care?• Ideally VM memory should come from the “local NUMA node”
Computer
CPU CPU CPU CPU
BUS
Memory
VM VM VM VM
VM VM VM VM
Back Channel
Memory
BUS
Node 1 Node 2
Bad
![Page 31: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/31.jpg)
How does this work today?
• Hyper-V tries to get all memory for a virtual machine from a single NUMA node•When it cannot – the virtual machine “spans” NUMA nodes• Users can set preferred NUMA nodes for virtual machines in order
to get the best distribution
![Page 32: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/32.jpg)
Changes to NUMA management•Dynamic memory can result in more virtual machines
spanning NUMA nodes• A virtual machine might start all on one node – but added
memory might come from another node•New option to disable NUMA node spanning
![Page 33: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/33.jpg)
Disabling NUMA Spanning• Makes the system behave like multiple small computers
Computer
CPU CPU CPU CPU
BUS
Memory
VM VM VM VM
VM VM VM VM
Back Channel
Memory
BUS
Node 1 Node 2
![Page 34: Hyper-V Dynamic Memory in Depth](https://reader036.fdocuments.us/reader036/viewer/2022062405/555c4538d8b42a0b038b5134/html5/thumbnails/34.jpg)
Questions and Answers