dynamic memory management hyperv r2 sp1

42
Hyper-V and Dynamic Memory in Depth Dr. Eduardo Castro Martínez Microsoft MVP [email protected] http://comunidadwindows.org http://ecastrom.blogspot.com

Upload: eduardo-castro

Post on 20-May-2015

2.431 views

Category:

Documents


7 download

TRANSCRIPT

Page 1: Dynamic Memory Management HyperV R2 SP1

Hyper-V and Dynamic Memory in Depth

Dr. Eduardo Castro Martínez

Microsoft MVP

[email protected]

http://comunidadwindows.org

http://ecastrom.blogspot.com

Page 2: Dynamic Memory Management HyperV R2 SP1

Agenda

• Windows 2008 R2 SP1 Overview

• Users, Memory & Virtualization

• Dynamic Memory

– Architecture & Concepts

– System Impact

• Memory Techniques / Competition

Page 3: Dynamic Memory Management HyperV R2 SP1

Windows 2008 R2 SP1 Overview

• New capabilities that will enhance both virtualized server

and virtualized desktop deployments

– Remote FX: With Microsoft RemoteFX, users will be

able to work remotely in a Windows Aero desktop

environment, watch full-motion video, enjoy

Silverlight animations, and run 3D applications within

a Hyper-V VM – all with the fidelity of a local-like

performance.

– Hyper-V Dynamic Memory: With Hyper-V Dynamic

Memory, Hyper-V will enable greater virtual machine

density suitable for servers and VDI deployments.

Page 4: Dynamic Memory Management HyperV R2 SP1

Users, Memory & Virtualization

Page 5: Dynamic Memory Management HyperV R2 SP1

No one can size VMs

• How much memory does an IIS server actually need?

• SQL 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 6: Dynamic Memory Management HyperV R2 SP1

No one wants to size VMs

“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 7: Dynamic Memory Management HyperV R2 SP1

Virtualization and memory

• Use physical memory as efficiently and dynamically

as possible with minimal performance impact.

– Customers investing in virtualization hosts are

purchasing systems with larger memory

configurations (32 GB, 64 GB, 128 GB and more) and

want to fully utilize this system asset.

– At the same time, they’re purchasing this memory to

provide superior performance and to avoid paging.

• Provide consistent performance and scalability.

– One frequent comment from virtualization users is

that they don’t want a feature with a performance cliff

or inconsistent, variable performance.

Page 8: Dynamic Memory Management HyperV R2 SP1

Virtualization & Memory

• Memory

– Key factor to the number of running VMs

– Possibly most expensive asset in system

• Customer Requirements

– Maximum density, without sacrificing performance

– Maintain consistent performance

– Don’t provide a feature that’s unsuitable for

production use

Page 9: Dynamic Memory Management HyperV R2 SP1

Virtual Machine Performance & Density

• Hyper-V Dynamic Memory is a memory management

enhancement for Hyper-V designed for production use

that enables customers to achieve higher

consolidation/VM density ratios

Page 10: Dynamic Memory Management HyperV R2 SP1

Hyper-V R2 SP1

Dynamic Memory

Page 11: Dynamic Memory Management HyperV R2 SP1

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 12: Dynamic Memory Management HyperV R2 SP1

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 13: Dynamic Memory Management HyperV R2 SP1

System Requirements

• Parent Requirements:

– Windows Server 2008 R2 SP1

– Microsoft Hyper-V Server 2008 R2 SP1

• Windows Server 2003, 2008 & 2008 R2

• 32-bit & 64-bit versions

– Windows Vista and Windows 7

• Enterprise and Ultimate Editions only

• 32-bit & 64-bit versions

Page 14: Dynamic Memory Management HyperV R2 SP1

Dynamic Memory Architecture &

Concepts

Page 15: Dynamic Memory Management HyperV R2 SP1

Dynamic Memory Architecture

Windows

Kernel

Guest Applications

VMBus

Hypervisor

VMMS

OS

Microsoft Hyper-V

User

Mode

Kernel

Mode

Provided by:

VMBus

VMWP

VID

Memory

Balancer

Memory

Balancer

Interface

GMO

Memory

Manager

DM

VDEV/VSP

DM VSC

Dynamic Memory Components

Windows

Kernel

Page 16: Dynamic Memory Management HyperV R2 SP1

Example 0 512 MB

Hot-add

1024MB

Hot-add

VM Memory

Ballooned Memory VM Memory

Second VM Memory Parent Memory

