1 5/30/98lcr ‘98 bbn technologies qos aspect languages and their runtime integration joseph p....
TRANSCRIPT
1 5/30/98 LCR ‘98 BBN Technologies
QoS Aspect Languages and their Runtime Integration
Joseph P. Loyall, David E. Bakken, Richard E. Schantz, John A. Zinky, David A. Karr, and Rodrigo Vanegas
BBN Technologies/GTE InternetworkingCambridge, Massachusetts, USA
http://www.dist-systems.bbn.com/tech/QuO/
Fourth Workshop on Languages, Compilers, and Run-time Systems for Scalable Computers (LCR98)
May 28-30, 1998
Carnegie Mellon University, Pittsburgh, Pennsylvania, USA
2 5/30/98 LCR ‘98 BBN Technologies
Many distributed systems have critical QoS requirements, e.g., real-time performance, fault tolerance, or dependability
CINCJ2
CINC OperationsPlanning Group
OPS/ INTELWORKSTATION
TARGET
CJTFPlanners
TARGET
MissionsCenters of GravityTask refinementForces refinementPhases refinementCOA evaluationCOA selection
FLTCINC MaritimePlanning Center
TMS CASES & HPC
Maritime & AirCampaign Assessment
JOINT FORCE MARITIMECOMPONENT CMDR
CASES TARGET
Task refinementIntegrated Target PrioritiesForces refinementSchedule refinementCOA evaluation
JOINT FORCE AIRCOMPONENT CMDR
TARGET ACPT
IDB
MissionsCOAsStrategy
Crisisassessment
COA evalCOA eval AirMar
XIDB
Target Nomination ListMaster Attack PlanAttack Plan Status
JFACCCombat Ops
Target Nomination ListWeaponeering
XIDB
APS/FLEX
TAMPS/COMPASS
JMCISIDB
Air Tasking Order (ATO)
NATOOPS/INTELWORKSTATION
Rear-echelonSim Center
toSHAPE
MasterTargetList
APS/FLEX RAAP
Refinement& eval
collaborative development
rehearse
Refinement& eval
ATO
Target data / Weaponeering
3 5/30/98 LCR ‘98 BBN Technologies
Distributed object middleware has emerged to solve heterogeneity and distribution problems
Middleware makes programming distributed applications easier
• Standard programming interfaces hide platform and system dependencies
• Standard protocols, e.g., message formats, allow applications on different systems to interoperate
• Middleware provides higher level, application oriented programming building blocks
Host 2
Impl
Host 1
Impl
Applications
Host 2
Simulation
Distributed ObjectMiddleware
Impl
IDLIDL
CollaborativePlanning
IDL
Hosts/Systems
Workflow
4 5/30/98 LCR ‘98 BBN Technologies
Wide-area distributed applications are (still) hard to build and maintain
Current object-oriented middleware is not sufficiently transparent with respect to real-time, fault tolerance, and other non-functional issues, and does not sufficiently accommodate adaptive behavior• WANs are unpredictable, dynamic environments
• Configuration for application changes over time
• Performance and system properties are buried under IDL’s functional interface, so one can’t easilyhelp application adapt to changing environment
reuse code for a new environment
• Programmers end up programming around the middleware to achieve real-time performance, predictability, security, etc.
Host1
Client1
Host2
Client2
Host4
Client3
ObjectResource Constrained
Wide Area Network LANHost3
Client4
5 5/30/98 LCR ‘98 BBN Technologies
Distributed object middleware with QoS extensions is a powerful abstraction layer on which to build applications
Ethernet
TCP/IP QoS
ATM
RSVP
Multicast
Collaborative Planning
WorkFlow
SimulationApplications for geographically dispersed, heterogeneous environments
Distributed objects are the first abstraction layer that unifies CPU, storage, and communications
This interface needs to be hidden from applications
• It is too complicated• It is changing too quickly
CORBA + QuO
6 5/30/98 LCR ‘98 BBN Technologies
System condition objects monitor QoS in the system
• system condition objects recognize changes in the system and notify the contracts that observe them
• QuO contracts notify client programs, users, managers, and other system condition objects through transition behavior
SystemCondition Objects
QuO applications specify, control, monitor, and adapt to QoS in the system
Application
Alternate Implementations
Contract (operating regions)
Servers
Network
ORB
Replication Mgr
Resource ReservationManager
IDS
Specification of operating regions, alternate implementations, and adaptation strategies using QuO’s QDL
Multiple layers of adaptation• managers and mechanisms can
adapt to changes in the system• QuO contracts provide another
layer of adaptation• Client and user can also adapt
Mechanisms and managers control QoS in the system
• a layer below QuO that provides ORB-level services, such as managed communi-cation, replication, or security
• contracts and delegates interface to these services through system condition objects
7 5/30/98 LCR ‘98 BBN Technologies
The QuO designer provides contracts, system condition objects, and delegates in the application
• Contracts summarize the possible states of QoS in the system and behavior to trigger when QoS changes– Regions can be nested, representing different epochs at which QoS information becomes available, e.g., negotiated regions represent the levels of service a client expects to receive and a server expects to provide,
while reality regions represent observed levels of service
– Regions are defined by predicates over system condition objects
– Transitions specify behavior to trigger when the active regions change
• System condition objects are used to measure and control QoS– Provide interfaces to system resources, client and object expectations, mechanisms, managers, and specialized ORB functions
– Changes in system condition objects observed by contracts can cause region transitions
– Methods on system condition objects can be used to access QoS controls provided by resources, mechanisms, managers, and ORBs
• Delegates provide local state for remote objects– Upon method call/return, delegate can check the current contract state and choose behavior based upon the current state of QoS
– For example, delegate can choose between alternate methods, alternate remote object bindings, perform local processing of data, or simply pass the method call or return through
8 5/30/98 LCR ‘98 BBN Technologies
QuO adds QoS control and measurement into the DOC remote method call
Client Network Server
ApplicationDeveloper
Qosketeer
MechanismDeveloper
Logical Method Call Client
Delegate
ORB Proxy
Specialized ORB
ContractSysCond
SysCond
SysCond SysCond
Object
Delegate
ORB Proxy
Specialized ORB
Contract
Network
Mechanism/PropertyManager
SysCond
SysCond
SysCond
9 5/30/98 LCR ‘98 BBN Technologies
Major components of the QuO framework• Quality Description Languages (QDL)
– Analogous to CORBA’s Interface Description Language (IDL)
– Support the specification of QoS contracts
delegates and their adaptive behaviors
connection, creation, and initialization of QuO application components
– QuO includes code generators that parse QDL descriptions and generates Java and C++ code for contracts, delegates, creation, and initialization
• QuO Runtime Kernel– Contract evaluator
– Factory object which instantiates contract and system condition objects
• System Condition Objects– Implemented as CORBA objects
– We have a growing library of system condition objects for reuse
10 5/30/98 LCR ‘98 BBN Technologies
Overview of the QuO architecture
SystemConditions
QuO Runtime System(Java)
Application (C++ or Java)
FunctionalDelegate (C++ or Java)
premethod
postmethod
set client expectation
ORB set object expectation
system event
Contract
11 5/30/98 LCR ‘98 BBN Technologies
Client
Client CodeReference
Delegate
Proxy
Connect Callback
Factory
QuO Kernel
Syscond Syscond
ORB
Contract
Network Control Manager
QuO Kernel
Contract
SC SC
ORB
ORBProxyProxy
Object
1) Client calls delegate
2) Delegate evaluates contract
3) Measurement system conditions are signaled
4) Contract snapshots value of system conditions
5) Contract is re-evaluated
6) Region transitions trigger callbacks
7) Current region is returned
8) If QoS is acceptable, delegate passes the call to the remote object
9) Remote object returns value
10) Contract is re-evaluated...
11) Return value given to client
1
38
112
7
4
5
6
10
Del.
9
Client calls delegate, which triggers contract evaluation and chooses behavior based upon current regions
12 5/30/98 LCR ‘98 BBN Technologies
Overview of Aspect-Oriented Programming
• A program is decomposed functionally into modules, objects, procedures, etc. as usual
• Aspects are programmed separately in special purpose languages– Aspects cross-cut the functional components
– Traditionally are programmed by inserting code in many modules, throughout the system, resulting in a tangled mess of code
– Examples of aspects are synchronization, instrumentation, data structure, QoS
• Code generators weave aspects into the functional modules
13 5/30/98 LCR ‘98 BBN Technologies
AOP enables separation of concerns
class Book { private BookID id; private PostScript ps; private UserID borrower;
public Book(String t, String a, String i, PostScript p) { id = new BookID(t,a,i); ps = p; }
public UserID get_borrower() {return borrower;} public void set_borrower(UserID u) {borrower = u;} public PostScript get_ps() { return ps; } public BookID get_bid() { return id; }}
class BookID { private String title; private String author; private String isbn;
public BookID(String t, String a, String i) { title = t; author = a; isbn = i; } public String get_title() {return title;}}
class User { private UserID id; Library theLibrary; Printer thePrinter;
public User(String n) { id = new UserID(n); }
public boolean getBook (String title) { BookID aBook=null; try{ aBook = theLibrary.getBook(id, title); } catch (RemoteException e) {} try { thePrinter.print(id, aBook); } catch (RemoteException e) {} return true; } public UserID get_uid() { return id; }}
class UserID { private String name;
public UserID(String n) { name = n; } public String get_name() { return name; }}
interface LibraryInterface extends Remote { public BookID getBook(UserID u, String title) throws RemoteException;
public PostScript getBookPS(BookID bid) throws RemoteException;}
class Library extends UnicastRemoteObject implements LibraryInterface { Hashtable books; Library() throws RemoteException { books = new Hashtable(100); } public BookID getBook(UserID u, String title) throws RemoteException { System.out.println("REQUEST TO GET BOOK " + title); if(books.containsKey(title)) { Book b = (Book)books.get(title); System.out.println("getBook: Found it:" + b); if (b != null) { if (b.get_borrower() == null) b.set_borrower(u); return b.get_bid(); } } return null; } public PostScript getBookPS(BookID bid) throws RemoteException { if (books.containsKey(bid.get_title())) { Book b = (Book)books.get(bid.get_title()); if (b != null) return b.get_ps(); } return null; }
}
interface PrinterInterface extends Remote { public boolean print (UserID u, BookID b) throws RemoteException;}
public class Printer extends UnicastRemoteObject implements PrinterInterface { private Vector jobs = new Vector(10, 10); private Library theLibrary;
public Printer() throws RemoteException{} public boolean print (UserID u, BookID b) throws RemoteException{ PostScript ps=null; try{ ps = theLibrary.getBookPS(b); } catch (RemoteException e) {} Job newJob = new Job (ps, u); return queue(newJob); } boolean queue(Job j) { //... return true; }}
“weaver”
public class PrinterImpl { String status = “Idle” Vector jobs;
public PrinterImpl() {} pubilc get_status() { return status } public add_job(int j) { jobs.add(j); }}
class Library { Hashtable books; Library(){ books = new Hashtable(100); } public Book getBook(User u, String title) { System.out.println("REQUEST TO GET BOOK " + title); if(books.containsKey(title)) { Book b = (Book)books.get(title); System.out.println("getBook: Found it:" + b); if (b != null) { if (b.get_borrower() == null) b.set_borrower(u); return b; } } return null; }}
class User { private String name; Library theLibrary; Printer the; Printer
public User(String n) { name = n; }
public boolean getBook (String title) { Book aBook = theLibrary.getBook(this, title); thePrinter.print(this,aBook); return true; }}
class Book { private String title; private String author; private String isbn; private PostScript ps; private User borrower;
public Book(String t, String a, String i, PostScript p) { title = t; author = a; isbn = i; ps = p; }
public User get_borrower() {return borrower;} public void set_borrower(User u) {borrower = u;} public PostScript get_ps() { return ps; }}
portal Printer { void print(Book book) { book: Book: {direct pages;}
}
portal Library { Book find (String title){ return: Book: {copy title, author, isbn;} }}
4 classes
2 aspects
class Book { private BookID id; private PostScript ps; private UserID borrower;
public Book(String t, String a, String i, PostScript p) { id = new BookID(t,a,i); ps = p; }
public UserID get_borrower() {return borrower;} public void set_borrower(UserID u) {borrower = u;} public PostScript get_ps() { return ps; } public BookID get_bid() { return id; }}
class BookID { private String title; private String author; private String isbn;
public BookID(String t, String a, String i) { title = t; author = a; isbn = i; } public String get_title() {return title;}}
class User { private UserID id; Library theLibrary; Printer thePrinter;
public User(String n) { id = new UserID(n); }
public boolean getBook (String title) { BookID aBook=null; try{ aBook = theLibrary.getBook(id, title); } catch (RemoteException e) {} try { thePrinter.print(id, aBook); } catch (RemoteException e) {} return true; } public UserID get_uid() { return id; }}
class UserID { private String name;
public UserID(String n) { name = n; } public String get_name() { return name; }}
interface LibraryInterface extends Remote { public BookID getBook(UserID u, String title) throws RemoteException;
public PostScript getBookPS(BookID bid) throws RemoteException;}
class Library extends UnicastRemoteObject implements LibraryInterface { Hashtable books; Library() throws RemoteException { books = new Hashtable(100); } public BookID getBook(UserID u, String title) throws RemoteException { System.out.println("REQUEST TO GET BOOK " + title); if(books.containsKey(title)) { Book b = (Book)books.get(title); System.out.println("getBook: Found it:" + b); if (b != null) { if (b.get_borrower() == null) b.set_borrower(u); return b.get_bid(); } } return null; } public PostScript getBookPS(BookID bid) throws RemoteException { if (books.containsKey(bid.get_title())) { Book b = (Book)books.get(bid.get_title()); if (b != null) return b.get_ps(); } return null; }
}
interface PrinterInterface extends Remote { public boolean print (UserID u, BookID b) throws RemoteException;}
public class Printer extends UnicastRemoteObject implements PrinterInterface { private Vector jobs = new Vector(10, 10); private Library theLibrary;
public Printer() throws RemoteException{} public boolean print (UserID u, BookID b) throws RemoteException{ PostScript ps=null; try{ ps = theLibrary.getBookPS(b); } catch (RemoteException e) {} Job newJob = new Job (ps, u); return queue(newJob); } boolean queue(Job j) { //... return true; }}
• Traditional: Code to handle different data representations is tangled throughout the classes
• Aspect-oriented: Program is divided into classes and aspects; a code weaver puts them together
Figures copyright 1997, 1998 Xerox Corporation
14 5/30/98 LCR ‘98 BBN Technologies
QuO’s aspect languages, aka Quality Description Languages (QDL)
• Contract Description Language (CDL) – expected regions of QoS
– reality regions of QoS
– transitions for adapting to changing levels of service
• Structure Description Language (SDL) – behavior alternatives for remote objects and their delegates
– alternate bindings and connection strategies
• Resource Description Language (RDL) – available system resources and their status
Implementation
CDL SDL RDL
QDLIDL
QDL + IDLCompiler
QuOapplication
QuO Runtime
ORB
15 5/30/98 LCR ‘98 BBN Technologies
Measured capacity >= 10
As_expected:
Insufficient_resources:Measured capacity < 10
Contracts summarize system conditions into negotiated and reality regions and define transitions between them• Negotiated regions represent the expected behavior of client and server objects, and reality regions represent observed system behaviors
• Predicates using system condition objects determine which regions are valid
• Transitions occur when a region becomes invalid and another becomes valid
• Transitions might trigger adaptation by the client, object, ORB, or system
Normal:Expected capacity >= 10
Degraded:Expected capacity < 10Expected capacity >= 2
As_expected:
Extra_resources:
Measured capacity < 10Measured capacity >= 2
Measured capacity < 2Insufficient_resources:
Measured capacity >= 10
Unusable:Expected capacity < 2
As_expected:
Extra_resources:
Measured capacity < 2
Measured capacity >= 2
= Expected Region
= Reality Region
16 5/30/98 LCR ‘98 BBN Technologies
Quality Description Languages for specifying operating regions and adaptive behaviors
CORBA IDLtypedef sequence<long> LongSeq;interface Targeting { long calculate_distance_to_target(in long xcoord, in long ycoord); long identify_target(in long xcoord, in long ycoord);};
CodeGenerators
CodeGenerators
contract Replication( object client, object server ) is ... negotiated regions are region Low_Cost : ... region Available : when client.expectations.requested > 1 => reality regions are region Too_Low : when measured <= 1 => region Normal : when measured > 1 => transitions are transition any->Too_Low : client.callbacks.availability_degraded(); transition any->Normal : client.callbacks.availability_back_to_normal(); ... transitions are ...end Replication;
delegate behavior for Targeting and repl_contract is obj : bind Targeting with name SingleTargetingObject; group : bind Targeting with characteristics { Replicated = True };
call calculate_distance_to_target : region Available.Normal : pass to group; region Low_Cost.Normal : pass to obj; region Available.TooLow : throw AvailabilityDegraded; return calculate_distance_to_target : pass_through; default : pass_throughend delegate behavior; SDL
QuO RuntimeQuO Runtime
ContractDelegate
CDL
17 5/30/98 LCR ‘98 BBN Technologies
CDL contract to control object replicationcontract Replication( object client, object server ) is var measured : measured_replication init(); negotiated regions are region Low_Cost : when client.expectations.requested == 1 => reality regions are region Too_Low : when measured == 0 => region Normal : when measured == 1 => region Too_High : when measured > 1 => transitions are transition any->Too_Low : client.callbacks.availability_degraded(); transition any->Normal : client.callbacks.availability_back_to_normal(); end transitions; end reality regions; region High_Avail : when client.expectations.requested > 1 => reality regions are region Too_Low : when measured <= 1 => region Normal : when measured > 1 => transitions are transition any->Too_Low : client.callbacks.availability_degraded(); transition any->Normal : client.callbacks.availability_back_to_normal(); end transitions; end reality regions; transitions are transition Low_Cost->High_Avail : adjust_degree_of_replication(client.expectations.requested); transition High_Avail->Low_Cost : adjust_degree_of_replication(client.expectations.requested); end transitions; end negotiated regions;end Replication;
18 5/30/98 LCR ‘98 BBN Technologies
SDL code that supports choosing between replicated and non-replicated server objects
delegate behavior for Targeting and repl_contract is
obj : bind Targeting with name SingleTargetingObject;
group : bind Targeting with characteristics { Replicated = True };
call calculate_distance_to_target :
region Available.Normal :
pass to group;
region Low_Cost.Normal :
pass to obj;
region Available.TooLow :
throw AvailabilityDegraded;
return calculate_distance_to_target :
pass_through;
default : pass_through
end delegate behavior;
• SDL supports choosing between objects, choosing between methods, run-time binding, exceptions, and embedded Java or C++ code.
19 5/30/98 LCR ‘98 BBN Technologies
Status of QuO
• QuO version 0.5 (internal release only) done, including the QuO kernel; two aspect languages, CDL and SDL, and their code generators, i.e., weavers; and a small library of system condition objects
• Currently working on two prototype applications of QuO– AQuA, which addresses availability through object replication
– DIRM, which addresses managed communication through resource reservation
• Continuing development of the QuO framework– Multiple contracts, layering of delegates, contracts on the client and the server side
– Further SDL development, including connection generation, and RDL
– More example applications, libraries of system condition objects