Anda di halaman 1dari 6

6/1/2015

GlossaryTheReactiveManifesto

TheReactive
Manifesto
Glossary
TableofContents
Asynchronous

MessageDriven(incontrasttoEventDriven)

BackPressure

NonBlocking

Batching

Protocol

Delegation

Replication

Component

Resource

Elasticity(incontrasttoScalability)

Scalability

Failure(incontrasttoError)

System

Isolation(andContainment)

User

LocationTransparency

Asynchronous
TheOxfordDictionarydefinesasynchronousasnotexistingoroccurringatthesametime.Inthe
contextofthismanifestowemeanthattheprocessingofarequestoccursatanarbitrarypointintime,
sometimeafterithasbeentransmittedfromclienttoservice.Theclientcannotdirectlyobserve,or
synchronizewith,theexecutionthatoccurswithintheservice.Thisistheantonymofsynchronous
processingwhichimpliesthattheclientonlyresumesitsownexecutiononcetheservicehasprocessed
therequest.

BackPressure
Whenonecomponentisstrugglingtokeepup,thesystemasawholeneedstorespondinasensibleway.
Itisunacceptableforthecomponentunderstresstofailcatastrophicallyortodropmessagesinan
http://www.reactivemanifesto.org/glossary#Scalability

1/6

6/1/2015

GlossaryTheReactiveManifesto

uncontrolledfashion.Sinceitcantcopeanditcantfailitshouldcommunicatethefactthatitisunder
stresstoupstreamcomponentsandsogetthemtoreducetheload.Thisbackpressureisanimportant
feedbackmechanismthatallowssystemstogracefullyrespondtoloadratherthancollapseunderit.The
backpressuremaycascadeallthewayuptotheuser,atwhichpointresponsivenessmaydegrade,but
thismechanismwillensurethatthesystemisresilientunderload,andwillprovideinformationthatmay
allowthesystemitselftoapplyotherresourcestohelpdistributetheload,seeElasticity.

Batching
Currentcomputersareoptimizedfortherepeatedexecutionofthesametask:instructioncachesand
branchpredictionincreasethenumberofinstructionsthatcanbeprocessedpersecondwhilekeepingthe
clockfrequencyunchanged.ThismeansthatgivingdifferenttaskstothesameCPUcoreinrapid
successionwillnotbenefitfromthefullperformancethatcouldotherwisebeachieved:ifpossiblewe
shouldstructuretheprogramsuchthatitsexecutionalternateslessfrequentlybetweendifferenttasks.
Thiscanmeanprocessingasetofdataelementsinbatches,oritcanmeanperformingdifferent
processingstepsondedicatedhardwarethreads.
Thesamereasoningappliestotheuseofexternalresourcesthatneedsynchronizationandcoordination.
TheI/Obandwidthofferedbypersistentstoragedevicescanimprovedramaticallywhenissuing
commandsfromasinglethread(andtherebyCPUcore)insteadofcontendingforbandwidthfromall
cores.Usingasingleentrypointhastheaddedadvantagethatoperationscanbereorderedtobettersuit
theoptimalaccesspatternsofthedevice(currentstoragedevicesperformbetterforlinearthanrandom
access).
Additionally,batchingprovidestheopportunitytoshareoutthecostofexpensiveoperationssuchasI/O
orexpensivecomputations.Forexample,packingmultipledataitemsintothesamenetworkpacketor
diskblocktoincreaseefficiencyandreduceutilisation.

Delegation
Delegatingataskasynchronouslytoanothercomponentmeansthattheexecutionofthetaskwilltake
placeinthecontextofthatothercomponent.Thisdelegatedcontextcouldentailrunninginadifferent
errorhandlingcontext,onadifferentthread,inadifferentprocess,oronadifferentnetworknode,to
nameafewpossibilities.Thepurposeofdelegationistohandovertheprocessingresponsibilityofatask
toanothercomponentsothatthedelegatingcomponentcanperformotherprocessingoroptionally
observetheprogressofthedelegatedtaskincaseadditionalactionisrequiredsuchashandlingfailureor
reportingprogress.

