Вы находитесь на странице: 1из 17

VMMemory(vRAM)Sizing Considerations

Challengesandconsiderationsindetermininghow muchmemorytoallocatetovirtualmachines
WHITEPAPERBYDAVIDDAVISANDBRADBONN

TableofContents
Introduction..................................................................................................................................................2 MemoryUsagethroughDifferentLevelsoftheVirtualizationStack...........................................................3 MemoryBallooning ..............................................................................................................................4 . TransparentPageSharing.....................................................................................................................5 MemoryCompression ..........................................................................................................................5 . VMwarePerformanceMetricstouseforVMMemoryUsageAnalysis.......................................................5 DeterminingifaVMhasMemoryrelatedPerformanceProblems..........................................................7 AdditionalFactorstoKeepinMindwhenSizingVMMemory.....................................................................8 MemoryHogApplications.....................................................................................................................8 Limits.........................................................................................................................................................8 Reservations..............................................................................................................................................8 KnowinganApplicationsNeeds...............................................................................................................9 InstitutingaVMMemorySizingProcess......................................................................................................9 DeterminingTimeFrameforAnalysis.....................................................................................................10 FindingthePeakValue ...........................................................................................................................11 . ComparingthePeakUsageValuetoAllocatedMemory........................................................................11 ForecastingUsageChangesuntilNextMemoryVMAllocationReview ................................................12 . FactorinaBufferValue..........................................................................................................................12 ChangetheVMSizingAllocationandDocumenttheChange................................................................12 SettingUpaRegularMemoryReviewBasedonanAppropriateTimeframe........................................13 ProvisioningaNewVMforAppropriateMemoryAllocations...................................................................13 InitiallyAllocatetheMinimumPossible..................................................................................................14 MonitorMemoryMetricsIntensely.......................................................................................................14 AddMoreMemoryinSmallIncrements.................................................................................................15 AddtheNewVMtotheRegularMemorySizingReviewProcess..........................................................15 Conclusion...................................................................................................................................................15 AbouttheAuthor....................................................................................................................................16 AbouttheSponsor..................................................................................................................................16

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

Introduction
WhensizingvirtualmachinesavirtualizationadministratormustselectthenumberofvCPUs,thesizeof thevirtualdisk,thenumberofvNICs,andtheamountofmemory.Outofallthoseresources,the amountofmemoryallocatedtoeachvirtualmachine(VM)isoftenthemostdifficulttodetermine.This isbecausememoryisthemostdynamicandleastpredictableofthoseresources. VirtualizationadministratorsshouldavoidoverallocatingmemorytotheirVMsbecausedoingsocan wasteexpensiveserverresourcesandwill,therefore,minimizethereturnontheinvestment(ROI)in thatinfrastructure.Ontheotherhand,thebusinesscriticalapplicationsrunningonvirtualmachines alsoneedtomaintainhighperformance,andthelastthingavirtualizationadministratorwantsisto haveperformancecomplaintsfromendusers. VMadministratorsoftenfacedifficultlyinbalancingtheneedtomaximizeROIoftheserverhardware andtherequirementforapplicationstoperformwell.Fortunately,withVMware'smemoryover commitmentcapabilitiesandtheguidancefromthiswhitepaper,virtualizationadministratorswillgaina deeperunderstandingabouthowtomakeVMmemorysizingmorestraightforwardandlessofapainful trialanderrorprocess.Byreadingthiswhitepaper,VMadministratorswilllearn: Howmemoryusageworksatdifferentlevelsofthevirtualizationstack(seeFigure1) ThechallengesindeterminingaVMsmemoryrequirements HowtoscreenformemorybasedVMperformanceissuesbeforeattemptingtooptimizean environment HowtoapproachappropriatesizingofnewVMsthatneedtobedeployed Howtoinstitutearegularmemorysizingprocessforthedatacenter WhatVMperformancemetricsprovidethebestinsightsonmemoryusageandhowtoaccess these

Figure1TheVirtualizationStack

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

