curs 13 - cs.ubbcluj.rovniculescu/didactic/ppd/c13.pdfcurs 13 distributed computing patterns...

40
Curs 13 Distributed Computing Patterns

Upload: others

Post on 12-Sep-2019

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Curs13

DistributedComputingPatterns

Page 2: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Distributedsystems

•  Wemaydefineadistributedsystemasoneinwhichhardwareorsoftwarecomponentslocatedatnetworkedcomputerscommunicateandcoordinatetheiractionsonlybypassingmessages.

•  Distributed-Computingistheprocessofsolvingaproblemusingadistributedsystem.

2

Page 3: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

CharacteristicsConcurrency:-coordinationofconcurrentlyexecutingprogramsthatshareresourcesisalsoanimportantandrecurringtopic.Noglobalclock:-thereisnosingleglobalnotionofthecorrecttime.-Thisisadirectconsequenceofthefactthattheonlycommunicationisbysendingmessagesthroughanetwork.

Independentfailures:-  Allcomputersystemscanfail,anditistheresponsibilityofsystemdesignerstoplanforthe

consequencesofpossiblefailures.-  Faultsinthenetworkresultintheisolationofthecomputersthatareconnectedtoit,but

thatdoesn’tmeanthattheystoprunning.-  Infact,theprogramsonthemmaynotbeabletodetectwhetherthenetworkhasfailedor

hasbecomeunusuallyslow.-  Similarly,thefailureofacomputer,ortheunexpectedterminationofaprogramsomewhere

inthesystem(acrash),isnotimmediatelymadeknowntotheothercomponentswithwhichitcommunicates.

-  Eachcomponentofthesystemcanfailindependently,leavingtheothersstillrunning.

3

Page 4: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

TrendsDistributedsystemsareundergoingaperiodofsignificantchangeandthiscanbetracedbacktoanumberofinfluentialtrends:•theemergenceofpervasivenetworkingtechnology;•theemergenceofubiquitouscomputingcoupledwiththedesiretosupportusermobilityindistributedsystems;•theincreasingdemandformultimediaservices;•theviewofdistributedsystemsasautility.

4

Page 5: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Client-Server

•  Aservercomponentprovidesservicestomultipleclientcomponents.

•  Aclientcomponentrequestsservicesfromtheservercomponent.

•  Serversarepermanentlyactive,listeningforclients.

5

Page 6: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

StateintheClient-serverpatternClientsandserversareofteninvolvedin‘sessions’.–Withastatelessserver,thesessionstateismanagedbytheclient.Thisclientstateissentwitheachrequest.Inawebapplication,thesessionstatemaybestoredasURLparameters,inhiddenformfields,orbyusingcookies.ThisismandatoryfortheRESTarchitecturalstyleforwebapplications.–Withastatefulserver,thesessionstateismaintainedbytheserver,andisassociatedwithaclient-id.StateintheClient-serverpatterninfluencestransactions,faulthandlingandscalability.•  Transactionsshouldbeatomic,leaveaconsistentstate,beisolated(notaffectedbyother

requests)anddurable.Thesepropertiesarehardtoobtaininadistributedworld.•  Concerningfaulthandling,statemaintainedbytheclientmeansforinstancethateverything

willbelostwhentheclientfails.•  Client-maintainedstateposessecurityissuesaswell,becausesensitivedatamustbesentto

theserverwitheachrequest.•  Scalabilityissuesmayarisewhenyouhandletheserverstatein-memory:withmanyclients

usingtheserveratthesametime,manystateshavetobestoredinmemoryatthesametimeaswell.

6

Page 7: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Peer-to-peerpattern•  itcanbeseenasasymmetricClient-serverpattern:

–  peersmayfunctionbothasaclient,requestingservicesfromotherpeers,andasaserver,providingservicestootherpeers.

•  Apeermayactasaclientorasaserverorasboth,anditmaychangeitsroledynamically.

•  Bothclientsandserversinthepeer-to-peerpatternaretypicallymultithreaded.Theservicesmaybeimplicit(forinstancethroughtheuseofaconnectingstream)insteadofrequestedbyinvocation.

•  Peersactingasaservermayinformpeersactingasaclientofcertainevents.Multipleclientsmayhavetobeinformed,forinstanceusinganevent-bus.