Component
Whatwearedescribingisamodularsoftwarearchitecture,whichisaveryoldidea,seeforexample
Parnas(1972).Weareusingthetermcomponentduetoitsproximitywithcompartment,whichimplies
thateachcomponentisselfcontained,encapsulatedandisolatedfromothercomponents.Thisnotion
appliesforemosttotheruntimecharacteristicsofthesystem,butitwilltypicallyalsobereflectedinthe
sourcecodesmodulestructureaswell.Whiledifferentcomponentsmightmakeuseofthesame
softwaremodulestoperformcommontasks,theprogramcodethatdefinesthetoplevelbehaviorof
eachcomponentisthenamoduleofitsown.Componentboundariesareoftencloselyalignedwith
http://www.reactivemanifesto.org/glossary#Scalability

2/6

6/1/2015

GlossaryTheReactiveManifesto

BoundedContextsintheproblemdomain.Thismeansthatthesystemdesigntendstoreflecttheproblem
domainandsoiseasytoevolve,whileretainingisolation.Messageprotocolsprovideanaturalmapping
andcommunicationslayerbetweenBoundedContexts(components).

Elasticity(incontrasttoScalability)
Elasticitymeansthatthethroughputofasystemscalesupordownautomaticallytomeetvaryingdemand
asresourceisproportionallyaddedorremoved.Thesystemneedstobescalable(seeScalability)toallow
ittobenefitfromthedynamicaddition,orremoval,ofresourcesatruntime.Elasticitythereforebuilds
uponscalabilityandexpandsonitbyaddingthenotionofautomaticresourcemanagement.

Failure(incontrasttoError)
Afailureisanunexpectedeventwithinaservicethatpreventsitfromcontinuingtofunctionnormally.A
failurewillgenerallypreventresponsestothecurrent,andpossiblyallfollowing,clientrequests.Thisisin
contrastwithanerror,whichisanexpectedandcodedforconditionforexampleanerrordiscovered
duringinputvalidation,thatwillbecommunicatedtotheclientaspartofthenormalprocessingofthe
message.Failuresareunexpectedandwillrequireinterventionbeforethesystemcanresumeatthesame
levelofoperation.Thisdoesnotmeanthatfailuresarealwaysfatal,ratherthatsomecapacityofthe
systemwillbereducedfollowingafailure.Errorsareanexpectedpartofnormaloperations,aredealt
withimmediatelyandthesystemwillcontinuetooperateatthesamecapacityfollowinganerror.
Examplesoffailuresarehardwaremalfunction,processesterminatingduetofatalresourceexhaustion,
programdefectsthatresultincorruptedinternalstate.

Isolation(andContainment)
Isolationcanbedefinedintermsofdecoupling,bothintimeandspace.Decouplingintimemeansthatthe
senderandreceivercanhaveindependentlifecyclestheydonotneedtobepresentatthesametimefor
communicationtobepossible.Itisenabledbyaddingasynchronousboundariesbetweenthecomponents,
communicatingthroughmessagepassing.Decouplinginspace(definedasLocationTransparency)
meansthatthesenderandreceiverdonothavetoruninthesameprocess,butwherevertheoperations
divisionortheruntimeitselfdecidesismostefficientwhichmightchangeduringanapplication's
lifetime.
Trueisolationgoesbeyondthenotionofencapsulationfoundinmostobjectorientedlanguagesandgives
uscompartmentalizationandcontainmentof:
Stateandbehavior:itenablessharenothingdesignsandminimizescontentionandcoherencecost
(asdefinedintheUniversalScalabilityLaw)
Failures:itallowserrorstobecaptured,signalledandmanagedatafinegrainedlevelinsteadof
lettingthemcascadetoothercomponents.
Strongisolationbetweencomponentsisbuiltoncommunicationoverwelldefinedprotocolsandenables
loosecoupling,leadingtosystemsthatareeasiertounderstand,extend,testandevolve.

LocationTransparency
http://www.reactivemanifesto.org/glossary#Scalability