Page 17: Dynamic Memory Management HyperV R2 SP1

Startup & Max

• 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

Page 18: Dynamic Memory Management HyperV R2 SP1

Availability & Priority

• Availability is a concept

– How much memory does the VM have?

– How much memory does the VM want?

– The difference is the availability

• Priority: which VM gets the memory first

– 1-10,000: default is 5,000

– The higher the priority, the higher the availability

Page 19: Dynamic Memory Management HyperV R2 SP1

Memory 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”

Page 20: Dynamic Memory Management HyperV R2 SP1

Dynamic Memory

• DEMO

Page 21: Dynamic Memory Management HyperV R2 SP1

System Impact

Page 22: Dynamic Memory Management HyperV R2 SP1

Changes to Root Reserve

• Hyper-V has always had the concept of a reserve of

memory that is kept for the parent partition

• 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 23: Dynamic Memory Management HyperV R2 SP1

Changes to NUMA management…

• Wait – what is NUMA?

• Why do I care?

• How does this work today?

Page 24: Dynamic Memory Management HyperV R2 SP1

What is “NUMA”?

• A traditional computer:

Page 25: Dynamic Memory Management HyperV R2 SP1

What is “NUMA”?

• A NUMA computer:

Page 26: Dynamic Memory Management HyperV R2 SP1

Why do I care?

• VM memory should come from the “local NUMA node”

Page 27: Dynamic Memory Management HyperV R2 SP1

Why do I care?

• VM memory should come from the “local NUMA node”

Page 28: Dynamic Memory Management HyperV R2 SP1

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 29: Dynamic Memory Management HyperV R2 SP1

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 30: Dynamic Memory Management HyperV R2 SP1

Disabling NUMA Spanning

• Makes the system behave like multiple small computers

Page 31: Dynamic Memory Management HyperV R2 SP1

Memory Techniques / Competition

Page 32: Dynamic Memory Management HyperV R2 SP1

Understanding philosophical differences

• Microsoft

– Understands what guest information to use

• Building on top of guest OS knowledge

– Trying to get the “best bang for buck” in virtual

memory management

• VMware

– Does not trust guest information

• Building a “black box” solution

– Started with memory swapping, and digging out of

the hole

Page 33: Dynamic Memory Management HyperV R2 SP1

Dynamic Memory, not Overcommit

• Overloaded Term

– Page Sharing

– Second Level Paging

– Balloon Type Mechanisms

• 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)

• DM treats memory like we treat CPU resources

– Dynamically schedulable resource

Page 34: Dynamic Memory Management HyperV R2 SP1

External Page Sharing

• How it works:

1. Hash all memory and store it in a table…

2. Identify the common hashes and then…

3. Perform a bit by bit comparison

• What VMware doesn’t tell you…

– Page Sharing not dynamic

– Can take hours to share pages

– The largest benefit are zero pages

– Doesn’t work with large pages

Page 35: Dynamic Memory Management HyperV R2 SP1

Second Level Paging

• Many problems:

– Swapping Guest Kernel Resources

– Double Paging

– Disks are slow

• But it always works…

Page 36: Dynamic Memory Management HyperV R2 SP1

Other Techniques

• Guest directed page sharing

• Memory compression

• And on…

• We will continue to invest here and work on identifying

the best techniques for customer work loads

Page 37: Dynamic Memory Management HyperV R2 SP1

What next?

Page 38: Dynamic Memory Management HyperV R2 SP1

Test the beta – and talk to us!

• Try Dynamic Memory out – for both server and desktop

environments

– Let us know how DM is working for you

– Let us know if you think we have something wrong

Page 39: Dynamic Memory Management HyperV R2 SP1

More Resources

Virtualization @ Microsoft: http://www.microsoft.com/virtualization

Hyper-V on TechNet: http://technet.microsoft.com/library/cc753637(WS.10).aspx

Virtualization Team Blog: http://blogs.technet.com/b/virtualization/

http://blogs.msdn.com/b/virtual_pc_guy

Page 40: Dynamic Memory Management HyperV R2 SP1

Source Info

www.microsoft.com/teched www.microsoft.com/learning

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

Page 41: Dynamic Memory Management HyperV R2 SP1

Hyper-V and Dynamic Memory in Depth

Dr. Eduardo Castro Martínez

Microsoft MVP

[email protected]

http://comunidadwindows.org

http://ecastrom.blogspot.com

Page 42: Dynamic Memory Management HyperV R2 SP1

© 2008 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.