7

Page 8: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Examples

•  thedistributedsearchengineSciencenet,•  multi-userapplicationslikeadrawingboard,•  peer-to-peerfile-sharinglikeGnutellaorBittorrent.

8

Page 9: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Characteristics•  Anadvantageofthepeer-to-peerpatternisthatnodesmayusethecapacityof

thewhole,whilebringinginonlytheirowncapacity.

–  Inotherwords,thereisalowcostofownership,throughsharing.•  Administrativeoverheadislow,becausepeer-to-peernetworksareself-

organizing.

•  ThePeer-to-peerpatternisscalable,andresilienttofailureofindividualpeers.

•  Theconfigurationofasystemmaychangedynamically:peersmaycomeandgowhilethesystemisrunning.

•  Adisadvantagemaybethatthereisnoguaranteeaboutqualityofservice,asnodescooperatevoluntarily.

–  Forthesamereason,securityisdifficulttoguarantee.

•  Performancegrowswhenthenumberofparticipatingnodesgrows,whichalsomeansthatitmaybelowwhentherearefewnodes.

9

Page 10: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

ArchitecturalpatternsFrankBuschmann.KevlinHenney.DouglasC.Schmidt.Pattern-OrientedSoftwareArchitecture,Volume4:APatternLanguageforDistributed-Computing.Wiley&Sons,2007Anarchitecturalpatternisaconceptthatsolvesanddelineatessomeessentialcohesiveelementsofasoftwarearchitecture.•  DomainModel•  Layers•  Model-View-Controller•  Presentation-Abstraction-Control•  Microkernel•  Reflection•  PipesandFilters•  SharedRepository•  Blackboard•  DomainObject

10

Page 11: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

ConnectiontotheDomainLayer

11

Page 12: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Pipe-FilterPattern

12

•  ThePipe-filterarchitecturalpatternprovidesastructureforsystemsthatproduceastreamofdata.

•  Eachprocessingstepisencapsulatedinafiltercomponent(circles).

•  Dataispassedthroughpipes(thearrowsbetweenadjacentfilters).•  Thepipesmaybeusedforbufferingorforsynchronization.

Page 13: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Example

13

•  UsethePipesandFiltersarchitecturalstyletodividealargerprocessingtaskintoasequenceofsmaller,independentprocessingsteps(Filters)thatareconnectedbychannels(Pipes).

•  Eachfilterexposesaverysimpleinterface:itreceivesmessagesontheinboundpipe,processesthemessage,andpublishestheresultstotheoutboundpipe.

•  Thepipeconnectsonefiltertothenext,sendingoutputmessagesfromonefiltertothenext.

•  Becauseallcomponentusethesameexternalinterfacetheycanbecomposedintodifferentsolutionsbyconnectingthecomponentstodifferentpipes.

•  Wecanaddnewfilters,omitexistingonesorrearrangethemintoanewsequence--allwithouthavingtochangethefiltersthemselves.

Page 14: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

BlackboardPattern

14

•  TheBlackboardpatternisusefulforproblemsforwhichnodeterministicsolutionstrategiesareknown=>opportunisticproblemsolving.

•  Severalspecializedsubsystemsassembletheirknowledgetobuildapossiblypartialorapproximatesolution.

•  Allcomponentshaveaccesstoashareddatastore,theblackboard.•  Componentsmayproducenewdataobjectsthatareaddedtotheblackboard.•  Componentslookforparticularkindsofdataontheblackboard,andmayfind

thesebypatternmatching.

Page 15: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

•  Class–  Blackboard

•  Responsibility–  Managescentraldata

•  Collaborators–  no

•  Class–  KnowledgeSource

•  Responsibility–  Evaluatesitsownapplicability

–  Computesaresult

–  UpdatesBlackboard

•  Collaborators–  Blackboard

15

•  Class–  Control

•  Responsibility–  MonitorsBlackboard

–  Schedulesknowledgesourceactivations

•  Collaborators–  Blackboard–  KnowledgeSource

Page 16: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Generaldescription

•  Blackboardallowsmultipleprocesses(oragents)tocommunicatebyreadingandwritingrequestsandinformationtoaglobaldatastore.