3/6

6/1/2015

GlossaryTheReactiveManifesto

Elasticsystemsneedstobeadaptiveandcontinuouslyreacttochangesindemand,theyneedto
gracefullyandefficientlyincreaseanddecreasescale.Onekeyinsightthatsimplifiesthisproblem
immenselyistorealizethatwearealldoingdistributedcomputing.Thisistruewhetherwearerunning
oursystemsonasinglenode(withmultipleindependentCPUscommunicatingovertheQPIlink)orona
clusterofnodes(withindependentmachinescommunicatingoverthenetwork).Embracingthisfact
meansthatthereisnoconceptualdifferencebetweenscalingverticallyonmulticoreorhorizontallyonthe
cluster.
Ifallofourcomponentssupportmobility,andlocalcommunicationisjustanoptimization,thenwedo
nothavetodefineastaticsystemtopologyanddeploymentmodelupfront.Wecanleavethisdecisionto
theoperationspersonnelandtheruntime,whichcanadaptandoptimizethesystemdependingonhowit
isused.
Thisdecouplinginspace(seethethedefinitionforIsolation),enabledthroughasynchronousmessage
passing,anddecouplingoftheruntimeinstancesfromtheirreferencesiswhatwecallLocation
Transparency.LocationTransparencyisoftenmistakenfor'transparentdistributedcomputing',whileitis
actuallytheopposite:weembracethenetworkandallitsconstraintslikepartialfailure,networksplits,
droppedmessages,anditsasynchronousandmessagebasednaturebymakingthemfirstclassinthe
programmingmodel,insteadoftryingtoemulateinprocessmethoddispatchonthenetwork(alaRPC,
XAetc.).OurviewofLocationTransparencyisinperfectagreementwithANoteOnDistributed
ComputingbyWaldoetal.

MessageDriven(incontrasttoEventDriven)
Amessageisanitemofdatathatissenttoaspecificdestination.Aneventisasignalemittedbya
componentuponreachingagivenstate.Inamessagedrivensystemaddressablerecipientsawaitthe
arrivalofmessagesandreacttothem,otherwiselyingdormant.Inaneventdrivensystemnotification
listenersareattachedtothesourcesofeventssuchthattheyareinvokedwhentheeventisemitted.This
meansthataneventdrivensystemfocusesonaddressableeventsourceswhileamessagedrivensystem
concentratesonaddressablerecipients.Amessagecancontainanencodedeventasitspayload.
Resilienceismoredifficulttoachieveinaneventdrivensystemduetotheshortlivednatureofevent
consumptionchains:whenprocessingissetinmotionandlistenersareattachedinordertoreacttoand
transformtheresult,theselistenerstypicallyhandlesuccessorfailuredirectlyandinthesenseof
reportingbacktotheoriginalclient.Respondingtothefailureofacomponentinordertorestoreits
properfunction,ontheotherhand,requiresatreatmentofthesefailuresthatisnottiedtoephemeral
clientrequests,butthatrespondstotheoverallcomponenthealthstate.

NonBlocking
Inconcurrentprogramminganalgorithmisconsiderednonblockingifthreadscompetingforaresource
donothavetheirexecutionindefinitelypostponedbymutualexclusionprotectingthatresource.In
practicethisusuallymanifestsasanAPIthatallowsaccesstotheresourceifitisavailableotherwiseit
immediatelyreturnsinformingthecallerthattheresourceisnotcurrentlyavailableorthattheoperation
hasbeeninitiatedandnotyetcompleted.AnonblockingAPItoaresourceallowsthecallertheoptionto
dootherworkratherthanbeblockedwaitingontheresourcetobecomeavailable.Thismaybe
complementedbyallowingtheclientoftheresourcetoregisterforgettingnotifiedwhentheresourceis
availableortheoperationhascompleted.
http://www.reactivemanifesto.org/glossary#Scalability

4/6

6/1/2015

GlossaryTheReactiveManifesto

