370 likes | 511 Views
Active Objects & Co. First Year PhD Assessment Justine Rochas PhD subject Programming Model and Middleware S upport for Distributed and C oncurrent Application Advisor Ludovic Henrio Team Scale (I3S-INRIA). AGENDA. PAST. PART I – A Step i nto MultiActive Objects
E N D
Active Objects & Co. First YearPhDAssessment Justine Rochas PhDsubjectProgramming Model and Middleware Support for Distributed and Concurrent Application Advisor Ludovic Henrio TeamScale (I3S-INRIA)
AGENDA PAST • PART I – A StepintoMultiActiveObjects • PART II – What do others do ? The ABS case • PART III – Towardsfaulttolerance of Active Objects PRESENT FUTURE
Active Objects [1] Active Object a Request queue a.bar() Request Execution thread bar() • Asynchronousmethod calls / requestswithfutures • No concurrencybetweenrequests The ProActive Java library = active objectsusing Java syntax
Active Object Creation in ProActive on node1, active object a does: T a = newActive(T.class, params…, node2) // a: localreferenceto the proxy of ra node1 node2 active objecto objecta (proxy to ra) active objectra local reference object remotereference active object
Method calls in ProActive • on node1, active object a does: P param1, param2 = … ; T a = newActive(T.class, params…, node2) Vres = a.bar(param1, param2); // Samesyntaxas a local call res.foobar(); // Wait-by-necessityif resis not resolved node1 node2 param2 copy of param2 param1 copy of param1 o res bar ra a bar
PART IA StepintoMultiActiveObjects Priorities and threading mechanisms for MultiActiveObjects
MultiActiveObjects [2] – Principle Multiactive Object o Thread pool • Execute multiple requestsat the same time locally • In a controlledway
M.A.O. – Language & Scheduling @DefineGroups({ @Group(name="routing", selfCompatible=true), @Group(name="monitoring", selfCompatible=true) }) Multiactive Object o @DefineRules({ @Compatible({"routing","monitoring"}) }) class O { @MemberOf("routing") Value lookup(Key k) { … } @MemberOf("monitoring") voidlog(String m) { … } }
M.A.O. – Extended features Receiverequests ApplyCompatibilities Filter Busy threads! ApplyPriorities Reorder Apply Threading policies Filteragain Executerequests
PrioritySpecificationMechanism High priority @DefinePriorities({ @PriorityOrder({ @Set(groupNames = {"G1"}), @Set(groupNames = {"G2"}), @Set(groupNames = {"G5","G4"}) }), @PriorityOrder({ @Set(groupNames = {"G3"}), @Set(groupNames = {"G2"}) }) }) G1 dependency G3 dependency G2 G5 G4 Lowpriority incoming requestR2 Priorities are automaticallytakenintoaccount in the schedulingpolicy R4 R3 R1 Declarative Scheduling for Active Objects, L. Henrio, J. Rochas, 29th Symposium on Applied Computing (SAC 2014)
Thread Management Mechanisms (1) @DefineThreadConfig(threadPoolSize=1, hardLimit=false) current thread V v = o.bar(); (1) v.foo(); (2) (1) other thread (1)currentthread state = active (2)currentthread state = waiting (2)
Thread Management Mechanisms (2) @Group(name=" routing", minThreads=2, maxThreads=5) routing max min Threads neverused by therouting group Threads neverused by other groups Thread pool Enablehighlevelimplementation of scheduling patterns
PART IIWhat do others do? The ABS case A Translator to Distribute ABS Programs usingProActive
Motivation ProActive – MultiactiveObjects Deployment of distributed applications ✔ OBJECTIVE Providedistributed deployment to ABS usingProActive ABS – Abstract BehavioralSpec. Language Modeling of distributed applications ✔
Background – ABS [3] COG • Characteristics of ABS • COGs (set of objects) • Cooperativescheduling • Java translator • No support for distribution yet obj obj COG await fut?; call() obj obj obj obj View of an ABS program with 6 objects and 2 COGs
Active & passive objects ASP/ProActive Complexsemantic but scales Active objectsonly Creol [4] A lot of threads Active Object Models Uniform Model Non Uniform Model Object Group Model All objects are accessible One thread for manyobjects • JCoBox [5], ABS • A lot of global references to manage if not in shared-memory Server server = new cog Server(); ID serverId = server!getId(); // serverIdis a direct reference // to an object in another COG Example of ABS program
Toward translation of ABS in ProActive • Select active objects • COG = ProActive active object • Entry point to the local memoryspace • Hierarchicalindexing of objects COG registry (RMI) Global index via the network Object registry (in a COG) Local index via sharedmemory
Translation of a new cogstatement ABS code: Server server = new cog Server() Translatedduring compilation into: Server server = new Server() (1) COG cog = newActive(COG.class, {}, node2) (2) cog.registerObject(server) (3) node2 node1 remote server (3) server main cog (1) cog (proxy) cog (2) (2)
Explicit vs Transparent ABS ProActive Transparent asynchonous calls Transparent first class futures • Explicit asynchronous calls • Explicit futures object.method()// synchronous or asynchronous object.method()// synchronous object!method() // asynchronous Fut<T> future = object!method(); Tt = future.get; // blocks Tfuture = object.method();
Translation of an async. method call ABS code: server!start() Translatedduring compilation into: server.getCog().execute("start", {},server.getID()) COG node1 node2 Objectsregistry server remote server main cog Object ID getCog Object ref execute cog (proxy) start execute = 1-retrieve objectwith id 2-run by reflection cog execute
Async. Method Call withParameters ABS code: server!start(param1, param2) Translatedduring compilation into: server.getCog().execute("start", {param1, param2}, server1.getID()) node1 node2 copy of param1 remoteserver server param1 main cog start getCog execute param2 copy of param2 main cog proxies cog (proxy) cog execute
MultiActiveObjects(extendedProActive) Creol JCoBox ABS ProActive Threading Models in Active Objects Local Concurrency Cooperative Single-threaded Multi-threaded Fut<T> resFut = object!method(); awaitresFut?; Let anotherrequestexecute if resFutis not resolved
Translation of an awaitstatement ABS code: current thread (1) (1) Fut<Bool> readyFut = server!start() awaitreadyFut? (2) (2) Translatedduring compilation into: (1) (2) PAFuture.getFutureValue(readyFut) (2) Blocks! # of active threads = 0 @DefineGroups({ @Group(name="scheduling", selfCompatible=true) }) @DefineThreadConfig(threadPoolSize=1, hardLimit=false) publicclass COG { @MemberOf("scheduling") public ABSTypeexecute(…) { } } other thread
Translation of a getstatement ABS code: (1) Fut<Bool> readyFut = server!run() Boolready = readyFut.get (2) Limit = 1 thread in total Translatedduring compilation into: (2) this.getCOG().switchHardLimit(true); Booleanready = PAFuture.getFutureValue(readyFut); this.getCOG().switchHardLimit(false); Blocks all executions! Limit = 1 active thread
Direct Modifications for Distribution • Serialization • Most classes implementsnow "Serializable" • Somefields in COG have been made "transient" • Deployment • Nodespecificationadded in the ABS language Server server = new cog"slaves" Server(); <GCMDeployment> <hosts id="slaves" hostCapacity="1"/> <sshGrouphostList="machine1 machine2" /> </GCMDeployment> <GCMApplication> <virtualNode id="slaves"> <nodeProvidercapacity="4"/> </virtualNode> </GCMApplication> XML files required to configure the application deployment
Conclusion – A FullyWorkingTool • Translation of await on conditions • Customized group with thread limits • Automated compilation & deployment of ABS programs • Usinganttasks & python scripts • Tested on a cluster of 25 machines on the Grid5000 platform await a == True && b == False?; @Group(name="waiting", selfCompatible=true, minThreads=50, maxThreads=50) ABS programs cannowbeeasilydistributed Invited in Oslo university to present the project
PART IIITowardsFaultTolerance of AO A CheckpointingProtocol for MultiActiveObjects
Motivation • Goal • Faulttolerance for MultiactiveObjects • Adaptedcheckpointingprotocol • Challenge • Difficult in mono-threaded active objects • Even more in multiactiveobjects! • Understanding of the threading model BOUM
Example in Mono-threadedMode 3 I Q2 Serv(Q1) Serv(Q2) 3 J Q1 R1 2 3 K
Example Correct Solution 3 I Q2 Serv(Q2) Serv(Q1) 3 J Q1 R1 BIS 3 K
Multi-threaded Mode – Problem checkpointhere? I or here? J K
Guidelines • Use possibilities of MultiactiveObjects • Prioritiescheckpointingrequests • Thread limits flush on goingexecutions Object MultiActiveObject a a.checkpoint() decreaseThreadPoolSize() switchHardLimit(true)
Conclusion COMPLETE Step#1Learn about our active objects ON GOING Step#2Experimentwithotherkind of active objects IN MIND Step#3Build new protocolsaround active objects
Publications • An Optimal BroadcastAlgorithm for Content Addressable Networks • Ludovic Henrio, Fabice Huet, Justine Rochas – OPODIS 2013 • DeclarativeScheduling for Active Objects • Ludovic Henrio, Justine Rochas – SAC 2014 References [1] Active object: an object behavioral pattern for concurrent programming, R.G. Lavender and D. C. Schmidt [2] Multi-threaded Active Objects Ludovic Henrio, Fabrice Huet, Zsolt István – Coordination Models and Languages 2013 [3] ABS: A Core Language for Abstract Behavioral Specification Einar Broch Johnsen, Reiner Hähnle, Jan Schäfer, Rudolf Schlatte, Martin Steffen – FMCO 2012 [4] Creol: A type-safe object-oriented model for distributed concurrent systems EinarBrochJohnsen, Olaf Owe, Ingrid Chieh Yu – FMCO 2006 [5] JCoBox: Generalizing Active Objects to Concurrent Components Jan Schäfer, Arnd Poetzsch-Heffter – ECOOP 2010
Advanced Slides Implementationdetails
awaitstatement on a condition @DefineGroups({ @Group(name="scheduling", selfCompatible=true), @Group(name="waiting", selfCompatible=true, minThreads=50, maxThreads=50) }) @DefineThreadConfig(hardLimit=false, threadPoolSize=51) publicclass COG { @MemberOf("scheduling") public ABSTypeexecute(…) { } @MemberOf("waiting") public ABSTypeawaitCondition(String conditionName, UUID targetObject …){ } } // InvokeconditionNamemethodthatactivelywaits for the condition // This methodisgeneratedwhencompiling
COG Management @DefineGroups({ @Group(name="scheduling", selfCompatible=true), @Group(name="waiting", selfCompatible=true, minThreads=50, maxThreads=50), @Group(name="absmetadata", selfCompatible=true, minThreads=50, maxThreads=50) }) @DefineThreadConfig(hardLimit=false, threadPoolSize=101) publicclass COG { @MemberOf("scheduling") public ABSTypeexecute(…) { } @MemberOf("waiting") public ABSTypeawaitCondition(…){ } @MemberOf("absmetadata") public ABSTypegetObjectByKey(UUID objectID){ } @MemberOf("absmetadata") public ABSTypeswitchHardLimit(booleanhardLimit){ } … } // There isstillonly one // thread for the execution // ABS behaviorispreserved