65
MESOS AND THE STATE OF APPLICATION DEPLOYS

Mesos and the State of Application Deploys

Embed Size (px)

Citation preview

Page 1: Mesos and the State of Application Deploys

MESOSANDTHESTATEOFAPPLICATION

DEPLOYS

Page 2: Mesos and the State of Application Deploys

WHOAMI?KoryBrown.DevOpsEngineerFromTexas.SiteOperationsEngineeratFitbit.

Page 3: Mesos and the State of Application Deploys

WHATISTHISTALKABOUT?

Page 4: Mesos and the State of Application Deploys

MESOS!

Page 5: Mesos and the State of Application Deploys

APPLICATIONDEPLOYMENTS!

Page 6: Mesos and the State of Application Deploys

MORESPECIFICALLYHowwe,asanindustry,usedtohandleapplicationdeployments.Howwe,asanindustry,currentlyhandleapplicationdeployments.HowIthinkwe'llhandleapplicationdeploymentsinthefuture.

Page 7: Mesos and the State of Application Deploys

WAIT,WHATABOUTMESOS?We'llgetthere.

Page 8: Mesos and the State of Application Deploys

ButtounderstandtheproblemsMesossolvesfordeployswemustfirst:

Understandwhatwedotoday.Understandhowwegothere.

Mesos,inthiscase,isanimplementationdetail.

Page 9: Mesos and the State of Application Deploys

WHYSHOULDYOUCARE?It'ssuperfreakingcoolAndyouknow...DevOps

Page 10: Mesos and the State of Application Deploys

WHATISDEVOPS?ThisisnotatalkonDevOps......butit'simportantforustohaveacommondefinition.

Page 11: Mesos and the State of Application Deploys

"DevOpsisaboutrecognizingthatthebackinginfrastructureisnotseparatefromyourapplication,butratheravitalpartof

it."--Me

Page 12: Mesos and the State of Application Deploys

HOWTHINGSUSEDTOBE

Page 13: Mesos and the State of Application Deploys

YOUWANTTODEPLOY1. GetaServer.

Page 14: Mesos and the State of Application Deploys

GETASERVERPutinarequest.Ahumanallocatesaserver.Ahumaninstallsanoperatingsystem.Ahumanensuresthenetworkingiscorrect.Ahumaninstallsallspecifieddependencies.etc,etc,etc

Page 15: Mesos and the State of Application Deploys

YOUWANTTODEPLOY1. GetaServer.2. Deployyourapplication.

Page 16: Mesos and the State of Application Deploys

DEPLOYYOURAPPLICATIONAnOpsguylogsintotheserver.

Downloadsyourapplication.Installsyourapplication.Configuresyourapplication.

Page 17: Mesos and the State of Application Deploys

DEPLOYYOURAPPLICATIONTheapplicationdoesn'tstart.

Theycallyou(probablyinthemiddleofthenight).Afteranhouroftroubleshooting,yourealizetheytypoedtheconfig.Youhateeverything.

Page 18: Mesos and the State of Application Deploys

YOUWANTTODEPLOY1. GetaServer.2. Deployyourapplication.3. Repeatntimesforscale.

Eachtimeslightlydifferently

Page 19: Mesos and the State of Application Deploys

SOMETHINGGOESWRONG(Hardwarefailure/OSissues/Maintenance/etc)

GodHelpYou.

Page 20: Mesos and the State of Application Deploys

SOMETHINGGOESWRONG(Hardwarefailure/OSissues/Maintenence/etc)

Fileaticket.Datacentertechfindsthemachine.Theypulltheharddrive.

Whichisweird,becauseIsaidtheRAMtestedbad.Twoweekslaterthemachineislostinaseaoftickets.Everythingisterrible.

Page 21: Mesos and the State of Application Deploys

THISSUCKEDNotuncommontomeasureturnaroundinweeks.Littletonoautomation.Incrediblyerrorprone.Requiresapersonatmosteverystep.Generallyleadstofinelycraftedartisanalmachines.

TL;DR:

Horrificallyinefficient,errorprone,andtimeconsuming.

Page 22: Mesos and the State of Application Deploys

HOWTHINGSARETODAY

Page 23: Mesos and the State of Application Deploys

