Upload
wso2-inc
View
396
Download
4
Embed Size (px)
Citation preview
Prof.Dr.Dr.h.c.FrankLeymannInstitute ofArchitecture ofApplication Systems
Universitätsstr. 3870569 StuttgartGermany
Phone +49-711-685 88 470Fax +49-711-685 88472e-mail Leymann@
iaas.uni-stuttgart.de
AttheHeartofServices:LooseCouplingandItsArchitecturalBenefits
(WSO2ConnAsia– Colombo,SriLanka– February17th,2016
©FrankLeymann
Agenda
2
LooseCouplingMessagingWS*RESTArchitectural ImplicationsMicroservicesConclusion
©FrankLeymann
Agenda
3
LooseCouplingMessagingWS*RESTArchitectural ImplicationsMicroservicesConclusion
©FrankLeymann
IntegrationProblem:TheOrigin
5
E01-EDI
Data Warehouse(Interfaces to and from theData Warehouse are not
displayed on this diagram)
G02 - GeneralLedger
A05 - AP
S01 - SalesCorrections
I01 POReceiving
I03 Return toVendor
I06 WarehouseManagement
MaininframePC/NT apps Unix apps
3rd Party Interface
S06 - Credit App
P15 EES EmployeeChange Notice
O THER APPS - PCAP - Col l ect i ons/ Credi t
TM - Credi t Card DB
ACCTS REC APPS - PC990CO RBad Debt
Benef i ci al FeesBenef i ci al Reconci l e
JEAXFJEBFAJEBKA
JEDVAJESO AJEVSAJEVSFNSF
Tel eCredi t Fees
I NVENTO RY CO NTRO L APPS - PCCode Al arm
Debi t Recei vi ngsDevo Sal es
Di spl ay I nvent oryI n Home
Junkout sM erchandi se Wi t hdraw al
Promo Credi t sRTV Accrual
Shri nkAP Research - I nv Cnt r lAP Research- Addl Rpt s
Book t o Perpet ual I nvent oryCl ose O ut Report i ng
Comput er I nt el l i gence Dat aCount Correct i ons
Cross Ref f or VCB Dnl dsDamage Wri t e O f f
Debi t Recei vi ngsDFI Vendor Dat abase
Di spl ay I nvent ory Reconci l eDi spl ay I nvent ory Report i ng
I NVENTO RY CO NTRO L APPS - PCDPI / CPI
I C Bat chi ngI nvent ory Adj / Count CorrectI nvent ory Cont rol Report s
I nvent ory Level sI nvent ory Rol l
M erchandi se Wi t hdraw alO pen Recei vi ngsPI Count Resul t s
PI Ti me Resul t s f rom I nvPri ce Prot ect i on
Sal es Fl ash Report i ngShri nk Report i ng
SKU G ross M argi nSKU Shri nk Level Det ai l
USMVCB Dow nl oads
Journal Entry Tool Kit
Scorecard - HR
L02-ResourceScheduling(Campbell)
P09 - P17Cyborg
M02 - Millennium
M03 - Millennium 3.0
Banks - ACH and Pos toPay
Cobra
B01 - StockStatus
S03-Polling
P14 On-line NewHire Entry
CTS
Plan Administrators(401K, PCS, Life ,
Unicare, SolomonSmith Barney)
D01 Post LoadBilling
I04 HomeDeliveries
I02 -Transfers
Arthur Planning
I07 PurchaseOrder
I12 EntertainmentSoftware
I05Inventory Info
E13E3 Interface
S04 - Sales Posting
V01-Price ManagementSystem
I10 Cycle PhysicalInventory
I55 SKUInformation
K02Customer Repair
Tracking I35 Early WarningSystem
B02 MerchandiseAnalysis
I13- AutoReplenishment
U18 - CTO
Intercept
I09 Cycle Counts
E02-EmployeePurchase
Texlon 3.5
ACH
Stock Options
I17 Customer PerceivedIn-Stock
U16-Texlon
SiteSeer
C02 - CapitalProjects
F06 - FixedAssets
US Bank ReconFile
Star Repair
EDICoordinator
M esa Dat a
NEW SoundscanNPD G roup
AI G Warrant y G uard
Resumix
Optika
Store BudgetReporting
P16 - Tally Sheet
Cash Receipts/Credit
S05 - HouseCharges
Ad Expense
L01-PromoAnalysis
V02-PriceMarketing
Support
BMP - Busperformance Mngt
StoreScorecard
I11 PriceTesting
Valley Media
P09Bonus/HR
I15 Hand ScanApps
Roadshow
POS
S08 - VertexSales
Tax
A04 - CustRefund Chks
Equifax
ICMS Credit
CellularRollover
S09 - DigitalSatelliteSystem
NPD,SoundScan
Sterling VANMailbox (Value)
I18SKU Rep
X92-X96Host to AS400
Communication
S02 -Layaways
Washington,RGIS,
Ntl Bus Systems
V04-SignSystem
I14 Count CorrectionsNARM
P01-EmployeeMasterfile
I06 - CustomerOrder
FrickCo
UAR - Universal AccountReconciliation
DepositoryBanks
S07 - CellPhones
S11 - ISPTracking
AAS
Fringe PO
Cash Over/Short
L60 MDFCoop SKU Selection
Tool
SKUPerformance
SupplierCompliance
1
I35 - CEIASIS
Misc Accounting/Finance Apps - PC/NTCOBA (Corp office Budget Assistant)
PCBS(Profit Center Budget System)Merchandising Budget
AIMSMerch Mngr Approval
Batch ForecastingAd Measurement
AIMS Admin
AIMSReportingAd
Launcher
V03- MktReactions
SpecSource
CTO2.Bestbuy.com
RebateTransfer
SignSystem
CopyWriter'sWorkspace
ELTPowerSuite
StoreMonitor
AIS Calendar
Stores & Mrkts
Due Dates
Smart Plus
InsertionsOrders
BudgetAnalysis Tool
Print CostingInvoice App
AIS Reports
BroadcastFilter
Smart PlusLauncher
GeneralMaintenance
Printer PO
PrinterMaintenance
VendorMaintenance
Vendor Setup
Connect 3
Connect 3Reports
Connect 3PDF Transfer
Spec SourceSKU Tracking
S20-SalesPolling
Prodigy
PSP
In-HomeRepair
WarrantyBilling
System
Process Servers(Imaging)
Prepared by M i chel l e M i l ls
ApplicationArchitectureofarealcompanyJ
©FrankLeymann
TightCoupling:LocalMethodCall
Lotofassumptionsbetweencalledandcallingmethod
n Bothmethodsruninsameaddressspacen Bothmethodswritteninsamelanguagen Callingmethodhastopassexpectednumberof
parameters inexpecteddatatypesn Callisimmediate(i.e.synchronous)
6
©FrankLeymann
RPC(RemoteProcedureCall)
n AttempttomakeremotecommunicationviaRPCbehavelikelocalcall
n Upside:n Semanticsfamiliartodevelopers
n Downside:n Remote(!)communicationinvalidatesmanyassumptions
localcallsarebasedonn Thus:RPCsimplydoesnot havesemanticsofalocalcall!
7
©FrankLeymann
RPC≠LocalCall (1/2)
n Calledmethodmightnotbeavailable(networkfragmentation,serveroutage,...)� TimeDependencyn Howlongshouldcallerwait?
n Remotemethodoftencontrolledbyadifferentparty(businesspartner,...)� FormatDependencyn Whatifsignatureofcalledmethodchanges?
n Rewritecodeofcallingapplication!L
8
©FrankLeymann
RPC≠LocalCall (2/2)
n Callingfunctionoftenexplicitlypointstoaparticulartargetfunction� ReferenceDependencyn Whatifcalledfunctionismovedtodifferentmachine?
n Parametershavetomatchmachinearchitecture(little/bigEndian,…), localesettings(codepages,timezones,…)� PlatformDependency
9
©FrankLeymann
Σ =CausesofVolatilityofRPC
n TimeAutonomyviolation≈Allingredientshavetobeavailableatsametime
n FormatAutonomyviolation≈Numberandtypesofparametersmustmatch
n ReferenceAutonomyviolation≈Hard-codedaddresses
n PlatformAutonomyviolation≈Internalrepresentationsofdata(little/bigendian...)
10
©FrankLeymann
Coreprinciple:Reducenumberofassumptionstwopartiesmakeabouteachotherwhentheyexchangeinformation
LooseCoupling
11
©FrankLeymann
LooseCoupling:AutonomyAspects
n ReferenceAutonomyn Producersandconsumersdon’tknoweachother
n TimeAutonomyn Producersandconsumersexecuteattheirownpace
n FormatAutonomyn Producersandconsumersmayusedifferentformatsofdata
exchanged
n PlatformAutonomyn Producersandconsumersmaybeindifferentenvironments,written
indifferent languages,…
12
©FrankLeymann
Agenda
13
LooseCouplingMessagingWS*RESTArchitectural ImplicationsMicroservicesConclusion
©FrankLeymann
Messaging
15
ApplicationB
�ApplicationA
Endpoint
Message
Channel Route Transform
Manage
©FrankLeymann
ReferenceAutonomyinMessaging
n Producersandconsumerscommunicateviaqueuesortopics,i.e.theydon’tknoweachother
n Routingcomponentsfreeproducersevenfromhavingtoknowwhichqueueortopictousen …i.e.producersonlyhas
tounderstandsinglesourcetosendmessagesto
16
Consumer A
Consumer B
Prod
ucer
©FrankLeymann
TimeAutonomyinMessaging
n Asynchronyisattheheartofmessaging,thustimeautonomyis“initsguts”
n Queuingisproviding1-1connections
n Pubsub isproviding1-nconnections
17
SenderReceiver1
Receiverj
Receivern
…
…
Receiver1
Receiverj
Receivern
…
…Sender
©FrankLeymann
PlatformAutonomyinMessaging
n Endpointareisolatingapplicationsfrommessagingenvironment
n Applicationcanbe…n …inanyprogramming
languagen …inanyoperating
environmentn …
n Messagingproductsruninmanyenvironments
n Youcanevenbridgebetweendifferentproducts
18
ChannelAdapter EndpointImplement
As…
MessagingMapper
UsesA…
MessagingGateway
ImplementedAs…
MOM 1 MOM 2
©FrankLeymann
FormatAutonomyinMessaging
n Transformationofmessages isdone“onthewire”n Versioningofmessages isenabledn …
19
ATranslator
B
Translator
A
B
Translator
Translator
CanonicalData Model
TranslatorC C
Translator Translator
� �
��
� � �
©FrankLeymann
Agenda
20
LooseCouplingMessagingWS*RESTArchitectural ImplicationsMicroservicesConclusion
©FrankLeymann
MessageEndpoints
n Applicationstypicallydonotsenddatatoorreceivedatafromachanneln Theyarenot builtwithintegrationinmind!
n Messageendpoints connectapplicationstointegrationsolution
22
A
Endp
oint
AEndpoint B
B
M M’
©FrankLeymann
CharacteristicsofaMessagingEndpoint
23
FunctionImplementation
FunctionImplementation
…isatanaddress
…isreachableviacertaintransports&messageencodings
…implementsaninterface
MessageEndpoint
Port TypePort
Binding
WSDL
©FrankLeymann
ProtocolsareChangingAlongAPath
24
InitialSender
UltimateReceiver
MyGateway Firewall Your
Gateway
� Ingeneral,youcannot relyonanyQoS of„the“transportprotocol
Message path
Enterprise1Enterprise2
JMS
HTTP
RMI/IIOP
MQ
©FrankLeymann
SOAP
25
Intended forultimate receiver
SOAP Envelope
SOAP Header
SOAP Body
Header Block H1
Header Block Hn
Body Sub-element B1
Body Sub-element Bk
...
...Intended forintermediaries
Payload formiddlewareensuring QoS
Payload forapplication
©FrankLeymann
LooseCouplinginWS*
n ReferenceAutonomyn Clientinteractswithanendpoint(oftenaURI)notwitha
concreteprogram,i.e.clientdoesn’tknowtheactualservicen TimeAutonomy
n Asynchronousbindings(JMS,…)canbeusedn Reply-toheader,Correlationheader,…supportasynchrony
evenoversynchronoustransportsn PlatformAutonomy
n Clientinteractswithservicewithouthavingtoknowprogramminglanguage,hostingenvironment,…ofservice
n FormatAutonomyn Bindingspecifiesserializationformatn Transformationcanbedone“invisibly”alongthewire
26
©FrankLeymann
Agenda
27
LooseCouplingMessagingWS*RESTArchitectural ImplicationsMicroservicesConclusion
©FrankLeymann
CoreIdeaBehindREST
n RESTisanarchitecturalstyle,notatechnology
n ItallowstoapplytheWebArchitecturetomoresophisticatedinteractions
n KeyPoints:n REpresentationaln StateTransfer
©FrankLeymann
CharacteristicsOfTheWebArchitecture
n InteractionwithURIaddressableresourcesn Fixedsetofgenericinteractions
(mainlyHTTPGET,POST,PUT,andDELETE)n Standarddataformat(HTML,XML,…- MIMEtypes)n Stateless
n Allcontextisfullyunderstandablefrommessage
©FrankLeymann
ReferenceAutonomyinREST:URIs
n URIdecouplesfromknowingtheactualfunctionimplementation
n HATEOASgoesbeyond(seelater)
31
ResourceImplementation
ResourceImplementation
Resource
Resource
URIClient
REST Server
©FrankLeymann
TimeAutonomyinREST:LongRunningRequests
n Sometimesrequestsmaytaketoolongforaclienttowaitforresponsen EspeciallyPOST andDELETEmaytakesometime
n Theymightinitiateacompletebusinessprocesses
n Serveracknowledgesreceptionofrequestn ViaHTTPStatusCode202 Accepted
n Serverprovidesaresourcethatclientcanusetotrackprogressoflong-runningrequest(aka“task”)n ViaContent-Location headerofthisresource,orn ViaLink tothisresource
©FrankLeymann
Example:StartingLongRunningRequest
POST /imageProcessing/beautify HTTP/1.1Host: www.fl.comContent-Type: multipart/related; boundary=fl42
--fl42...--fl42...--fl42--
HTTP/1.1 202 AcceptedContent-Type: application/xmlContent-Location: http://www.fl.com/imageProcessing/tasks/1
<status><state>running</state><link rel="self" href=".../tasks/1"/><estimatedCompletion>2020-04-01</estimatedCompletion>
</status> Task
Res
ourc
e
©FrankLeymann
Example:CheckingStateofLongRunningRequest
GET /imageProcessing/tasks/1 HTTP/1.1Host: www.fl.com
HTTP/1.1 200 OKContent-Type: application/xmlContent-Location: http://www.fl.com/imageProcessing/tasks/1
<status><state>running</state><link rel="self" href=".../tasks/1"/><estimatedCompletion>2020-10-10</estimatedCompletion>
</status>
©FrankLeymann
Example:CompletionofLongRunningRequest
n Location headerpointstonewlycreated,i.e.successfullyprocessedresourcebutnottothetaskresource
n Content-Location header(still)pointstothetaskresource
GET /imageProcessing/tasks/1 HTTP/1.1Host: www.fl.com
HTTP/1.1 303 See OtherContent-Type: application/xmlLocation: http://www.fl.com/images/314Content-Location: http://www.fl.com/imageProcessing/tasks/1
<status><state>ready</state><link rel="self" href=".../tasks/1"/><message>Image processed & stored</message>
</status>
©FrankLeymann
Example:FailedLongRunningRequest
GET /imageProcessing/tasks/1 HTTP/1.1Host: www.fl.com
HTTP/1.1 200 OKContent-Type: application/xmlContent-Location: http://www.fl.com/imageProcessing/tasks/1
<status><state>failed</state><link rel="self" href=".../tasks/1"/><message>Image could not be processed</message>
</status>
©FrankLeymann
PlatformAutonomyinREST
n ThepremiertransporttoimplementRESTisHTTP(S)
n HTTPclientsandHTTPserversareavailableinallmajorenvironments
n Programsinmostlanguagescanbeproducers andconsumersofHTTPmessages
37
©FrankLeymann
FormatAutonomyinREST:ContentNegotiation
n Often,requestedentityisavailableinmultiplevariants
n HTTPdefinesprocedures tonegotiatetheappropriatevarianttobetransferred
38
Client Server
VariantEntity
VariantVariantVariant
Selection
Response
Request
©FrankLeymann
ReferenceAutonomy:HATEOAS
n HATEOAS=HypermediaAsTheEngineOfApplicationState
n Theserverreturnslinks(“hypermedia”)thatdescribethefunctionsvalidintheactual“state”ofthe“application”
39
©FrankLeymann
Example:ReturningApplicableFunctions
GET /orders/42 HTTP/1.1Host: www.fl.com
HTTP/1.1 200 OKContent-Type: application/xml
<order><customer>Frank</customer>...
<link href="www.fl.com/cancellations/42" rel="www.rels.com/orderAPI/POST/cancel"/>
<link href="www.fl.com/ShipDetails/42" rel="www.rels.com/orderAPI/GET/shipping"/>
</order
©FrankLeymann
RESTMaturityModel(akaRichardsonMaturityModel)
n SupportofHATEOAS
n UseofappropriateHTTPmethodstomanipulateindividualresources
n UseofappropriateHTTPstatuscodesandheaderfields
n Individualresourcesareidentifiedn Useofsinglemethod(typicallyPOST)n Methodinvokedonindividualresourcen Similarto“objects”
n HTTPisusedasatransportonlyn Singleentrypointonlyn Useofsinglemethod(typicallyPOST)n Examples:SOAP,XML-RPC
SwampofPOX
Resources
HTTPVerbs
HypermediaControls
Level0
Level1
Level2
Level3
©FrankLeymann
Agenda
43
LooseCouplingMessagingWS*RESTArchitectural ImplicationsMicroservicesConclusion
©FrankLeymann
TwoClassesofFaults
n Afault isaneventwithinasystemthatcausedafailure
n Transient faultdoesnotre-occurwhenretryingtheoperation(“Heisenbug”)
n Permanent faultisrepeatable(“Bohrbug”)
44
©FrankLeymann
FixingFaults
IfsoftwarefaultisaBohrbug thereisnorepair:
n Getanemergencyfixorwaitforthenextrelease
IfsoftwarefaultisaHeisenbug thenrepairiseasy:
→Shutdownandrestart
Luckily,mostsoftware-caused faultsareHeisenbugs
45
©FrankLeymann
Fail-FastTechniques:Watchdog
Awatchdog isaspecialprogramthatdetectsfaultsofapplicationcomponents fast
Itdoessoby…
n Monitoringtheliveness ofthesecomponents, and
n Re-creatingfailedcomponents “immediately”
…whichisequivalenttoshutdownandretryJ
46
©FrankLeymann
Watchdogs:Fault-DetectionMonitoring
47
App
App
App
App
Watchdog
?N=?
App
App
App
App
QueueCardinality LockAcquisition
Pulse Heartbeat
©FrankLeymann
Hot-Pooling:HighAvailability
n HotPool:n Acollectionofapplicationcomponentswithidenticalfunctionality
sharingacommoninputqueuen Whenamemberfailstheothermemberswillcontinue
processingrequestsfrominputqueue� Availabilityn Watchdogwillrestartfailedmembers� HighAvailability
48
ServerServer
ServerClient AppPUT
GET
HotPool
Update
Watchdog
=Shutdown&Retry
©FrankLeymann
ABitofMath:ForgiveMeJ
49
αhot pool = P≥1 = i
N( )i=1
N
∑ α i 1−α( )N−i
= iN( )
i=0
N
∑ α i 1−α( )N−i− N
0⎛
⎝⎜⎞
⎠⎟α 0 1−α( )N⎛
⎝⎜
⎞
⎠⎟
= α + 1−α( )( )N− 1−α( )N
…alotofexplanations,e.g.applicationcomponentsfailindependently;independenteventsare“binomialdistributed”;availabilitymeansthatatleastonememberisrunninginhotpool;etc etc…
αhot pool = 1− 1−αmember( )N�
Example:Assumeaterriblybadapplicationcomponentwith80%availability(αmember=0.8).
Hotpoolwith8ofsuchbadcomponentshas99.999availability(αhotpool=0.99999)!
©FrankLeymann
Hot-Pooling:Scalability
n WatchdogcanmonitormetricsofSLOsofhotpooln IfSLOsarethreatenedtobenotmet,watchdogwillstart
additionalmembers� Scale-outn Ifmembersareunderused,watchdogwillshutdownsubsetof
members� Scale-in
50
ServerServer
AppGET
Watchdog
ServerServer
ServerAppGET
Watchdog
Scale-out
ServerAppGET
WatchdogScale-in
©FrankLeymann
n AnApplicationSystem isthecomplete,interdependentsetofhardware,middleware,applications,...requiredtoprocesscompletebusinessrequests
C1 C2 Cn…
ApplicationSystem
ApplicationSystems
52
©FrankLeymann
Stability
n Anapplicationsystem(orsystemforshort)iscalledstableiff itkeepsprocessingbusinessrequestsevenwhentherearetransientimpulses,persistentstresses,orcomponentfailuresdisruptingnormalprocessing
n Animpulse isarapidshocktoasystemn It'slikewhackingthesystemwithahammer
n Stress islikeaforcebeingappliedtoasystemoveranextendedperiodoftime
n It'slikeconstantlypushingagainstthesystem
53
©FrankLeymann
n 100.000newsessionswithinaminuteisanimpulsen 8.000.000newmessagesinaqueuewithinafewminutes
beforeclose-of-businessisanimpulse
n Suchanimpulsecanbreakasystemwithinseconds!
ImpulseinSoftware
54
©FrankLeymann
n Slowresponsefromyourcreditcardprocessoroveralongperiodoftime (see next)isstress
n ...becauseitreducesthecapacitytoservecustomers
Stressproducesstrain
n Stressfromthecreditcardprocessorproducesstrainthatpropagatetootherpartsofthesystem
n ...resultinginrequestspilingupinqueues,queuesgettingfull,refusingnewrequests,stoppingservicestocustomers
StressinSoftware
55
©FrankLeymann
n Howlongisa"longperiodoftime"?
Itdepends!
n Averygooddefinitionisthetimebetweentwocodedeployments
n Ifyoudeployyoursystemonceaweekitdoesn'tmattertobuildthesystemtorunforfiveyearswithoutinterrupt
LongPeriodofTime
56
©FrankLeymann
n Suddenimpulsesandexcessivestraincanbothtriggercatastrophicfailure!
n Analogy:asteelplatewithamicroscopiccrackinthemetal.Understressthecrackcanbegintopropagatefasterandfasteruntiltheplatebrakes!
Cracks
57
©FrankLeymann
n Example:automotiveengineersbuildcrumplezonesintothecarbodytoprotectpassengersbyfailingfirst
n Similarly,buildyourcomponentstostopcrackspropagatingintotherestofthesystem
Design forfailure!
CrackStoppers
58
©FrankLeymann
n ...amplificationistypicallydonebytightcoupling:tightcouplingacceleratescracks
Looselycoupledcomponentsactasshockabsorber,diminishingeffectsoferrorsinsteadofamplifyingthem
TheRoleofLooseCoupling
59
©FrankLeymann
HowtoCopewithCracks
n ThemostimportanttechniquetoavoidcracksistheCircuitBreakern Buttherearemanyothertechniques:
seethebookbyMichaelT.Nygard
n However:
n Thus:
60
Designforfailure!
CracksWILLHAPPEN!
©FrankLeymann
IntermediateConclusion
61
Loosecoupling(especiallytimeautonomyandreferenceautonomy≈reliablemessaging)
supportsbuildinghighlyavailable,scalableandstablecomponents
inastraightforwardmanner
©FrankLeymann
Agenda
62
LooseCouplingMessagingWS*RESTArchitectural ImplicationsMicroservicesConclusion
©FrankLeymann
Definition:Quote(*)
n …microservice architectural style isanapproachton developingasingleapplicationasasuiteofsmallservices,n eachrunninginitsownprocessandn communicatingwithlightweightmechanisms,oftenanHTTP
resourceAPI.n Theseservicesarebuilt
n aroundbusinesscapabilitiesandn independentlydeployablebyfullyautomateddeployment
machinery.n Thereisabareminimumofcentralizedmanagementof
theseservices,whichn maybewrittenindifferentprogramminglanguagesandn usedifferentdatastoragetechnologies.
64
(*) J.Lewis&M.Fowler:“Microservices”(2015),http://martinfowler.com/articles/microservices.html
©FrankLeymann
Microservice:MainProperties
Microservice isn smalln runninginitsownprocessn communicatingoften[via]HTTPn builtaroundbusinesscapabilitiesn writtenindifferentprogramming
languagesn usedifferentdatastorage
technologiesn independentlydeployableby
fullyautomateddeploymentmachinery
65
…what everthatmeansL
Trueformany(!)service
Trueformany(!)service,andmostRESTservices
That’swhatservicesareallabout!
That’sinterestingJ
container
©FrankLeymann
Microservice:TheEssence?
66
Amicroservice isaservicethatisindependently deployable
byfullyautomateddeploymentmachinery
…andthishasinterestingimplications(seenext)
©FrankLeymann
AProblem
n Youhavea“bigapplication”(a.k.a.“monolith”)n Ifyouwanttoreplicate it
n …e.g.becauseofscale,availability,elasticity,…
youpaypenalties(e.g.licensesforallcomponents)althoughyouonlyneed“afewcomponents”replicated
67
Application
…Sca
le,
HA,…
©FrankLeymann
Solution
n Splityour“bigapplication”into“smaller”granulesthatcanbedeployedindependentlyn I.e.splititintomicroservices
n Replicationcanberestrictedtothosecomponentsthatturnouttobebottlenecks(� scale),critical(� HA),…withoutpayingthepenaltiesforallothercomponentsofthe“bigapplication”
68
Application
©FrankLeymann
TheEssenceofMicroservices
n Microservicesareallabout…n …propergranularityofcomponentsn …independentdeployment
n Theyarenotacounter-proposal toSOAn Theydonot provethatSOAfailed
n Intheopposite:theyrequireloosecoupling,…n Theyrequireamethodologytodetermine“proper
granules”forcomponentsn …somethingliketheholygrailofsoftwareengineeringfor
decades!n …so,don’texpectyourmiddlewarevendorstosolvethis
problemforyou!It’sallaboutYOUsolvinganverydifficultarchitecture/designproblem!!!
69
©FrankLeymann
IDEALPrinciple:NativeCloudApplicationProperties- ArchitectsView
Distribution:decomposed application to……usemultiple cloud resources…support thefactthatclouds arelargeglobally distributed systems
Elasticity:build application tosupport scaled-out and scaled-in dynamicallyScale out:acquire additional resources tosatisfy growingworkloadScale in:freeup resources ifworkload shrinks
? LooseCoupling:influence of application components has tobe limitedExample: failures should not impact other componentsExample: addition /removal ofcomponents issimplified
IsolatedState:build theapplication stateless with respect to…Session State:stateofthe communication with theapplication
AutomatedManagement: runtime management should be handled quickly ,automaticExample: automatic license acquisition because ofuse of additional resourcesExample: resiliency by reacting toresource failures
©FrankLeymann
CloudComputingPatterns:Overview
Applica on Workloads
Cloud Service Models & Cloud Deployment Types Cloud Environments Processing Offerings Communica on Offerings Storage Offerings
Applica on Management
Cloud Integra onMul -TenancyFundamental Architecture StylesNa ve Cloud Applica onsHybrid Cloud Applica ons
Applica on Components
Cloud Run meEnvironment
Cloud Applica on
User GroupLoad
Balancer
Presenta on MessageQueue Business Logic Data
OperaƟonManagement
Processing
......
CommunicaƟon Storage
1 2 3
StaƟcWorkload(25)PeriodicWorkload(28)
Once-in-a-lifeƟmeWorkload(31)UnpredictableWorkload(33)ConƟnuously Changing Workload(36)
Infrastructureas a Service(41)Plaƞormas a Service(44)SoŌwareas a Service(49)
PublicCloud(56)PrivateCloud(59)CommunityCloud(64)Hybrid Cloud(67)
ElasƟcInfrastructure(78)ElasƟcPlaƞorm(81)Node-basedAvailability(85)Environment-basedAvailability(88)
Hypervisor(91)
ExecuƟonEnvironment(94)
VirtualNetworking(118)Message-orientedMiddleware(122)Exaclty-onceDelivery(126)
At-least-onceDelivery(128)TransacƟon-basedDelivery(130)Timeout-basedDelviery(132)
Two-ƟerCloud ApplicaƟon(259)Three-ƟerCloud ApplicaƟon(263)Content DistribuƟonNetwork(268)
HybridUser Interface(271)HybridProcessing(274)
HybridData(277)HybridBackup(280)Hybrid Backend(282)Hybrid ApplicaƟon FuncƟons(285)
Hybrid MulƟmediaWeb ApplicaƟon(287)Hybrid Develop-ment Environment(289)
ProviderAdapter(216)ManagedConfiguraƟon(219)ElasƟcityManager(221)ElasƟcLoad Balancer(224)ElasƟcQueue(227)
Watchdog(230)
ElasƟcity Man-agement Process(237)Feature Flags Man- agement Process(240)Update TransiƟonProcess(245)Standby PoolingProcess(248)Resiliency Man-agement Process(252)
SharedComponent(188)
Tenant-isolatedComponent(191)
DedicatedComponent(195)
Restricted Data AccessComponent(198)Message Mover(201)ApplicaƟon ComponentProxy(203)Compliant DataReplicaƟon(205)
StatefulComponent(150)StatelessComponent(153)MulƟ ComponentImage(184)
User InterfaceComponent(156)
ProcessingComponent(160)Batch ProcessingComponent(165)
IdempotentProcessor(176)
TransacƟon-basedProcessor(179)Timeout-basedMessage Processor(182)
Data AccessComponent(168)DataAbstractor(173)
Map Reduce(96)
=1
1+
StrictConsistency(110)EventualConsistency(113)
Key-valueStorage(107)
ID
BlobStorage(101)
BlockStorage(100)
1.1 1.2
ZZZ
IntegraƟonProvider(208)
DistributedApplicaƟon(143)
LooseCoupling(139)
?
1+
RelaƟonalDatabase(103)
www
3,14159...
3,14
hosted onhosted onhosted on
§
©FrankLeymann
Agenda
73
LooseCouplingMessagingWS*RESTArchitectural ImplicationsMicroservicesConclusion
©FrankLeymann
Summary
n Buildingrobustapplicationsisallaboutproperarchitecture anddesign
n Loose-Couplingisacentralprincipleofsucharchitectureanddesign
n Loose-Couplingissupportedbythemainstreamservicetechnologies
n Thereisnomiddlewareortoolingmagicthatensuresbuilding“good”service-basedsystems!
74
Butit’sallaboutYOUapplyinggoodarchitecturalprinciples
(likeloosecouplingJ)