MemoryUsagethroughDifferentLevelsoftheVirtualizationStack
Physicalmemoryonthehostismanagedbythehypervisor,andthehypervisorloadsthismemoryjust likeanyotheroperatingsystemdoes.VMsloadedinthehypervisorwillincreasethememoryutilization incrementallyasuserscreatevirtualmachines.OncetheguestOSisrunningandtheapplicationsload, theguestOSbelievesthatitownsallthevirtualmemorythathasbeenconfigured(justasitdoesona physicalserver)andwilloften"pindown"largeblocksofmemorytocacheitforfutureuse. Itisimportanttonotethatvirtualizationisnotapanaceaandthereismemoryoverheadassociatedwith usingthistechnology.Guestsandtheirapplicationswillneverhaveaccesstothesameamountof physicalmemoryinstalledonthehost.Thereisanadditionalquantityofphysicalmemorythatisused upwitheachvirtualmachinepoweredoninthehypervisor,andtheamountofoverheadisdetermined bythevirtualresourcesthathavebeenallocatedtotheVM(seefigure2).Largeramountsofvirtual RAMandadditionalvCPUsincreasetheoverheadmemoryamountonthehost(seefigure3).

Figure2TheImpactstoAvailableMemoryforanApplicationfromVMandGuestOverhead

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