YOUWANTTODEPLOY1. Spinupanewcloudinstance.2. Runyourautomationtoolofchoice

(Puppet/Ansible/Chef/etc).3. Repeatntimes.

Page 24: Mesos and the State of Application Deploys

SOMETHINGGOESWRONG(Hardwarefailure/OSissues/Maintenance/etc)

Spinupanewinstance!

Turnaroundtimesaresolow,whocares?

Birthofthe"TreatserverslikeCattle,notpets"thoughtprocess.

Page 25: Mesos and the State of Application Deploys

SUCKSWAYLESSTurnaroundmeasuredinminutes.Almostentirelyautomated.Fairlydeterministic.Doesn'thavetoinvolvepeopleatall!

Page 26: Mesos and the State of Application Deploys

BUTNOTPERFECTStillmanageanentireOSforeachapplication.Thisincludes:

Updates!(BothOSandanyapplications/libraries)Backups!Monitoring/Metrics!etc,etc,etc

Page 27: Mesos and the State of Application Deploys

BUTNOTPERFECTNotfullyutilizingtheavailablehardware.

Unlessyourapplicationrunsconstantlyat100%CPUandRAM,youarewastingcyclesandmoney!

Page 28: Mesos and the State of Application Deploys

BUTNOTPERFECTTL;DR:

Good,butnotgreatpastacertainscale.

Page 29: Mesos and the State of Application Deploys

ENTERMESOS

Page 30: Mesos and the State of Application Deploys

WHATISMESOS?Opensourcedistributedclustermanagementtool.

Page 31: Mesos and the State of Application Deploys

WHATISMESOS?Anabstractionlayerforcomputingresources(CPU/RAM/Disk/etc)containedwithinapoolofservers.

Page 32: Mesos and the State of Application Deploys

MESOSISADISTRIBUTEDKERNEL

AtraditionalKernel(likeLinux!)providesasetofAPIsforinteractingwithavailablehardwareonalocalmachine.

AdistributedKernel(likeMesos!)providesasetofAPIsforinteractingwithavailablehardwareonapoolofservers.

Page 33: Mesos and the State of Application Deploys

THEDATACENTEROSTheKernelitselfisasmallpartofanOperatingSystem.Manyothercomponentsthatmakeitsomethinguseful.Mostrelevantforusrightnow:

Initsystem--Someprocesstomanagethelifecycleofotherprocesses.Cron--Someprocesstoruntasksonsomespecifiedinterval

Mesosimplementsthisfunctionalitywith"Frameworks".

Page 34: Mesos and the State of Application Deploys

WHAT'SAFRAMEWORK?AMesos"Application".Mustcontain2components:

Ascheduler,whichregisterswiththeMaster,andreceivesresourceoffers.OneormoreExecutors,whichlaunchestasksonslaves.

Page 35: Mesos and the State of Application Deploys

MESOSFRAMEWORKSInitSystem:

MarathonAurora

Cron:

ChronosAurora

Page 36: Mesos and the State of Application Deploys

AQUICKASIDEONFRAMEWORKSTheFrameworkslistedarejustonesthatarerelevantinthe

contextofapplicationdeploys.

Page 37: Mesos and the State of Application Deploys

AQUICKASIDEONFRAMEWORKSMesosismeanttobeusedasagenericcomputingclustermanager,whichmeansyoucanalsouse,asaframework:

JenkinsHadoopSparkStormKafkaManymorethingsprobably!

Perhapsmoreimportantly,alloftheseframeworkscansharethesameclusterofmachines!

Page 38: Mesos and the State of Application Deploys

MESOSOFFERSAlistofanagentnode'savailableresources(CPU/RAM/Disk/etc).Two-TierSchedulingSystem.

AgentNodesendsresourcestoMasternode.Masternodeusesanalgorithmcalled"DominantResourceFairness"tofairlypassthatresourceoffertoit'sregisteredFrameworks.

Page 39: Mesos and the State of Application Deploys

OTHERMESOSRELATEDWORDS

MasterService:RunsonamachinethathasbeendesignatedasaMesosMaster.Managesagents.

Agent:Runstasksthatbelongtoframeworks.

PreviouslyreferredtoasaSlave,butthisisbeingchangedinnewerversions.