•  Eachparticipantagenthasexpertiseinitsownfield,andhasakindofproblemsolvingknowledge(knowledgesource)thatisapplicabletoapartoftheproblem,i.e.,theproblemcannotbesolvedbyanindividualagentonly.

•  Agentscommunicatestrictlythroughacommonblackboardwhosecontentsisvisibletoallagents.

•  Whenapartialproblemistobesolved,candidateagentsthatcanpossiblyhandleitarelisted.

•  Acontrolunitisresponsibleforselectingamongthecandidateagentstoassignthetasktooneofthem.

16

Page 17: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Example:speechrecognition•  ThemainloopofControlstarted

–  ControlcallsnextSource()toselectthenextknowledgesource

–  nextSource()looksattheblackboardanddetermineswhichknowledgesourcestocall

–  Forexample,nextSource()determinethatSegmentation,SyllableCreationandWordCreationarecandidate

–  nextsource()invokesthecondition-partofeachcandidateknowledgesource

–  Thecondition-partsofcandidateknowledgesourceinspecttheblackboardtodetermineifandhowtheycancontributetothecurrentstateofthesolution

–  TheControlchoosesaknowledgesourcetoinvokeandasetofhypothesestobeworkedon(accordingtotheresultoftheconditionpartsand/orcontroldata)

–  Applytheaction-partoftheknowledgesourcetothehypothesis

–  Newcontentsareupdatedintheblackboard

17

Page 18: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Advantages&Disadvantages

•  Advantages–  Suitablewhentherearediversesourcesofinputdata–  Suitableforphysicallydistributedenvironments–  Suitableforschedulingandpostponementoftasksanddecisions

–  Suitableforteamproblem-solvingapproachesasitcanbeusedtopostproblemsubsomponentsandpartialresults

•  Disadvantages–  Expensive–  Difficulttodeterminepartitioningofknowledge–  Controlunitcanbeverycomplex

18

Page 19: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Robotexample

•  AnExperimentalrobotisequippedwithfouragents:–  SensorHandlerAgent,–  CollisionDetectorAgent,–  CorridorRecognizerAgentand–  DriveControllerAgent

(Includesthecontrolsoftware)•  Agentsandblackboardformthecontrolsystem.Agentcooperationisreachedby

meansoftheblackboard.Blackboardisusedasacentralrepositoryforallsharedinformation.

•  Onlytwoagentshaveanaccesstotheenvironment:SensorHandlerAgentandDriveControllerAgent.

•  Thereisnoglobalcontrollerforalloftheseagents,soeachofthemindependentlytriestomakeacontributiontothesystemduringthecourseofnavigation.

•  Basicallyeachofthefouragentsexecutesitstasksindependentlyusinginformationontheblackboardandpostsanyresultbacktotheblackboard.

19

Page 20: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

….patternsrelatedtothecommunicationinfrastructure

•  Messaging–  DistributionInfrastructure

•  Publisher-Subscriber–  DistributionInfrastructure

•  Broker–  DistributionInfrastructure

•  ClientProxy–  DistributionInfrastructure

•  Reactor–  EventDemultiplexingandDispatching

•  Proactor–  EventDemultiplexingandDispatching

20

Page 21: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

MessagingPattern•  Somedistributedsystemsarecomposedofservicesthatweredeveloped

independently.

•  However,toformacoherentsystem,theseservicesmustinteractreliably,butwithoutincurringoverlytightdependenciesononeanother.

•  Solution: Connect the services via a message bus that allows them totransferdatamessagesasynchronously.–  Encodethemessagessothatsendersandreceiverscancommunicate

reliably without having to know all the data type informationstatically.

21

Page 22: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Messaging(continued)•  Message-based communication supports loose coupling between services in a

distributedsystem.

•  Messages only contain the data to be exchanged between a set of clients and

services,sotheydonotknowwhoisinterestedinthem.–  Therefore, another way is to connect the collaborating clients and services

using amessage channel that allows them to exchangemessages, known as“MessageChannel”.

22

Page 23: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Publisher-SubscriberPattern

•  Components in some distributed applications are loosely coupled andoperatelargelyindependently.

•  ifsuchapplicationsneedtopropagateinformationtosomeoralloftheircomponents, a notification mechanism is needed to inform thecomponentsaboutstatechangesorotherinterestingevents.

