VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out...

45
Hyper-V and Dynamic Memory in Depth Bryon Surace Senior Program Manager Windows Server, Hyper-V Microsoft VIR306

Transcript of VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out...

Page 1: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Hyper-V and Dynamic Memory in Depth

Bryon SuraceSenior Program ManagerWindows Server, Hyper-VMicrosoft

VIR306

Page 2: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Agenda

Memory & Virtualization Memory Optimization TechniquesHyper-V Dynamic Memory

Architecture & ConceptsDemoSystem Impact

Q&A

Page 3: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Memory & Virtualization

Page 4: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

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: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Customer: Not certain how to size

“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: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Virtualization & Memory

MemoryKey Factor to the number of running VMsThe 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 RequirementsMaximum density, without sacrificing performanceMaintain consistent performanceDon’t provide a feature that’s unsuitable for production use

Page 7: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Memory Management & Optimization Techniques

Page 8: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Ballooning

How it works:Increasing the size of the balloon forces the guest to react to memory pressure by releasing unused pagesDecreasing 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 9: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Page Sharing

Page 10: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

External Page Sharing

How it works: Eliminate redundant copies of memory pages common to more than one virtual machine

Hash all memory and store it in a table…Identify the common hashes and then…Perform a bit by bit comparison

ProblemsPage Sharing not dynamicCan take hours to share pagesThe largest benefit are zero pagesDoesn’t work with large pages

Page 11: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Second Level Paging

Page 12: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Second Level Paging

How it works: Paging at the virtualization layer by swapping VMs memory out to disk

Many problems:Swapping Guest Kernel ResourcesDouble PagingDisks are slow

But it always works…

Page 13: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Second Level Paging

Issue: Memory vs Disk PerformanceMemory Access:

DDR3-1600 = 5 ns; DDR3-1333 = 6 nsDDR3-1066 = 7.5 ns; DDR3-800 = 10 ns

Disk Seek Time: ~8 millisecondsFormula for comparing DDR3-800 to disk: .008/.000000010

DDR3-1600 memory is 1,600,000 times faster than diskDDR3-1333 memory is 1,333,333 times faster than diskDDR3-1066 memory is 1,066,666 times faster than diskDDR3-800 memory is 800,000 times faster than disk

Page 14: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Other Techniques

Guest directed page sharingMemory compressionAnd on…

Page 15: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Hyper-V R2 SP1Dynamic Memory Architecture & Concepts

Page 16: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Dynamic Memory Goals

Higher VM consolidation ratios with minimal performance impact

Dependent on:How much variation in memory utilization the workloads haveHow good a job you did of sizing the systems in the first place

Work well for both server and desktop workloadsAdd minimal overhead to the systemPass the “that looks right” test

Page 17: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Understanding philosophical differences

Host and Guest CollaborateUnderstands what guest information to useTrying to get the “best bang for buck” in virtual memory management

Host works in IsolationDoes not trust guest information

“black box” solution

Page 18: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Dynamic Memory

Benefits

Enables higher consolidation ratios per host by addressing the greatest limiting factor

to consolidation: Memory

A Production feature.

Overview

Memory is pooled and dynamically and securely distributed across VMs

Memory is dynamically added/removed based VM usage with no service interruption

Guest enlightened: guests & Hyper-V work TOGETHER

Page 19: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Adding/Removing Memory

Adding MemoryEnlightened fashion

Synthetic Memory Driver (VSP/VSC Pair)

No hardware emulationLight weight

Removing MemoryBallooning is more efficient

Messes up task manager in the guest OS

Page 20: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

System Requirements

Parent Requirements:Windows Server 2008 R2 SP1Microsoft Hyper-V Server 2008 R2 SP1

Guest Requirements:Windows Server 2003, 2008 & 2008 R2

32-bit & 64-bit versions

Windows Vista and Windows 7Enterprise and Ultimate Editions only32-bit & 64-bit versions

Page 21: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Dynamic Memory

Page 22: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Adding/Removing Memory

Active Memory additionMemory is added immediately when VM needs it

Passive Memory reclamationMemory is not removed when there is no immediate needUnutilized memory is collected every 5 minutes

Page 23: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Startup & Max

Startup: amount of memory to boot VMBIOS does not know about DMGuest OS may not know about DMDefault: 512MB

Max: don’t let the VM above this amountDefault: 64GB

Page 24: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Memory Buffer & Priority

Buffer: How much “free” memory should we try and keep in the VM?

Allows for responsiveness to bursty workloadsCan 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 first1-10,000: default is 5,000The higher the priority, the higher the availability

Page 25: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

demo

Dynamic Memory in action

Page 26: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Dynamic Memory APIs

Publicly Availablehttp://msdn.microsoft.com/en-us/library/cc136856(VS.85).aspxWMI interfaces come from the DMTF

Hyper-V UI Hyper-V WMI

Maximum Memory Limit

Minimum Memory Reservation

Startup Memory VirtualQuantity

Priority Weight

Dynamic Memory Buffer TargetMemoryBuffer

Dynamic memory enabled DynamicMemoryEnabled

Page 27: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Upgrading to R2 Service Pack 1

Any other changes to accommodate dynamic memory?

Page 28: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Three Steps…

Ensure Virtual Machines are ready for the updateUpdate the HostUpdate the Guest Integration Services

Page 29: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

System Impact

Page 30: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

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 31: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Changes to Root Reserve

DM allows VMs to push up against the reserve consistentlyNew behavior to better protect the parent partition from rampaging virtual machines

New registry key in placeAllows you to reserve static memory for the parent partition

May result in less memory being available for VMs

Page 32: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

What is “NUMA”?

A traditional computer:

Computer

CPU CPU CPU CPU

BUS

Memory

VM VM VM VM

VM VM VM VM

Page 33: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

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 34: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

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 35: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

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 36: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

How does this work today?

Hyper-V tries to get all memory for a virtual machine from a single NUMA nodeWhen it cannot – the virtual machine “spans” NUMA nodesUsers can set preferred NUMA nodes for virtual machines in order to get the best distribution

Page 37: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

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 38: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

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 39: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Download SP1 Today

Try Dynamic Memory out – for both server and desktop environments!

Page 40: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Track Resources

Don’t forget to visit the Cloud Power area within the TLC (Blue Section) to see product demos and speak with experts about the Server & Cloud Platform solutions that help drive your business forward.

You can also find the latest information about our products at the following links:

Windows Azure - http://www.microsoft.com/windowsazure/

Microsoft System Center - http://www.microsoft.com/systemcenter/

Microsoft Forefront - http://www.microsoft.com/forefront/

Windows Server - http://www.microsoft.com/windowsserver/

Cloud Power - http://www.microsoft.com/cloud/

Private Cloud - http://www.microsoft.com/privatecloud/

Page 41: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Resources

www.microsoft.com/teched

Sessions On-Demand & Community Microsoft Certification & Training Resources

Resources for IT Professionals Resources for Developers

www.microsoft.com/learning

http://microsoft.com/technet http://microsoft.com/msdn

Learning

http://northamerica.msteched.com

Connect. Share. Discuss.

Page 42: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Complete an evaluation on CommNet and enter to win!

Page 43: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

Scan the Tag to evaluate this session now on myTech•Ed Mobile

Page 44: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.

© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to

be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS

PRESENTATION.

Page 45: VIR306. VM Memory Host Computer Balloon Disk VM Host Computer Memory Balloon Disk Inflate Swap Out Ballloon Deflate VM Host Computer Memory.