Task:AunitofworkscheduledbytheFramework,andexecutedontheAgent.

ZooKeeper:Distributedconsensusframework.

Masterusesforleaderelection.Frameworksusetosharestate.

Page 40: Mesos and the State of Application Deploys

MESOSARCHITECTURE

Page 41: Mesos and the State of Application Deploys

Quorumofmasters,keptinsyncbyZooKeeper.

Page 42: Mesos and the State of Application Deploys

Slavessendresourceofferstotheelectedmaster.

Page 43: Mesos and the State of Application Deploys

Mastersofferthoseresourcestoit'sregisteredframeworks.

Page 44: Mesos and the State of Application Deploys

Iftheofferisaccepted,frameworksexecutetasksonslaves.

Page 45: Mesos and the State of Application Deploys
Page 46: Mesos and the State of Application Deploys

SHOULDMYAPPRUNONMESOS?

Page 47: Mesos and the State of Application Deploys

STATELESSAPPLICATIONWebApp(Rails,Django,Play,etc)JenkinsBuildSlavesMemcachedAny12factor-ishapplication

Yes

Page 48: Mesos and the State of Application Deploys

STATEFULAPPLICATIONSMySQLPostgresSQLJenkinsMaster

No

Page 49: Mesos and the State of Application Deploys

DOESITADDRESSCURRENTPROBLEMS?ManagingfewerOperatingSystems.Betterutilization.

Page 50: Mesos and the State of Application Deploys

MANAGINGFEWEROPERATINGSYSTEMS

ManageanOSforeachphysicalhost,NOTeachapplication.

Page 51: Mesos and the State of Application Deploys

BETTERUTILIZATIONInsteadofoneapplicationrunningperhost...

...webinpackthemalltogether!

Anyresourcesyourapplicationisn'tusingcanbesharedasneeded!

Page 52: Mesos and the State of Application Deploys

BONUS:REDUNDANCYBAKEDIN!Sincewehavethisbigpoolofsharedresources,ifan

instanceorhostdies,wejustrescheduleitsomewhereelse.

Page 53: Mesos and the State of Application Deploys

STATICALLYPROVISIONEDCLUSTER

Page 54: Mesos and the State of Application Deploys

STATICALLYPROVISIONEDCLUSTER

Railsappnowat1/3rdcapacity!

Page 55: Mesos and the State of Application Deploys

DYNAMICALLYPROVISIONEDCLUSTER

Page 56: Mesos and the State of Application Deploys

DYNAMICALLYPROVISIONEDCLUSTER

Twonodesdown!

Whocares?

Page 57: Mesos and the State of Application Deploys

DEPLOYINGWITHMESOS

Page 58: Mesos and the State of Application Deploys

YOUWANTTODEPLOY1. WriteaJobConfigforyourFrameworkofChoice.

WeuseAurora--it'sprettysweet.2. TellAuroratorunit.

Page 59: Mesos and the State of Application Deploys

SOMETHINGGOESWRONG(Hardwarefailure/OSissues/Maintenance/etc)

Aurorareschedulesyourapplicationtoanothernode.

Page 60: Mesos and the State of Application Deploys

HARDLYSUCKSATALL!Turnaroundmeasuredinseconds!Entirelyautomated!Deterministic!FaultTolerant!

Page 61: Mesos and the State of Application Deploys

DEVELOPERPERSPECTIVE

Page 62: Mesos and the State of Application Deploys

TESTINGMesoscanbeyourdev,qa,staging,andproductionenvironments.

Aurorasplitspermissionsandallocationsbetweenconfiguredenvironments.Prioritizesproduction.Meaningitwillpreemptjobsrunningin"lesser"environments.

BecomeseasytotestinaProdlikeenvironmentbecauseitISthesameenvironment!

Page 63: Mesos and the State of Application Deploys

SELF-MANAGEMENTNomorewaitingonOpsforhardware!Easilyautomate-able!

WantHerokustyleddeploys?ThisishowHerokudoesit.

Page 64: Mesos and the State of Application Deploys

TL;DRWe'vecomealonglongway.Thing'ssuckwaylessnow.Suckinglessandlesseveryday.

Page 65: Mesos and the State of Application Deploys

QUESTIONS?