•  Solution: Define a change propagation infrastructure that allowspublishers inadistributedapplicationtodisseminateeventsthatconveyinformationthatmaybeofinteresttoothers.–  Notify subscribers interested in those events whenever such

informationispublished.

23

Page 24: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Publisher-Subscriber(continued)

•  Publishersregisterwiththechangepropagationinfrastructureto informitaboutwhattypesofeventstheycanpublish.

•  Similarly, subscribers registerwith the infrastructure to inform it aboutwhattypesofeventstheywanttoreceive.

•  Theinfrastructureusesthisregistrationinformationtorouteeventsfromtheirpublishersthroughthenetworktointerestedsubscribers.

24

Page 25: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Event-BusPattern

25

•  Eventsourcespublishmessagestoparticularchannelsonaneventbus.•  Eventlistenerssubscribetoparticularchannels.•  Listenersarenotifiedofmessagesthatarepublishedtoachanneltowhichtheyhave

subscribed.•  Generationandnotificationofmessagesisasynchronous:aneventsourcejust

generatesamessageandmaygoondoingsomethingelse;itdoesnotwaituntilalleventlistenershavereceivedthemessage.

Page 26: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

BrokerPattern•  Distributed systems face many challenges that do not arise in single-process

systems.–  However, application code should not need to address these challenges

directly.

•  Moreover, applications should be simplified by using amodular programmingmodelthatshieldsthemfromthedetailsofnetworkingandlocation.

•  Solution:Useafederationofbrokerstoseparateandencapsulatethedetailsofthe communication infrastructure in a distributed system from its applicationfunctionality.

•  Define a component-based programming model so that clients can invokemethodsonremoteservicesasiftheywerelocal.

26

Page 27: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Broker(continued)

•  Ingeneralamessaginginfrastructureconsistsoftwocomponents:

–  A“Requestor”forwardsrequestmessagesfromaclienttothelocalbrokeroftheinvokedremotecomponent;

–  While an “Invoker” encapsulates the functionality for receiving requestmessages sentbya client-sidebrokeranddispatching these requests to theaddressedremotecomponents.

27

Page 28: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Client-ProxyPattern•  When constructing a client-side BROKER infrastructure for a remote

componentwemustprovideanabstraction thatallowsclients toaccessremotecomponentsusingremotemethodinvocation.

•  A “ClientProxy /RemoteProxy” represents a remote-component in theclient’saddressspace.

•  The proxy offers an identical interface that maps specific methodinvocations on the component onto the broker’s message-orientedcommunicationfunctionality.

•  Proxiesallowclientstoaccessremotecomponentfunctionalityasiftheywerecollocated.

28

Page 29: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

EventDemultiplexing&Dispatching

•  At itsheart,distributedcomputing isallabouthandlingandrespondingtoeventsreceivedfromthenetwork.

•  There are patterns that describe different approaches forinitiating, receiving, demultiplexing, dispatching, andprocessingeventsindistributedandnetworkedsystems.

•  …twoofthesepatterns:Reactor;Proactor;

29

Page 30: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

ReactorPattern•  Event-drivensoftwareoften

–  receivesservicerequesteventsfrommultipleeventsources,whichitdemultiplexesanddispatchestoeventhandlersthatperformfurtherserviceprocessing.

•  Eventscanalsoarrivesimultaneouslyattheevent-drivenapplication.–  To simplify software development, events should be processed

sequentially|synchronously.

30

Page 31: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Reactor(continued)•  Solution:Provideaneventhandlinginfrastructurethatwaitsonmultipleevent

sources simultaneously for service request events to occur, but onlydemultiplexes and dispatchesone event at a time to a corresponding eventhandlerthatperformstheservice.

•  Itdefinesaneventloopthatusesanoperatingsystemeventdemultiplexertowaitsynchronouslyforservicerequestevents.

•  By delegating the demultiplexing of events to the operating system, thereactorcanwaitformultipleeventsourcessimultaneouslywithoutaneedtomulti-threadtheapplicationcode.

31

Page 32: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

ProactorPattern•  To achieve the required performance and throughput, event-driven applications

mustoftenbeabletoprocessmultipleeventssimultaneously.

