Active Objects & Co.
description
Transcript of Active Objects & Co.
![Page 1: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/1.jpg)
Active Objects & Co.First Year PhD Assessment
Justine Rochas
PhD subjectProgramming Model and Middleware Support for
Distributed and Concurrent Application
AdvisorLudovic Henrio
TeamScale (I3S-INRIA)
1 / 34
![Page 2: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/2.jpg)
AGENDA
PART I – A Step into MultiActive Objects
PART II – What do others do ? The ABS case
PART III – Towards fault tolerance of Active Objects
PAST
PRESENT
FUTURE
2 / 34
![Page 3: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/3.jpg)
Active Object a
Active Objects [1]Request queue
Execution thread
Request
bar()
a.bar()
Asynchronous method calls / requests with futures
No concurrency between requests
The ProActive Java library = active objects using Java syntax
3 / 34
![Page 4: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/4.jpg)
Active Object Creation in ProActive
T a = newActive(T.class, params…, node2)// a: local reference to the proxy of ra
node1 node2
active object o
object a(proxy to ra)
active object ra
local referenceremote reference
objectactive object
on node1, active object a does:
4 / 34
![Page 5: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/5.jpg)
Method calls in ProActiveP param1, param2 = … ;T a = newActive(T.class, params…, node2)V res = a.bar(param1, param2); // Same syntax as a local callres.foobar(); // Wait-by-necessity if res is not resolved
node1 node2
a
param2param1 copy ofparam2
copy ofparam1
res
ra
on node1, active object a does:
bar
bar
o
5 / 34
![Page 6: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/6.jpg)
PART IA Step into MultiActive Objects Priorities and threading mechanisms for MultiActive Objects
6 / 34
![Page 7: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/7.jpg)
MultiActive Objects [2] – Principle
Multiactive Object o
Thread pool
Execute multiple requests at the same time locally
In a controlled way7 / 34
![Page 8: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/8.jpg)
M.A.O. – Language & Scheduling
Multiactive Object o
@DefineGroups({ @Group(name="routing", selfCompatible=true), @Group(name="monitoring", selfCompatible=true)})@DefineRules({ @Compatible({"routing","monitoring"})})
class O { @MemberOf("routing") Value lookup(Key k) { … }
@MemberOf("monitoring") void log(String m) { … }}
8 / 34
![Page 9: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/9.jpg)
M.A.O. – Extended featuresReceive requests
Apply Compatibilities Filter
Apply Priorities Reorder
Execute requests
Apply Threading policies Filter again
Busy threads!
9 / 34
![Page 10: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/10.jpg)
Priority Specification Mechanism
G1 @DefinePriorities ({ @PriorityOrder({ @Set(groupNames = {"G1"}), @Set(groupNames = {"G2"}), @Set(groupNames = {"G5","G4"}) }), @PriorityOrder({ @Set(groupNames = {"G3"}), @Set(groupNames = {"G2"}) }) })
G2
G3
G4G5
Declarative Scheduling for Active Objects, L. Henrio, J. Rochas, 29th Symposium on Applied Computing (SAC 2014)
incomingrequest
R2
R4 R3 R1
Priorities are automatically taken into account in the
scheduling policy
High priority
Low priority
dependency
dependency
10 / 34
![Page 11: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/11.jpg)
Thread Management Mechanisms (1)
@DefineThreadConfig(threadPoolSize=1, hardLimit=false)
V v = o.bar(); (1)v.foo(); (2)
(1) current thread state = active(2) current thread state = waiting
current thread
otherthread
(1) (2)
11 / 34
![Page 12: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/12.jpg)
Thread Management Mechanisms (2)
@Group(name=" routing ", minThreads=2, maxThreads=5)
Enable high level implementation of scheduling patterns
max
Thread pool
min Threads never used by other groups
Threads never used by the routing group
routing
12 / 34
![Page 13: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/13.jpg)
PART IIWhat do others do? The ABS caseA Translator to Distribute ABS Programs using ProActive
13 / 34
![Page 14: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/14.jpg)
Motivation
ProActive – Multiactive Objects
ABS – Abstract Behavioral Spec. Language
Deployment of distributed applications ✔
Modeling of distributed applications ✔
OBJECTIVEProvide distributed deployment to ABS
using ProActive
14 / 34
![Page 15: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/15.jpg)
Background – ABS [3]
Characteristics of ABS
COGs (set of objects)
Cooperative scheduling
Java translator
No support for distribution yet
COG
COG
obj
obj
call()
View of an ABS program with 6 objects and 2 COGs
await fut?;
obj
obj
obj
obj
15 / 34
![Page 16: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/16.jpg)
Active Object Models
Active objects only
Creol [4]
A lot of threads
Active & passive objects
ASP/ProActive
Complex semantic but scales
Object Group Model JCoBox [5], ABS
A lot of global references to manage if not in shared-memory
All objects are accessible
One thread for many objects
Uniform Model Non Uniform Model
Example of ABS program
Server server = new cog Server();ID serverId = server!getId();// serverId is a direct reference// to an object in another COG
16 / 34
![Page 17: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/17.jpg)
Toward translation of ABS in ProActive
Select active objects COG = ProActive active object Entry point to the local memory space
Hierarchical indexing of objects① COG registry (RMI) Global index via the networkObject URL @COG1 @COG2 … …Object cog1 cog2 … …
Object ID ID1 ID2 … …Object ref o1 o2 … …
② Object registry (in a COG) Local index via shared memory
17 / 34
![Page 18: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/18.jpg)
Translation of a new cog statement
Server server = new Server() (1)COG cog = newActive(COG.class, {}, node2) (2)cog.registerObject(server) (3)
node1 node2
main cog server remote server
cog
Server server = new cog Server()ABS code:
Translated during compilation into:
(1)
(2) (2)
(3)
cog (proxy)
18 / 34
![Page 19: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/19.jpg)
Explicit vs Transparent
ABS Explicit asynchronous
calls
Explicit futures
ProActive Transparent asynchonous
calls
Transparent first class futures
object.method() // synchronousobject!method() // asynchronous
Fut<T> future = object!method();T t = future.get; // blocks
object.method() // synchronous or asynchronous
T future = object.method();
19 / 34
![Page 20: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/20.jpg)
node1 node2
Translation of an async. method call
server.getCog().execute("start", {}, server.getID())
main cog server remoteserver
cog
server!start()ABS code:
Translated during compilation into:
cog (proxy)
COG
Object IDObject
ref
Objects registry
execute =1-retrieve object with id2-run by reflection
getCog
startexecute
execute
20 / 34
![Page 21: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/21.jpg)
node1 node2
Async. Method Call with Parameters
server.getCog().execute("start", {param1, param2}, server1.getID())
main cog server remote server
server!start(param1, param2)ABS code:
Translated during compilation into:
cog (proxy)
param1
param2
copy ofparam1
copy ofparam2 main cog
proxies
start
execute
execute
getCog
cog
21 / 34
![Page 22: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/22.jpg)
Threading Models in Active Objects
ProActiveSingle-threaded Cooperative Multi-threaded
MultiActive Objects(extended ProActive)
Fut<T> resFut = object!method();await resFut?;
Let another request execute if resFut is not resolved
Local Concurrency
Creol
JCoBox
ABS
22 / 34
![Page 23: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/23.jpg)
Translation of an await statement
@DefineGroups({ @Group(name="scheduling", selfCompatible=true)})@DefineThreadConfig(threadPoolSize=1, hardLimit=false)public class COG { @MemberOf("scheduling") public ABSType execute(…) { }}
PAFuture.getFutureValue(readyFut)
ABS code:
Translated during compilation into:
(1)(2)
(2)Blocks!
Fut<Bool> readyFut = server!start()await readyFut?
(1)(2)
23 / 34
current thread
otherthread
(1) (2)
# of active threads = 0
![Page 24: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/24.jpg)
Translation of a get statement
this.getCOG().switchHardLimit(true);Boolean ready = PAFuture.getFutureValue(readyFut);this.getCOG().switchHardLimit(false);
Fut<Bool> readyFut = server!run()Bool ready = readyFut.get
ABS code:
Translated during compilation into:
(1)(2)
(2)
Limit = 1 thread in total
Limit = 1 active thread
Blocks all executions!
24 / 34
![Page 25: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/25.jpg)
Direct Modifications for Distribution
Serialization Most classes implements now "Serializable" Some fields in COG have been made "transient"
Deployment Node specification added in the ABS language
Server server = new cog "slaves" Server();
<GCMApplication> <virtualNode id="slaves"> <nodeProvider capacity="4"/> </virtualNode></GCMApplication>
<GCMDeployment> <hosts id="slaves" hostCapacity="1"/> <sshGroup hostList="machine1 machine2" /></GCMDeployment>
XML files required to configure the application deployment25 / 34
![Page 26: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/26.jpg)
Conclusion – A Fully Working Tool Translation of await on conditions
Customized group with thread limits
Automated compilation & deployment of ABS programs Using ant tasks & 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 can now be easily distributedInvited in Oslo university to present the project
26 / 34
![Page 27: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/27.jpg)
PART IIITowards Fault Tolerance of AOA Checkpointing Protocol for MultiActive Objects
27 / 34
![Page 28: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/28.jpg)
Motivation
Goal Fault tolerance for Multiactive Objects Adapted checkpointing protocol
Challenge Difficult in mono-threaded active objects Even more in multiactive objects! Understanding of the threading model
BOUM
28 / 34
![Page 29: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/29.jpg)
Example in Mono-threaded Mode
I
3
Q2
3
J
32K
R1Q1
Serv(Q1) Serv(Q2)
29 / 34
![Page 30: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/30.jpg)
Example Correct Solution
I
3
Q2
3
J
3K
R1 BISQ1
Serv(Q1) Serv(Q2)
30 / 34
![Page 31: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/31.jpg)
I
Multi-threaded Mode – Problem
J
K
checkpoint here?
or here?
31 / 34
![Page 32: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/32.jpg)
Guidelines
Use possibilities of Multiactive Objects Priorities checkpointing requests Thread limits flush on going executions
MultiActive Object aObject
a.checkpoint()
switchHardLimit(true)decreaseThreadPoolSize()
32 / 34
![Page 33: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/33.jpg)
Conclusion
Step#1 Learn about our active objects
Step#2 Experiment with other kind of active objects
Step#3 Build new protocols around active objects
COMPLETE
ON GOING
IN MIND
33 / 34
![Page 34: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/34.jpg)
[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 Einar Broch Johnsen, Olaf Owe, Ingrid Chieh Yu – FMCO 2006[5] JCoBox: Generalizing Active Objects to Concurrent Components Jan Schäfer, Arnd Poetzsch-Heffter – ECOOP 2010
Publications
34 / 34
References
• An Optimal Broadcast Algorithm for Content Addressable Networks Ludovic Henrio, Fabice Huet, Justine Rochas – OPODIS 2013 • Declarative Scheduling for Active Objects Ludovic Henrio, Justine Rochas – SAC 2014
![Page 35: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/35.jpg)
35
Advanced SlidesImplementation details
![Page 36: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/36.jpg)
36
await statement on a condition@DefineGroups({ @Group(name="scheduling", selfCompatible=true), @Group(name="waiting", selfCompatible=true, minThreads=50, maxThreads=50)})@DefineThreadConfig(hardLimit=false, threadPoolSize=51)
public class COG {
@MemberOf("scheduling") public ABSType execute(…) { }
@MemberOf("waiting") public ABSType awaitCondition(String conditionName, UUID targetObject …){
}}
// Invoke conditionName method that actively waits for the condition// This method is generated when compiling
![Page 37: Active Objects & Co.](https://reader035.fdocuments.net/reader035/viewer/2022081507/56816385550346895dd46cb5/html5/thumbnails/37.jpg)
37
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)public class COG { @MemberOf("scheduling") public ABSType execute(…) { } @MemberOf("waiting") public ABSType awaitCondition(…){ } @MemberOf("absmetadata") public ABSType getObjectByKey(UUID objectID){ } @MemberOf("absmetadata") public ABSType switchHardLimit(boolean hardLimit){ } …}
// There is still only one // thread for the execution// ABS behavior is preserved