cloud native architecture patterns tutorial
TRANSCRIPT
CloudNativeArchitecturePatternsTutorial
2017O'ReillySoftwareArchitectureConference-NYCMattStine( )@mstine
http://www.mattstine.com
Introduction
YourInstructor
17yearsintheEnterpriseITindustry5yearsasaCloudPlatformandApplicationArchitectFrequentspeakerontheconferencecircuitHostoftheSoftwareArchitectureRadiopodcast
YourInstructor
http://www.oreilly.com/programming/free/migrating-cloud-native-application-architectures.csp
WorkshopComponentsLectureSocraticQ&ASessionsArchitectureKataSessions
AgendaClassIntroductionCloudNativeArchitectureFundamentals1:30-2:15PM
SocraticQ&ASession2:15-2:30PM
CloudNativeArchitecturePatterns2:30-3:30PM
SocraticQ&ASession3:30-3:45PM
AgendaCloudNativeArchitectureKatas-Setup3:45-4:00PM
CloudNativeArchitectureKatas-Create4:00-4:30PM
CloudNativeArchitectureKatas-Present4:30-5:00PM
TheBusinessDriversforArchitecturalChange
Agility
Disruption
Agility
-MarkAndressen
Softwareiseatingtheworld.
Agility
DisruptiveCharacteristicsSoftwareisprimaryengagementmodelNewandinnovativebusinessmodelsFastandfrequentdeliveriesHypothesis-drivendevelopment
Agility
TheWaterscrumfall
Agility
WaterscrumfallConsequences
SlowDeliveryLargeBatchSizesInfrequentFeedbackIncreasedWaste
Agility
DigitalTransformation
Resiliency
Disruptivecompaniesarealsoapproachingresiliency
differently.
Resiliency
Stoptryingtopreventmistakes.
Resiliency
Embracefailure.
Resiliency
FromMTBFtoMTTR
Resiliency
Weneedbettertoolsandtechniques.
Resiliency
Visibility
Resiliency
FaultIsolation
Resiliency
FaultTolerance
Resiliency
Scalability
Resiliency
AutomatedRecovery
AHigh-LevelOverviewofDevOpsandContinuous
Delivery
DevOps
THEGREATCONFLICT
DevOps
MyDefinition:DevOpsrepresentstheideaof
tearingdownorganizationalsilosandbuildingsharedtoolsets,
vocabularies,andcommunicationstructuresinserviceofaculture
focusedonasinglegoal:deliveringvaluerapidlyandsafely.
DevOps
THETHREEWAYS
DevOps
DevOps
TheFirstWay:Flow
DevOps
TheSecondWay:Feedback
DevOps
TheThirdWay:ContinualLearningand
Experimentation
ContinuousDelivery
MyDefinition:Technicallysupportingtheconcepttocashlifecyclebyprovingevery
sourcecodecommittobedeployabletoproductioninan
automatedfashion.
ContinuousDelivery
IngredientsConfigurationManagementContinuousIntegrationAutomatedTesting
ContinuousDelivery
CIDeveloperWorkflow
ContinuousDelivery
TheDeploymentPipeline
TheUniqueCharacteristicsofCloudInfrastructure
CloudInfrastructure
MyDefinition:Anycomputingenvironmentin
whichcomputing,networking,andstorageresourcescanbe
provisionedandreleasedelasticallyinanon-demand,self-service
manner.
CloudInfrastructure
DeploymentModelsPublicAmazonWebServicesGoogleCloudPlatformMicrosoftAzure
PrivateVMwarevSphereOpenStack
CommunityHybrid
CloudInfrastructure
ServiceModels
The*aaSPyramid
CloudInfrastructure
APIDrivenAutomationAuditAuthorizationAccounting
CloudInfrastructure
SpeedIfyouneedacomponent,createit!
LoadBalancersDatabases(SQL/NoSQL)MessageQueuesPrivateNetworksStorageVolumes
CloudInfrastructure
SpeedCaneliminate:
TicketSystemsApprovalProcessesWaitingQueuesConfigurationErrors
CloudInfrastructure
SpeedAsfastasyoucandesignthesystemarchitecturethatyouneed,youcanusuallyprovisionandbeginusingit.
CloudInfrastructure
ElasticGoodbyeCapacityPlanning!
CloudInfrastructure
ElasticCapacityPlanning
Peerintothecrystalball..."What'sthemostcapacitywe'llneed?"Guessincorrectly...BlowavailablecapacityonBlackFridayHundredsofidleCPUs
CloudInfrastructure
ElasticAsdemandincreases,wesimplyexpandcapacitybyprovisioningmoreresources
toservicethatdemand.
CloudInfrastructure
ElasticAsdemanddecreases,wesimplycontractcapacitybyreturningresourcestothe
pool.
CloudNativeArchitectureConcepts
ArchitectingforDevOps
Modularity
ArchitectingforDevOps
ThinkAbouttheThreeWays
Wewantaquantumofthisexperience.
ArchitectingforDevOps
DecompositionStrategiesWhat'syours?
BoundedContextsValueStreamsSingleResponsibilityPrincpleFailureDomainsAnti-CorruptionLayers
ArchitectingforDevOps
Strategiesarenotmutuallyexclusive!
ArchitectingforDevOps
SoWhatAboutModularity?LooseCouplingHighCohesionEncapsulationWell-DefinedInterface
ArchitectingforDevOps
GratuitousNodtoMicroservices!
ArchitectingforDevOps
Ifamicroserviceisn'tgivingyouThreeWaysValue,youprobablydon'tneedit.
ArchitectingforDevOps
Conway'sLawAnyorganizationthatdesignsasystem(definedbroadly)willproduceadesign
whosestructureisacopyoftheorganization'scommunicationstructure.
ArchitectingforDevOps
Ifyourarchitecturalandandorganizationaldecomposition
strategiesdon'talignwell,thenCONWAYWILLFIGHT
YOU!
ArchitectingforDevOps
Observability
ArchitectingforDevOps
ThinkAbouttheThreeWays
Weneedfeedbacktocreateasafersystemofworkandto(in)validateourhypotheses.
ArchitectingforDevOps
SeeFailureWhenItHappens
ArchitectingforDevOps
MeasureEverything
ArchitectingforDevOps
WhatisNormal?ValuesRatesofChangeMean?P95/99/99.9?
ArchitectingforDevOps
WhatisNormal?
http://bravenewgeek.com/everything-you-know-about-latency-is-wrong
ArchitectingforDevOps
ArchitectingforDevOps
ArchitectingforDevOps
ThisisanArchitecturalResponsibility
Architecturecanmakeobservabilityharder!OverheadConcernsToolsdon'tknowyourbusiness.
ArchitectingforContinuousDelivery
NOTE:ArchitectingforDevOpsaidsinContinuous
Delivery!
ArchitectingforContinuousDelivery
Addingsomelayers...
ArchitectingforContinuousDelivery
ThinkAboutFullLifecycleArchitecture
ArchitectingforContinuousDelivery
NealFord
Architectureisabstractuntilitisoperationalized.
ArchitectingforContinuousDelivery
Architecturesthataren'toperationalizedexistonlyon
whiteboards!
ArchitectingforContinuousDelivery
DeployabilityTestability
We'llexaminethesequalitiesbyaskingquestionsofourarchitectures.
ArchitectingforContinuousDelivery
Deployability
ArchitectingforContinuousDelivery
HaveyouautomatedALLofyourdeploymenttasks?
ArchitectingforContinuousDelivery
Canyoutransformabrandnewdeploymentenvironment
intoyourrunningarchitecturewithoutmanual
work?
ArchitectingforContinuousDelivery
Canyouvaryconfigurationacrossenvironmentswithout
rebuildingcode?
ArchitectingforContinuousDelivery
DoyoudeploylikethisEVERYWHERE?
ArchitectingforContinuousDelivery
Canyoudothiswithoutyourusersnoticing?
ArchitectingforContinuousDelivery
Testability
ArchitectingforContinuousDelivery
HaveyouautomatedALLtestingtasksthatyou
possiblycan?
ArchitectingforContinuousDelivery
Doyouhavetodeployallthethingstotestanything?
ArchitectingforContinuousDelivery
Iftestingisanexperiment,canyoucontroleverythingexceptyourexperimental
variable?
ArchitectingforContinuousDelivery
Canyourunthesametestsagainstanyenvironment(includingproduction)?
ArchitectingforContinuousDelivery
Canyouverifythatyoucontinuetomeetyour
contractualobligations?
ArchitectingforCloudInfrastructure
CloudCapabilitiesAPI-drivenSpeedElasticityGeographySpecializedServices
ArchitectingforCloudInfrastructure
ExploitingthecapabilitiesofCloudcanenhanceourability
topracticeDevOpsandContinuousDelivery!
ArchitectingforCloudInfrastructure
DisposabilityReplaceability
We'llexaminethesequalitiesbyaskingquestionsofourarchitectures.
ArchitectingforCloudInfrastructure
Disposableadjective
1. designedfororcapableofbeingthrownawayafterbeingusedorusedup:disposableplasticspoons;adisposablecigarettelighter.
2. freeforuse;available:Everydisposablevehiclewassent.
http://www.dictionary.com/browse/disposable
ArchitectingforCloudInfrastructure
Replaceverb
1. toassumetheformerrole,position,orfunctionof;substitutefor(apersonorthing):Electricityhasreplacedgasinlighting.
2. toprovideasubstituteorequivalentintheplaceof:toreplaceabrokendish.
http://www.dictionary.com/browse/replace
ArchitectingforCloudInfrastructure
Consequencenoun
1. anactorinstanceoffollowingsomethingasaneffect,result,oroutcome.
2. importanceorsignificance:amatterofnoconsequence.
http://www.dictionary.com/browse/consequence
ArchitectingforCloudInfrastructure
Disposability
CanIdestroyaserviceinstanceatanytimewithout
consequence?
ArchitectingforCloudInfrastructure
Disposability
CanIrepavetheentirearchitectureatanytimewithoutconsequence?
ArchitectingforCloudInfrastructure
Disposability
CanIrespondtochangesindemandbyaddingorremovinginstancesofa
servicewithoutconsequence?
ArchitectingforCloudInfrastructure
Replaceability
CanIreplaceasickserviceinstancewithabrandnew
copywithoutconsequence?
ArchitectingforCloudInfrastructure
Replaceability
CanIroutetraffictoanyavailableserviceinstance
withoutconsequence?
ArchitectingforCloudInfrastructure
Replaceability
IfIloseanAZorRegion,canIroutetraffictoanotherwithoutconsequence?
ArchitectingforCloudInfrastructure
Replaceability
CanIswapbetweenmultipleimplementationsofthesame
servicecontractwithoutconsequence?
ArchitectingforCloudInfrastructure
Replaceability
CanIswapbetweenmultiplerunningversionsofaservice
withoutconsequence?
ArchitectingforCloudInfrastructure
TheseareArchitecturalResponsibilities
Architecturecanmakedisposabilityimpossible.Architecturecanmakereplaceabilityimpossible.Architecturemusttakechargeofremovingtheconsequencesofdisposingandreplacingserviceinstances.
Summary
ArchitecturalDecisionMakingCan:
EnhanceorDetractfromOurAbilitytoPracticeDevOpsEnhanceorDetractfromOurAbilitytoPracticeContinuousDeliveryExploitorWastetheCharacteristicsofCloudInfrastructure
Summary
Wecouldhavecalledthis"DevOpsNative"or
"ContinuousDeliveryNative"Architecture!
Summary
DevOpsNativeArchitecture
Summary
Balancing:
AgilityandResilience
Summary
SupportedBy:
DevOpsandContinuousDelivery
Summary
OnaFoundationof:
CloudandArchitecture
SocraticQ&A
CloudNativeArchitecturePatterns
Overview
Pattern-OrientedSoftwareArchitecture,Volume1:ASystemofPatterns
Patternsshould...bedescribeduniformly.Thishelpsustocompareonepattern
withanother...
Overview
DesignPatterns:ElementsofReusableObject-OrientedSoftware
Wedescribedesignpatternsusingaconsistentformat...makingdesign
patternseasiertolearn,compare,anduse.
Overview
BrickandMortarPatternTemplateContextThebasicsituationinwhichwefindourselvesworking.
ProblemPresentstheproblemasasystemforceswhichmustbebalanced.
SolutionDescribesthecomponentsthatmakeupthegeneralsolution,howtheyrelatetooneanother,andtheirruntimeinteractions.
Overview
BrickandMortarLanguageStructureBrickPatternsPatternsforconstructingindividual(micro)services.
MortarPatternsPatternsforcomposingbricksintocompletedistributedsystems.
Overview
BrickPatternsExternalizationPatternsStructuralpatternsforcreatingdeployable,disposable,andreplaceablebricks.
ExternalizedConfigurationExternalizedStateExternalizedChannels
RuntimePatternsBehavioralpatternsforcreatingdeployable,replaceable,andobservablebricks.
RuntimeReconfigurationConcurrentExecutionBrickTelemetry
Overview
MortarPatternsDistributedSystemsPatternsCompositionpatternsaddressingcommondistributedsystemschallenges.
ServiceDiscoveryEdgeGatewayFaultTolerance
IntegrationPatternsCompositionpatternsaddressingintegrationandobservabilitychallenges.
Event-DrivenSystemContractManagementIntegrationTelemetry
Overview
BrickandMortarLanguageRelationships
BrickPatternsExternalizedConfigurationExternalizedStateBrickTelemetry
ExternalizedConfiguration
ContextandProblem
ContextAnapplication'sconfigurationwillvaryindependentlyfromitscodethroughout
itslifecycle.
ContextandProblem
ProblemTraditionaltechniquesformanagingconfigurationtightlycouplethesetwo
orthogonalconcepts.
ContextandProblem
ForcesDifferentenvironmentswillhavedifferentconfigurationsettings:resourcehandlestothedatabase(e.g.aJDBCURL)credentialstoexternalservices(e.g.AmazonS3)per-deployvaluessuchasthecanonicalhostname(e.g.blog-test.example.comvs.blog-prod.example.com)featuresthataretoggledonoroff
ContextandProblem
ForcesConfigurationisoftenbundledwithindeploymentartifacts(e.g.Javapropertiesfiles).Buildprocessesoftenmodifyconfigurationbasedonarguments.TheDeploymentPipelineshouldonlybuildeachdeploymentartifactonce,anddeploythesameartifacttomultipleenvironments.
LIVEARCHITECTURE!
ExternalizedState
ContextandProblem
ContextDisposabilityandReplaceabilityrequire
theeliminationof"snowflakedeployments"fromthearchitecture.
ContextandProblem
ProblemTraditionalstatemanagement
techniquespreventusfromachieving"phoenixdeployments."
ContextandProblem
ForcesEarlywebarchitecturesemphasizedserver-sidestatemanagement:FatClientstoThinClientsVerticallyScaledCacheManagementStatefulScaffoldingonStatelessProtocol(HTTP)
ContextandProblem
ForcesCloudInfrastructure:ResourceLimitedHorizontalScaleLimitedLoadBalancerSupportforSessionsLimited(No)SupportforPersistentLocalDisk
LIVEARCHITECTURE!
BrickTelemetry
ContextandProblem
ContextRealizingtheDevOpsWayofFeedbackrequiresthatwehavevisibilityintoboth
thebusinessvalueandtechnicalbehaviorgeneratedbyourservices.
ContextandProblem
ProblemCommonapproachestoservicevisibilityfallshortofthearchitecturalqualities
thatweneed.
ContextandProblem
ForcesVisibilityisoftenaccomplishedviapostfactoapplicationofagent-basedmonitoringtools.Agent-basedmonitoringtoolsdon'tunderstandbusinessvalue.Determininganapplication'shealthoftenrequirescomplexlogic.Traceabilityofanapplicationisdifficult(orimpossible)toaccomplishwithOTSsolutions.
LIVEARCHITECTURE!
MortarPatternsServiceDiscoveryEdgeGatewayFaultTolerance
ServiceDiscovery
ContextandProblem
ContextDecompositionofarchitectureintoservicesleadstoincreasinglymore
distributedsystems.
ContextandProblem
ProblemAssystemsbecomedistributed,andasserviceinstancelifecyclesbecomemoredynamicandindependent,locationofandcommunicationwithdependencies
becomesmorechallenging.
ContextandProblem
ForcesCloudplatformsoftenassignauto-generated,internalhostnamesorprivateIP'stoserviceinstances.Asservicesarescaledandunhealthyinstancesarereplaced,theaddressesofaservice'sinstancesareconstantlychanging.Bindingaservicetoanythingotherthanlogicalnamesforitsdependenciesleadstofrictioninthearchitecturallifecycle.
ContextandProblem
ForcesApplyingConcurrentExecutionismademoredifficult(orimpossible)whenbindingservicestofixedaddressesfortheirdependencies.Wemaywanttoremoveaserviceinstancefromtheavailablepoolbutkeepitrunningtotroubleshootaproblem.
LIVEARCHITECTURE!
EdgeGateway
ContextandProblem
ContextDecomposedarchitecturesmustalwaysberecomposed.Thisrecompositionoftenhappenswithintheuserinterfacelayerof
anapplication.
ContextandProblem
ProblemRecomposinganarchitecturewithintheUserInterfacelayerpresentssignificantcomplexitiesthatcanleadtodecreasedagilityanddegradeduserexperience.
ContextandProblem
ForcesSystemsoftenmustsupportmultipleuserexperienceoptions(web/mobile/AVR).RecomposingarchitecturesastheUIlayercanrequireexposingthearchitecturetothepublicnetwork.APIneedsforamobiledeviceareoftenquitedifferentfromawebUI.
ContextandProblem
ForcesExposinganetworkgraphtomobiledevicescanincreaselatency,increasedatausage,anddegradebatterylife.UIplatformsmaynotsupporttheintegrationarchitectureusedforallservices.Nativeappsoftenhavelongerupgradecycles.Recomposingthearchitecturetherecanleadtofrictioninthearchitecturallifecycle.
LIVEARCHITECTURE!
FaultTolerance
ContextandProblem
ContextInordertoaccomplishitsassignedtasks,eachbrickwillneedtocommunicatewithotherbricks,andwithexternalsystems,
towhichwe'llcollectivelyreferasdependencies.
ContextandProblem
ProblemWhenabrick'sdependenciesbecomeunhealthy,unreachable,orslowerthannormaltorespond,thatbrick'sownperformanceisdegraded,andsuchdegredationcanpotentiallycascade
acrosstheentirearchitecture.
ContextandProblem
ForcesThenetworkisnotreliable.Latencyisnon-zeroandunpredictable.Serviceavailabilityisaproductofitsdependencies'availabilities.
ContextandProblem
ForcesFailurescanbetransient.Failurescancascade.Anincorrectorstaleresponseisoftenpreferabletonoresponse.
LIVEARCHITECTURE!
SocraticQ&A
CloudNativeArchitectureKatas
Setup
WhatareArchitectureKatas?Takemetotherules!
ToCloudNativeAddthefollowingtoyourrequirements:
Day1asacompanywe'reagreeingtoguideourselvesbyDevOpsprinciplesandpracticeContinuousDelivery.Wehavenoinfrastructure;we'lluseoneormorepubliccloudproviderstodeliveroursoftware.Thinkdeeplyaboutyourdecompositionstrategyandwhatadvantagesitwillbringyou.UsetheCNAPatternsyouknowsofarinordertoenableyourarchitecturestotheseends.
KataChoiceshttp://bit.ly/cna-kata-choices