•  However, resolvingthisproblemviamulti-threading,maybeundesirable,duetotheoverheadofsynchronization,contextswitchinganddatamovement.

•  Solution:–  Splitanapplication’sfunctionalityinto

•  asynchronousoperationsthatperformactivitiesoneventsourcesand•  completionhandlersthatusetheresultsofasynchronousoperationstoimplementapplicationservicelogic.

–  Lettheoperatingsystemexecutetheasynchronousoperations,but–  executethecompletionhandlersintheapplication’sthreadofcontrol.

32

Page 33: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Proactor(continued)•  Aproactorcomponentcoordinatesthecollaborationbetweencompletionhandlers

andtheoperatingsystem.–  Itdefinesaneventloopthatusesanoperatingsystemeventdemultiplexerto

wait synchronously for events that indicate the completionof asynchronousoperationstooccur.

•  Initiallyall completionhandlers ‘proactively’ call anasynchronousoperation towait for service request events to arrive, and then run the event loop on theproactor.

33

Page 34: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Proactor(continued)

•  When such an event arrives, the proactor dispatches the result of thecompleted asynchronous operation to the corresponding completionhandler.

•  This handler then continues its execution, which may invoke anotherasynchronousoperation. 34

Page 35: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Reactorvs.Proactor•  Althoughbothpatternsresolveessentiallythesameprobleminasimilarcontext,

and also use similar patterns to implement their solutions, the concrete event-handlinginfrastructurestheysuggestaredistinct,duetotheorthogonalforcestowhicheachpatternisexposed.

•  REACTORfocusesonsimplifyingtheprogrammingofevent-drivensoftware.–  Itimplementsapassiveeventdemultiplexinganddispatchingmodelinwhich

services wait until request events arrive and then react by processing theeventssynchronouslywithoutinterruption.

–  Whilethismodelscaleswellforservicesinwhichthedurationoftheresponsetoarequestisshort,itcanintroduceperformancepenaltiesforlong-durationservices, since executing these services synchronously can unduly delay theservicingofotherrequests.

35

Page 36: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Reactorvs.Proactor(cont.)•  PROACTORisdesignedtomaximizeevent-drivensoftwareperformance.

–  It implements amoreactiveevent demultiplexing and dispatchingmodel inwhichservicesdividetheirprocessingintomultipleself-containedpartsand

–  proactivelyinitiateasynchronousexecutionoftheseparts.–  This design allows multiple services to execute concurrently, which can

increasequalityofserviceandthroughput.

•  REACTORandPROACTORarenotreallyequallyweightedalternatives,butratherare complementary patterns that trade-off programming simplicity andperformance.–  Relatively simple event-driven software can benefit from a REACTOR-based

design,whereas–  PROACTOR offers a more efficient and scalable event demultiplexing and

dispatchingmodel.

36

Page 37: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

37

Page 38: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Middleware

•  In computer science, a middleware is a software layer that residesbetweentheapplicationlayerandtheoperatingsystem.

•  Itsprimaryroleistobridgethegapbetweenapplicationprogramsandthelower-level hardware and software infrastructure, to coordinate howpartsofapplicationsareconnectedandhowtheyinter-operate.

•  Middleware also enables and simplifies the integration of componentsdevelopedbydifferenttechnologysuppliers.

38

Page 39: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Middleware(continued)

•  An Example of amiddleware for distributed object-orientedenterprisesystemsisCORBA.

•  Despite their detailed differences, middleware technologiestypicallyfollowoneormoreofthreedifferentcommunicationstyles:–  Messaging–  Publish/Subscribe–  RemoteMethodInvocation

39

Page 40: Curs 13 - cs.ubbcluj.rovniculescu/didactic/PPD/C13.pdfCurs 13 Distributed Computing Patterns Distributed systems • We may define a distributed system as one in which hardware or

Referinte•  FrankBuschmann.KevlinHenney.DouglasC.Schmidt.Pattern-Oriented

SoftwareArchitecture,Volume4:APatternLanguageforDistributed-Computing.Wiley&Sons,2007

•  GeorgeCoulouris.JeanDollimore.TimKindberg.GordonBlair.DISTRIBUTEDSYSTEMS:ConceptsandDesign.FifthEdition.Addison-Wesley.

40