Protocol
Aprotocoldefinesthetreatmentandetiquettefortheexchangeortransmissionofmessagesbetween
components.Protocolsareformulatedasrelationsbetweentheparticipantstotheexchange,the
accumulatedstateoftheprotocolandtheallowedsetofmessagestobesent.Thismeansthataprotocol
describeswhichmessagesaparticipantmaysendtoanotherparticipantatanygivenpointintime.
Protocolscanbeclassifiedbytheshapeoftheexchange,somecommonclassesarerequestreply,
repeatedrequestreply(asinHTTP),publishsubscribe,andstream(bothpushandpull).
Incomparisontolocalprogramminginterfacesaprotocolismoregenericsinceitcanincludemorethan
twoparticipantsanditforeseesaprogressionofthestateofthemessageexchangeaninterfaceonly
specifiesoneinteractionatatimebetweenthecallerandthereceiver.
Itshouldbenotedthataprotocolasdefinedherejustspecifieswhichmessagesmaybesent,butnothow
theyaresent:encoding,decoding(i.e.codecs),andtransportmechanismsareimplementationdetailsthat
aretransparenttothecomponentsuseoftheprotocol.

Replication
Executingacomponentsimultaneouslyindifferentplacesisreferredtoasreplication.Thiscanmean
executingondifferentthreadsorthreadpools,processes,networknodes,orcomputingcenters.
Replicationoffersscalability,wheretheincomingworkloadisdistributedacrossmultipleinstancesofa
component,orresilience,wheretheincomingworkloadisreplicatedtomultipleinstanceswhichprocess
thesamerequestsinparallel.Theseapproachescanbemixed,forexamplebyensuringthatall
transactionspertainingtoacertainuserofthecomponentwillbeexecutedbytwoinstanceswhilethe
totalnumberofinstancesvarieswiththeincomingload,(seeElasticity).

Resource
Everythingthatacomponentreliesupontoperformitsfunctionisaresourcethatmustbeprovisioned
accordingtothecomponentsneeds.ThisincludesCPUallocation,mainmemoryandpersistentstorage
aswellasnetworkbandwidth,mainmemorybandwidth,CPUcaches,intersocketCPUlinks,reliable
timerandtaskschedulingservices,otherinputandoutputdevices,externalserviceslikedatabasesor
networkfilesystemsetc.Theelasticityandresilienceofalltheseresourcesmustbeconsidered,sincethe
lackofarequiredresourcewillpreventthecomponentfromfunctioningwhenrequired.

Scalability
Theabilityofasystemtomakeuseofmorecomputingresourcesinordertoincreaseitsperformanceis
measuredbytheratioofthroughputgaintoresourceincrease.Aperfectlyscalablesystemis
characterizedbybothbothnumbersbeingproportional:atwofoldallocationofresourceswilldoublethe
throughput.Scalabilityistypicallylimitedbytheintroductionofbottlenecksorsynchronizationpoints
withinthesystem,leadingtoconstrainedscalability,seeAmdahlsLawandGunthersUniversal
ScalabilityModel.

System
Asystemprovidesservicestoitsusersorclients.Systemscanbelargeorsmall,inwhichcasethey
http://www.reactivemanifesto.org/glossary#Scalability

5/6

6/1/2015

GlossaryTheReactiveManifesto

comprisemanyorjustafewcomponents.Allcomponentsofasystemcollaboratetoprovidethese
services.Inmanycasesthecomponentsareinaclientserverrelationshipwithinthesamesystem
(considerforexamplefrontendcomponentsrelyinguponbackendcomponents).Asystemsharesa
commonresiliencemodel,bywhichwemeanthatfailureofacomponentishandledwithinthesystem,
delegatedfromonecomponenttotheother.Itisusefultoviewgroupsofcomponentswithinasystemas
subsystemsiftheyareisolatedfromtherestofthesystemintheirfunction,resourcesorfailuremodes.

User
Weusethisterminformallytorefertoanyconsumerofaservice,bethatahumanoranotherservice.
BackToTop

http://www.reactivemanifesto.org/glossary#Scalability

6/6

Anda mungkin juga menyukai