Figure3VMOverheadTable
SOURCE:FROMVMWARE.COM (HTTP://PUBS .VMWARE.COM/VSP40_I/WWHELP/WWHIMPL/COMMON/HTML/WWHELP .HTM#HREF=RESMGMT/R_OVERHEAD_MEMORY_ON_ VIRTUAL _ MACHINES . HTML #1_7_9_9_10_1& SINGLE = TRU )

Virtualizationadministratorscanthinkofmemoryasa"timeshare"whereitisprovidedtoeachvirtual machine,asneeded,andfreedupwhenavailabletobeusedbyanothervirtualmachine,alsoas needed. VMwareemploysavarietyoffeaturesthatmakememoryovercommitmentpossible.Withoutsuch featureslikememoryballooning,transparentpagesharing(TPS),andcompression,anESX/ESXiserver wouldsimplyrunoutofmemoryandcrash. MemoryBallooning WhenanadministratorinstallsVMwareTools,thememctldriver(a.k.a.ballooningdriver)isinstalledin theguestOS.ThisdrivercreatesabubbleorballoonofmemoryconsumedinsidetheguestsotheOS seesitasbeingusedbyanapplication.ThehypervisorthentakesthephysicalRAMfreedupbyinflating thisballoonandallocatesittootherVMsthatrequireit. Memoryballooningintroducesasmallamountofprocessingoverhead,andifitforcesaguestOSto beginpagingtodisk,thiscansignificantlyslowdowntheapplication(s)ontheVM.IftheVMisntusing thememory,thenballooningitselfisntaseriousperformanceissue,butitisanindicationthatphysical memoryonthehostisbecomingscarce. Oneofthebiggestadvantagesofmemoryballooningoverothermethodsforhandlingmemoryover commitmentisthatthememoryballooningdriverallowstheguestoperatingsystemtochoosewhich pagesarerelinquishedtothehypervisorforotherVMs.Thisway,pageswhicharentinactiveusecan besafelyfreedup,causingalmostnoperformanceimpactfromtheguestsperspective.

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

TransparentPageSharing Transparentpagesharingisthededuplicationofmemorythatpermitsidenticalvirtualmemorypages tobecollapsedintoasinglepagewithinthehostsphysicalRAM,therebyfreeingupmemoryforother uses.Forexample,ifmultiplevirtualmachinesonahostareallrunningthesameoperatingsystemand application,thehypervisorwillcomparepagesofmemorythroughhashingtolocateidenticalpagesthat canbefreedupthroughtheirconsolidation.Ballooningandtransparentpagesharingworktogetherto ensurethatovercommittedmemorydoesn'tcauseperformanceissuesfortheapplicationsintheguest virtualmachines. MemoryCompression MemorycompressionanddiskswappingbythehypervisorarethelastditcheffortsbyESX/ESXitokeep thehypervisorfromcrashingwhenmemoryresourcesonthehostarestretchedtothebreakingpoint. Thecompressionofmemorypagesbythehypervisoralsocausesadditionalprocessingoverhead; however,thisoverheadissmallincomparisontotheslowdowncausedbyswappingpagesouttoa storagedevice.UsersofvSphere4.1andabovewillbeabletotakeadvantageofthisfeaturetoreduce theamountofswappingtakingplacewhenphysicalmemoryresourcesareclosetobeingexhausted.

VMwarePerformanceMetricstouseforVMMemoryUsageAnalysis
VirtualizationadministratorsshouldtakethetimetobecomefamiliarwithcriticalvSpherecountersthat areusedtoanalyzememoryperformance.ThesecounterscanhelppreventVMmemoryperformance issues,aswellashelpresolvethemwhentheyoccur. ThetwomostcommonlyusedvSpherememorymetricsarememoryactiveandmemoryconsumed. Normally,whenviewingmemoryusageonaVMwithintheVIclient,thememoryactivemetricis displayed(seeFigures4and5).Thememoryconsumedmetricisdisplayedbydefaultatthehostlevel. AverageMemoryActiveinKB(memory.active.average)Thisistheamountofmemorythat theguestVMisactivelyusing,andisestimatedbasedonrecentlytouchedpages(thesmallest ofactive,consumed,andgranted).Monitorthismetricforahighmemoryactivethresholdthat isapproachingtotalmemorycapacityonthehost.Thismetricdoesntshowthefullfootprint ofaVMinmemory,soitcantbeusedreliablyfordeterminingaVMsminimummemory requirements.However,itdoesgivevisibilityintohowmuchmemorypagingactivityistaking place,andsocanbeusedtojudgewhethertheapplicationsonaVMareengagedoridle. AverageMemoryConsumedinKB(memory.consumed.average)Thisistheamountofguest physicalmemoryconsumedbythevirtualmachineforguestmemory,andiscalculatedasthe amountofmemorygranted(configuredfortheVM)lesstheamountofmemorysavedby memorysharingtechniques.Thismetrichasclassicallybeenthebetterchoicefordetermining whatavirtualmachinestotalmemoryrequirementsare;however,thereareadditional complexitiesthatcanmakeitlesshelpfulonmoderninstallations.Factorssuchaslarge memorypages,transparentpagesharing,andcachingactivitywithintheguestcancausethis metrictobecomelessinformative.

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

Figure4AMemoryUtilizationChartfromwithinVMwarevCenter

Figure5vSphereCountersforMeasuringMemoryPerformance WhilememoryactiveandmemoryconsumedaretypicallythetwomosttellingVMmemorymetrics, therearemanymorethatcanbeusedtolearnaboutmemoryconsumption,allocation,andsharing. MoreinformationonVMwarememorymetricscanbefoundhere: http://www.vmware.com/support/developer/vc sdk/visdk400pubs/ReferenceGuide/memory_counters.html

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

Forexample,whenahostorvirtualmachineisswappingouttodisk,thisisanimmediateindicatorofa memoryproblem.StatisticslikeAverageMemorySwappedinKB(memory.swapped.average)and AverageMemoryReclaimedbyBallooning(mem.vmmemctl.average)showthataVMishavingtoswap oremployballooningtogetthememorythatisneeded. EvenwhenavirtualmachineguestOSisnolongerconnectedtophysicalhardware,itcanstillbeuseful introubleshootingperformanceproblems.Theguestcandeterminewhatapplicationsarerunningand howmuchmemorythoseapplicationsareusing.Ifthoseapplicationsarebusinesscriticalandneed morememory,theVMmemoryshouldberesized.Also,itisessentialtohaveVMwareToolsinstalledso thatthehosthastheabilitytoemployballooningifthereisanymemorycontention. Knowingwhichmetricstoevaluateisnotenoughtodetermineadequatememorysizing.Topreventand solvevSpherememoryperformanceissues,itisimportanttonotethethresholdsforthosemetrics, whichwhencrossed,areindicativeofVMperformanceissues.Herearefoursuchthresholdsthatare importanttoknow: Highhostmemoryconsumption>80%(memory.active.average) HighVMmemoryconsumption>7590%(insidetheguestOS) HostorVMSwapping(onthehost,memory.swapped.average)>0 VMBallooning(mem.vmmemctl.average)>0 Anotherfactortoconsideristheuseoflargememorypages.Largememorypagesincreasethe performanceofmemorytranslationsforapplicationsthatuselargeamountsofmemory.Largememory pagesareenabledbydefaultinESX/ESXi,butmustalsobeenabledintheguestoperatingsystem.For moreinformationontheperformanceoflargepageswithvSphere,consultVMwaresLargePage PerformanceStudy.FormoreinformationonvSphereMemoryResourceManagementseeVMware: UnderstandingMemoryResourceManagementinVMwareESXServer.

DeterminingifaVMhasMemoryrelatedPerformanceProblems
IfaVMisalreadyexperiencingaperformanceproblemrelatedtomemory,thentheavailableRAMis insufficientwhetherduetovirtualmemoryassignedtotheVMorthephysicalmemoryinstalledonthe host.Indicatorsofanimpendinghostorclusterwidememoryshortageincludewhenactivememory approachestotalmemoryand/orwhenswappingisoccurringfrequently.Ifhostmemoryistheproblem, eitherthereisnotenoughorthedistributedresourcescheduler(DRS)isnotbeingusedproperlyto balancethememoryloadacrossotherhosts. Inadditiontothephysicalhostmemoryshortagethatmanysystemadministratorsarefamiliarwithona traditionalserver(notusingvirtualization),thereareotherwaysthatmemoryshortagescanoccurina virtualizedenvironment. VMmemoryshortagescanoccurifresourcecontrolsareconfiguredincorrectly(perhapsareservation orlimithasbeensetinadequately)ortoomanymemoryintensivevirtualmachineshavebeendeployed

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

onasingleserver.Toidentifyavirtualmachinememoryshortage,administratorsshouldanalyze memoryresourcesettings(reservationsandlimits,whicharecoveredbelow),aswellasoverallVM memorydemands. AnotherpossibilityisthatVMshavebeengrosslyovercommittedandmemoryoverheadassociated withthoseovercommitmentsisconsumingtoomuchmemoryresources.Theamountofmemorybeing usedformanagingmemory,perESX/ESXihost,isavailablebymonitoringthemem.overhead.average counter. Finally,applicationlevelmemoryshortagescanoccurinsidetheguestOSifthereisamemoryleakinan applicationortherearesimplytoomanyapplicationsdemandingmemoryfortheamountofvirtual memoryallocated.Toidentifyanapplicationlevelmemoryshortage,administratorscanlookinsidethe guestOS,justastheywouldonatraditionalphysicalserver,startingwithWindowsTaskManager.

AdditionalFactorstoKeepinMindwhenSizingVMMemory
MemoryHogApplications
Certainapplicationsaredesignedtobe"memoryhogs".No,thisisnotareferencetomalicious applications.Instead,thereferenceistoapplicationsthatmaybequitefamiliartomostdatacenters, suchasanExchangeServer,OracleDB,oraSQLdatabase.Theseapplications(andothers)aredesigned toreserve(cache)allavailablememorywhentheystart.Whilethisworksfinewhentheapplicationis runningonaphysicalserver,itisthemostinefficientwaytomanagememorywhentheapplicationis runningasavirtualmachine.Checkwiththeapplicationvendortodeterminewhatthetruememory needsareforthedeploymentasaVM,andsupplementthatinformationwithalookatthememory activemetricwithintheVMtodeterminejusthowmuchofthememoryisbeingactivelyaccessed.

Limits
Byconfiguringalimitonavirtualmachine,acapisplacedonthemaximumamountofmemorythatthe VMcanuse.Withoutalimit,theallocatedmemoryisthelimitforthevirtualmachine.Limitsare enforcedbyVMwareToolsthroughmemoryballooning,whichkeepstheVMfromutilizingmemory abovethelimitsetting. VMmemorylimitsareoftenputinplacebyadministratorwhomaynothavefullyunderstoodthepoor performanceandwastedresourcesthatlimitscancreate.Whenlookingatmemoryutilization,these memorylimitsskewthememorymetricsandcancauseconfusionwhiletroubleshooting.Asgeneral practice,memorylimitsarenotrecommendedbyVMwareexceptinrarecasesofseriousphysical memorycontention.

Reservations
Memoryreservationssettheminimumamountofmemorythatavirtualmachine(orresourcepool)can access.EventhoughthatmemorymaynotbeneededbytheVMatalltimes,areservation,ineffect,

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

pullsthatmemoryawayfromallothervirtualmachinesthatmayneedit.Likelimits,reservationsare bettersetonresourcepoolsratherthanonindividualvirtualmachines,astheycanaffectthe performanceofothervirtualmachinesandskewmemorymetrics.

KnowinganApplicationsNeeds
Takingthetimetolookinsidethevirtualmachinetoanalyzethememorythatanapplicationusescan yieldagreatdealofinformationastothatVMsmemoryneeds.WhenevaluatingaWindowsoperating system,ResourceMonitorandPerformanceMonitorcanberuntoexposewhichprocessesusememory andhowmuchmemorytheyuse.Inaddition,consultingtheapplicationsbusinessownerhelps determineotherpertinentinformation,includingwhenthisapplicationisused,whousesit,whatwould happenifitwereunavailable,andhowtheuseoftheapplicationisgrowing. Bytakingtimetounderstandthesefactors,VMadministratorscandrawfurtherinsightsintoproperly sizingmemoryfortheVM,configuringresourcecontrols(ifneeded),andunderstandingthepriorityor relativeimportanceoftheapplicationcomparedtoothers.

InstitutingaVMMemorySizingProcess
Notonlyisavirtualenvironmentitselfdynamic,theusageoftheindividualapplicationsintheVMswill alsobeinaconstantstateofflux.AsaVMwareadministratorworkingonacriticalproductionvirtual infrastructurewithhundredsorthousandsofconstantlychangingvirtualmachines,theremustbea formalprocessformemorysizingotherthanjusta"ruleofthumb"ortrialanderror.Thisprocess, ideally,willinvolvetheapplicationadministratorsandwillbeundertakenbothwhenanewVMisbeing createdforanapplicationandonaperiodicbasis. Theworkflowdiagrambelowintroducesabestpracticeforhowtoexecutesuchaprocess.Whilethis processmayrequireslightmodificationincertainsituations,itwillworkasisformostVMware administrators.ThenextsectionsfollowtheinitialNopath(notanewlydeployedVM)intheprocess stepbystep,followedbycoverageoftheYespath.

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

Figure6TheVMMemorySizingWorkflow

DeterminingTimeFrameforAnalysis
ItisratherobviousthatmemorysizingforaVMmustbedonewhenthevirtualmachineisfirstcreated, butwhataboutatothertimesthroughoutitsuse?Wastingexpensiveserverresources,especially memory,onoversizedvirtualmachinesdecreasesROIandmayacceleratetheneedtopurchase additionalhardware.Ontheotherhand,slowperformingapplicationscausedbyundersizedVMswill leadtoendusercomplaintsandcanaffectabusinessbottomline.Additionally,applicationusagecan varydramaticallyoverthecourseofaday,weekormonth,makingitnecessarytoallocateforthepeak.

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

10

Frequentmemorysizingis,therefore,necessarybeyondanannualreview,orworse,leavingamemory allocationasisfromthetimeofaVMscreation! Herearethreetipsforperiodicmemorysizing: UseRecentDataMakesurethatthemostrecentmemorystatisticsarebeingused,aslast year's(orevenlastmonths)usagemaynolongerbevalid. ChooseaTimeFrameThatCapturesPeakUsageMakesurethattheVMmemory configurationvalueselectedcapturesthetimeofpeakusagethatwilloccurduringadesignated timeperiodforthatapplication.Forexample,useadayforavirusscannerthatperformsadaily scan,andamonthforanaccountingapplicationthatclosesthebookseverymonth. ControlforSeasonalityForsomeorganizations,suchasuniversitiesorretailers,seasonality mustbetakenintoaccountasdemandforresourceswillpeakduringstudentregistrationor duringtheholidayshoppingseason,respectively.

FindingthePeakValue
Thisisoneofthemostchallengingaspectsoftheanalysis.DeterminingaVMspeakmemoryusage cannotbereliablyaccomplished100%ofthetimeusingVMwaresmetricsalone.Thememoryactive metricisanestimatedvalue,andevenwhenmeasuredatapeak,onlyindicatesthelevelofpage activity.Itis,therefore,asignificantunderestimationofwhatavirtualmachinesmemoryneedsmay actuallybe.Thememoryconsumedmetric,bycontrast,couldpotentiallybemorehelpful,butinmost modernvirtualdeploymentsitoftenproducesthesamevalueasthememorygrantedmetric,resulting inlittleornohelpfulinsight.Whetherduetolargememorypagesskewingthesemetrics,oragreedy guestOSand/orapplication(s),memoryutilizationoftenrisestoabove95%nearlyallofthetime,and increasingaVMsmemoryallocationwillnotdecreasethepercentageutilization. Sowhatpeakvaluedoesavirtualizationadministratorchoose?ThisisanongoingissueforVM administratorseverywhere,andtheanswerisneverthesameinallcases.LookinginsidetheguestOS canpotentiallygivedeeperinsight,butonlyifindividualprocessesaremonitored,andonlyiftheOS deliversmetricsthatdistinguishbetweenwired,active,free,swap,etc.Sincepresentlythereisnoeasy waytodothiswiththemetricsavailableinvCenteralone,performingthisassessmentatscalecan becomequitechallenging.Untilmoremeaningfulmetricsareavailable,orVMwareToolsgaindeeper OSmemoryinformation,determiningthepeakmemoryusageperVMwilllikelycontinuetobemoreof anartthanascience. Forthetimebeing,agoodpracticeistoexaminepeakmemoryconsumed.Ifthatvalueseems abnormallyhighandgrowsequallywiththeallocationofadditionalmemory,thencheckwithintheOS foranyactivediskswapping(independentlyofESXswapping).Ifnoneexists,thememoryconsumed metricisnotveryinformative,andOSlevelanalysiswillberequired.

ComparingthePeakUsageValuetoAllocatedMemory
Thetruepeakvalueobservedshouldthenbecomparedtothememoryconfiguredforthevirtual machine.Theprocessshouldtobe:

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

11

Takeapercentofthememoryusageatthepeakvs.allocated Iflessthan75%,thenchangeslikelyneedtobemade Ifgreaterthan75%,thenstartevaluatingapplicationgrowth

Forexample,iftheVMisconfiguredfor8GBand,basedonanalysis,thetypicalmemoryactiveforthat VMisaround4GB(eventakinglongtermpeaksintoaccount),then50%memoryutilizationofthe allocatedmemoryisthepeakvalue.Withthatratio,itislikelythatchangesneedtobemadetothe configuration.However,additionalanalysismaybeneededtodetermineexactlywhattheallocation shouldbeasdetailedinthestepsbelow.

ForecastingUsageChangesuntilNextMemoryVMAllocationReview
BeforedecidingtodownsizeaVM'smemoryconfiguration,itisimportanttoconsiderthefactthatthe memorydemandsoftheVM(and,morespecifically,itsapplication)couldincreasebetweennowand thenexttimethememorysizingprocessisconducted. Hastheapplicationownerbeencontacted?Wasanincreasingtrendinmemorydemandnotedbasedon historicalanalysis?Itisimportanttoensurethatsufficientmemoryisprovisionedforbothcurrentusage andestimatedusagegrowth,oraVMcouldfacememoryrelatedperformanceissues.

FactorinaBufferValue
Besidesfactoringinanexpectedgrowthrate,addingabufferisimportanttoensurethatthememory allocationissufficient.Whilehistoricalpeakshavelikelybeentakenintoaccount,itisstillagood practicetofactorinabuffertoensurethatthevirtualmachine'smemoryhassomeheadroomtoavoid problems.Forlesscriticalapplications,abuffermaynotbenecessary,andcanbeavoidedtopreserve morememoryformoreimportantapplications.Forthemorecriticalapplicationsthatdohavedynamic memoryrequirements,addinga25%additionalbufferontheamountofmemoryallocatedfortheVMis recommended.Thisway,intheeventthatanunexpected,businesscriticaldemandisplacedon memory,theadditionalmemoryisavailabletofulfillthatneed. ItisimportanttokeepinmindthatcertainVMwarefeatures,suchastransparentpagesharingand ballooning,helptooptimizememoryusagewithinapplicationsandclaimmemorywhenabsolutely necessary.Thus,thereissomeleewayindeterminingwhattheallocationshouldbetobalancebetween notwastingmemoryandnotunderprovisioningacriticalVM.

ChangetheVMSizingAllocationandDocumenttheChange
Nowthatthetimeframeforanalysishasbeendetermined,peakutilizationhasbeendeterminedand comparedtotheallocatedamount,andanestimateoffuturememoryusagehasbeenmade,itistime totakeaction:adjustorrightsizethevirtualmachine'smemorysizing. UnlessthecorrectguestOSisinstalledandmemoryhotaddisenabled(assumingthememory allocationneedstobeincreased),theguestOSmustbeshutdowntoaddorremovememoryfroma virtualmachine.

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

12

OncetheguestOSisshutdown,avirtualmachine'smemorycanberesizedbyrightclickingontheVM (inthehostsandclustersinventory)andclickingonProperties.Atthatpoint,thewindowbelowappears (seeFigure7)wherememorycanberesizedontheHardwaretab.

Figure7ConfiguringMemoryonavSphereVM OncetheVM'smemoryisresized,andtheVMispoweredbackon,thischangeshouldbedocumented (alwaysagoodpractice!).

SettingUpaRegularMemoryReviewBasedonanAppropriateTimeframe
Becauseapplicationusagechanges,memoryallocationsmustbecontinuouslyevaluatedtoensurethat performancewillnotbeimpactedduetoadditionalchangesinthedynamicvirtualizedinfrastructure.A regularmemoryreviewprocessshould,thereforebesetatappropriateintervals.Therecommendation hereisthatthisprocessoccuratleastoncepermonth;environmentsthataregrowingquicklymaywant todothismorefrequently.Oncearightsizingprocesshasbeenconductedafewtimesonthevirtual machinesinanyenvironment,thestepswillbecomemorefamiliarandadministratorscanthenbuildon thisexperiencetostreamlinetheprocess.

ProvisioningaNewVMforAppropriateMemoryAllocations
ThissectionbeginsthestepbystepcoverageoftheYespath(provisioninganewlydeployedVM)in thememorysizingworkflowinFigure6.Theremaynotbeanyhistoricalperformancedataforanew virtualmachine,unlesstheapplicationisverysimilartoanexistingVM.Forthisreason,thememory configurationmadeforanewVMislikelytobemuchlessaccurate,andtheVMwillneedtobe monitoredmuchmoreclosely.Still,followingthesizingprocedureoutlinedbelowwithfrequent monitoringimmediatelyaftertheVMiscreatedwillprovidethenecessaryinsightstosizethememory ofthatVMasaccuratelyaspossible.

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

13

InitiallyAllocatetheMinimumPossible
Inmanycases,therewillbesomeideaofwhatthememoryallocationforanewVMshouldbe.Perhaps othersimilarVMsexistintheenvironment,oranotheradministratorwhohasrunthatapplicationina virtualinfrastructurecanprovidelessonslearned.Evenifthisinformationisbothavailableand dependable,theprocessofmonitoringandreviewingdescribedbelowshouldstillbefollowed. WhencreatingabrandnewVMforanapplicationthathasnotbeenpreviouslydeployed,andthereis noindicationaboutwhatthememoryallocationshouldbe,vSpherewillmakeamemory recommendationwhentheVMiscreated,basedontheguestOSspecified.ThisisavailableinFigure7 above,whereitsays"MinimumrecommendedforthisguestOSis:512MB".Here,intheabsenceof informationtothecontrary,anadministratormayaswellaccepttakethedefaultmemoryconfiguration fortheguestOS. Whileitmaybetemptingtogowitha"gutfeel"orusethesameamountofRAMthatphysicalservers areconfiguredwith(e.g.justuse4GBor8GB),it'slikelythattheallocationmaybeoverallocatingthe amountofmemoryactuallyrequiredowingtothevSpherememoryconservationtechniquesmentioned above. HerearethreeadditionalreasonsforprovisioningnewVMswithasmallermemoryallocationinitially: ItistechnicallyeasiertoaddmemorythantotakeitawayWithcertainguestoperating systems,ifmemoryhotaddisenabled,RAMcanbehotadded(butthereisneveranoptionto "hotremoveRAM). TheOSandhypervisorwilloftenprovidedifferentmemoryusagedataTheOScanonly reportonitsusageofthememorythatthehypervisorisproviding.Thismeansthatthememory usagerateswilloftenbedifferentforthehypervisorandtheOS.Thesedifferencesmakeit difficulttopinpointexactlyhowmuchmemoryisneeded,however,andcancauseapplication ownerstobecomeoverlyconcernedthereareinsufficientresourcestomaintainperformance. Byslowlyaddingmemoryafterbeginningwithaminimalallocation,itwillbeeasiertoassess theimpactsofchangestoreachtheoptimalamount. Applicationownerconcerns,PartIIApplicationownersmaybecomeuneasyifmemoryis beingtakenawayfromanapplication,therebymakingitmoredifficulttoremovethememory, evenifthedatashowthattheallocationiscurrentlyoverprovisioned.

MonitorMemoryMetricsIntensely
OnceanewVMsmemoryhasbeenallocated,thatmemoryusageshouldbemonitoredintensely.Just howfrequentandindepththismonitoringshouldbedependsonthecriticalityoftheVM. AdministratorsmayalsowanttousevSpherealarmstoalertthemastoifandwhenanewVMis runninglowonmemory.Whenmonitoring,lookbothatthevSphereVMmemorylevelandinsidethe guestOStoseehowmuchmemoryisbeingutilized.IstheVMmaxingouttheminimumamountof memoryconfigured?Ifso,thenmorememoryisneeded.

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

14

AddMoreMemoryinSmallIncrements
IfthenewVMisrunninglowonmemory,morememoryshouldbeaddedinsmallincrements. Remember,memoryisnormallythemostconstrainedresourceaserverhas.AddingoneormoreGBof RAMonaVMmaybewastefulandunnecessary.Whenmorememoryisneeded,itisbettertouse incrementsof256MBor512MB.

AddtheNewVMtotheRegularMemorySizingReviewProcess
EverynewVMshouldbeincludedintheperiodicmemoryreviewprocess(discussedabove)afterthe memoryusagehasbeeninitiallystabilizedwithanappropriatememoryallocation.

Conclusion
Memoryistypicallythemostconstrainedcomputingresourceinavirtualizeddatacenter.Byleveraging theinformationpresentedinthiswhitepaperandimplementingtheworkflowdetailedabove, virtualizationadministratorscanmoreefficientlyusethisprecious(andcostly)computingresource. RightsizingmemoryallocationsmakesmorememoryavailableforotherVMs,resultinginincreasedVM densityanddeferredpurchasesofhardware.Additionally,regularmonitoringofmemoryusageenables VMadministratorstoproactivelydetectproblemareasinVMsthatareunderprovisionedtoavoid performanceissues.Ultimately,accuratelysizingmemoryinvirtualmachinesresultsinabetterreturn oninvestmentforanyvirtualizationinitiative,andapplicationownershavegreaterconfidenceinthe performancethatvirtualizationprovidestheirapplications.

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

15

AbouttheAuthor
DavidDavisistheauthorofthebestsellingVMwarevSpherevideotraininglibraryfrom Train Signal. He has written hundreds of virtualization articlesontheWeb,isavExpert,VCP,VCAPDCA,andCCIE #9369withmorethan18yearsofenterpriseITexperience. HispersonalWebsiteisVMwareVideos.com.

AbouttheSponsor
VKernelisthenumberoneproviderofperformanceandcapacitymanagementproductsfor virtualizeddatacentersandcloudenvironments.Thecompanysawardwinning,easyto useandpowerfulproductssimplifythecomplexandcriticaltasksofrealtimeVMware performancemonitoring,capacityplanning,resourceoptimization,reportingand chargebackforvirtualenvironments.Usedbyover50,000virtualizationadministrators, VKernelsproductshaveproventheirabilitytoimmediatelyidentifyandresolveVM performanceproblems,maximizecapacityutilization,andreducevirtualizationcosts.

2011 VKernel Corporation. All rights reserved.

http://www.vkernel.com

16

Вам также может понравиться