430 likes | 566 Views
CHAIMS: A Reuse and Composition System for Services. Neal Sample Stanford University Objective: Investigate new approaches to large-scale software composition .
E N D
CHAIMS: A Reuse and Composition System for Services Neal Sample Stanford University Objective:Investigate new approaches tolarge-scale software composition. Approach:Develop and validate a composition-only language (CLAM), a protocol for large, distributed, heterogeneous and autonomous megamodules (CPAM), and a supporting system. CHAIMS
Shift in Programming Tasks Integration, Composition, Reuse Coding 1970 1990 2010 CHAIMS
Composition of Processes... • versus composition and integration of Components • reusing small components (copy/paste, shared library, local install, etc.) • large distributed components within same “domain” (e.g. within one bank or airline) CHAIMS
Purchasing Local Components Distributor e Domain expert, Programmers local computer or local distributed system and copy purchase I/O I/O c e a b d CHAIMS
Composition of Processes... • versus composition and integration of Components • reusing small components (copy/paste, shared library, local install, etc.) • large distributed components within same “domain” (e.g. within one bank or airline) • versus composition and integration of Data • data-warehouses • wrapping data available on the web CHAIMS
Data Resources Accessing Remote Data Domain expert, Programmers local computer or local distributed system I/O I/O Control & Computation Services c c l i e n t e a b d Wrappers s e r v e r s CHAIMS
Composition of Processes... • versus composition and integration of Components • reusing small components (copy/paste, shared library, local install, etc.) • large distributed components within same “domain” (e.g. within one bank or airline) • versus composition and integration of Data • data-warehouses • wrapping data available on the web CHAIMS/CLAM: • compose remote autonomous services CHAIMS
Domain expert Client workstation IO module IO module e b a d c Accessing Remote Services c l i e n t s data control s e r v e r s at provider's sites CHAIMS
Domain expert Client workstation Domain expert Client workstation IO module IO module IO module IO module e b a d c Accessing Remote Services c l i e n t s data control s e r v e r s at provider's sites CHAIMS
Domain expert Client workstation Domain expert Client workstation Domain expert Client workstation IO module IO module IO module IO module IO module IO module e b a d c Accessing Remote Services c l i e n t s data control s e r v e r s at provider's sites CHAIMS
Data Resources Composing Computational Services Domain expert Client workstation c l i e n t IO module IO module CPAM and distribution systems data control s e r v e r s at provider's sites e b Remote Computation Services Megamodules a d c CHAIMS
Example of Remote Services Bio-informatics: • several research institutes develop algorithms for modeling and matching molecule structures • several knowledge bases available, many of them with additional computational services • a scientist has to combine several of these processing units to produce desired result CHAIMS
Typical Scenario: Logistics A general has to ship troops and/or various material from Los Angeles to Washington DC: • different kind of material: criteria for preferred transport differ • not every airport equally suited • congestion, prices • actual weather • certain due or ready dates Today: calling different companies, looking up information on the web, reservations by hand • hand-coded systems Tomorrow: system proposes possibilities that take into account various conditions • composition of processes CHAIMS
Advantages Knowledge • separation of concerns (provider - composer) • technical expertise (databases …) • maintenance, newest algorithms Availability • pay per usage instead of pay per instance • lower barrier for clients to try out new modules • choice of several providers even at run-time Resources • access to computation intensive modules for everybody • minimal local resources possible Yet there are alsochallenges... Advantages of reuse by accessing remote services: CHAIMS
Challenge: Computation Intensive Services What we would like: ==>exploitingparallelism among services without complex coding on client side ==>partialextraction of results when they are ready ==>progressiveextraction of results ==>monitoring progress of service invocation and results ==>cost estimation prior to invocation of a service for possibility to choose cheapest or fastest service Services are not free for a client: • execution time of a service • transfer time and fee for data • fees for services CHAIMS
Challenge: Autonomy Separation of control==> client has no direct control over: • availability of services • resources provided for services Heterogeneity: • heterogeneityconcerning languages, platforms as well as distribution protocols • legacy code, applications and libraries CHAIMS
Challenge: Composition Task Services must somehow be composed on the client-side • automated: generation of effective access code • composition-oriented: composition only language or interface • easy: simple for domain experts to use CHAIMS
Megamodule Provider provides megamodules client side server side Wrapper Templates adds information to CHAIMS Repository b d e a c MEGA Modules CPAM protocol Distribution Systems (CORBA, RMI…) CHAIMS Architecture Composer interacts with other language or interpreter or incremental programming CHAIMS
Implementation of CPAM On top of various protocols: • RMI, CORBA, DCE, plain TCP/IP, http • each primitive is a procedure call, or a pair of XML messages • or mimicked by other interfaces: SWAP, several methods Method parameters: • simple data element, or recursive structure of data elements • each data element has also type and descriptive name information • encoding: now ASN.1, future XML • either megamodule conformity or ontology mediator megamodules Wrappers for CPAM compliance: • asynchrony and state management (client-specific parameters, results) • progress information and cost estimation • data encoding CHAIMS
Megamodule Provider Composer provides megamodules client side server side writes Wrapper Templates CLAM program adds information to CHAIMS Compiler CHAIMS Repository b d generates e a Client Side Run Time c MEGA Modules CPAM protocol Distribution Systems (CORBA, RMI…) CHAIMS Architecture CHAIMS
Architecture: CLAM andCHAIMS-Protocols Megaprogrammer CLAM Megaprogram Compiler/Interpreter CHAIMS-protocols CORBA-idl DCE-idl Java-class M e g a m o d u l e s CHAIMS
CLAM Primitives Pre-invocation: SETUP: set up the connection to a megamodule SET-, GETPARAM: in a megamodule ESTIMATE: for optimization Invocation and result gathering: INVOKE EXAMINE: test progress of an invoked method EXTRACT: extract results from an invoked method Termination: TERMINATE: terminate a method invocation/connection to a megamodule Control: WHILE, IF CHAIMS
Pre-invocation: SETUP • Establish communication between client CLAM program and a megamodule • Returns a megamodule handle • Maps logical name of service to provider • ex: mm_handle = SETUP (“TransportationModule”) • CLAM programmers avoid module location and transportation protocol issues • Authentication occurs here (open question). CHAIMS
Pre-invocation: ESTIMATE • Returns cost of a method invocation in terms of fee, time, and data volume • Considers values of method parameters • ESTIMATE for runtime module selection • Useful for scheduling and cost minimization. CHAIMS
SETUP () SETPARAM (attributes essential for cost estimation) (f1=fee, t1=time) = ESTIMATE (“Optimum”) SETUP () SETPARAM (attributes essential for cost estimation) (f2=fee, t2=time) = ESTIMATE (“BestRoute”) time BestPick.INVOKE (“BestRoute”, …) Cost Estimation for Selection Choosing megamodules: C H A I M S c l i e n t RouteChoose - Optimum - … BestPick - BestRoute - ... calculate cost function ==> today BestPick is better CHAIMS
Pre-invocation: SET-, GETPARAM • GET-: returns current parameter values • SET -: overrides current parameter values • Operates on a megamodule handle • ex: mm_handle.SETPARAM (city = “Amsterdam”) • Utility • presetting for ESTIMATE • avoid resetting with repeated invocations • simple input perturbation. CHAIMS
Hierarchical Setting of Parameters Example: parameters of method TripPlan end-date start- date number from dest general default values 1JAN1998 1JAN1998 LAS BWI 1 client-specific settings for client A 4OCT1998 6OCT1998 SJO ZRH client-specific settings for client B FRA 2 method TripPlan, client A: invocation-specific settings actual values used in invocation TripPlan1 4OCT1998 6OCT1998 SJO ZRH 1 method TripPlan, client A: invocation-specific settings 7OCT1998 SFO actual values used in invocation TripPlan2 4OCT1998 7OCT1998 SFO ZRH 1 method TripPlan, client B: invocation-specific settings 1DEC1998 9DEC1998 actual values used in invocation TripPlan1 1DEC1998 9DEC1998 LAS FRA 2 CHAIMS
CLAM Primitives Pre-invocation: SETUP: set up the connection to a megamodule SET-, GETPARAM: in a megamodule ESTIMATE: for optimization Invocation and result gathering: INVOKE EXAMINE: test progress of an invoked method EXTRACT: extract results from an invoked method Termination: TERMINATE: terminate a method invocation/connection to a megamodule Control: WHILE, IF CHAIMS
Invocation: INVOKE • Starts execution of a method • Operates on a megamodule handle • Returns an invocation handle • ex: in_handle = mm_handle.INVOKE (“GenericMethod”) in_handle = mm_handle.INVOKE (“RoutePlanMethod”, Pair_of_Cities = cities) • Achieves asynchrony in sequential clients. CHAIMS
Invocation: EXAMINE • Determines the state of a invocation • Operates on an invocation handle • Returns: • (status, “progress information”) • status = {DONE, NOT_DONE, PARTIAL, ERROR} • Utility • Progressive extractions • Partial extractions • Optimized module execution scheduling • Steering. CHAIMS
Invocation: EXAMINE quick_route: found at time 30 optimal_route: found at time 100 • Method Status: WHILE (in_handle.EXAMINE() != DONE) {} (routeVar = quick_route) = in_handle.EXTRACT() • Attribute Status: WHILE (in_handle.EXAMINE(quick_route) != DONE) {} (routeVar = quick_route) = in_handle.EXTRACT() • Steering: IF (in_handle.EXAMINE(quick_route) != PARTIAL) … ask user (or scheduler) to continue or halt… CHAIMS
Invocation: EXTRACT • Collects data from a megamodule method • Operates on an invocation handle • Returns: assignment of values to parameters • ex: (routeVar = quick_route) = in_handle.EXTRACT() • Allows partial data retrieval • saves volume: abandon uninteresting elements • saves time: termination of useless invocation • Allows progressive data retrieval. CHAIMS
CLAM Data Types • Simple data types still have a role • opaque //exclusively used for user data • integer • string • Boolean • real • No classes or amalgamated types • Only be assigned and compared • Used for control (not opaque) CHAIMS
CLAM Primitives Pre-invocation: SETUP: set up the connection to a megamodule SET-, GETPARAM: in a megamodule ESTIMATE: for optimization Invocation and result gathering: INVOKE EXAMINE: test progress of an invoked method EXTRACT: extract results from an invoked method Termination: TERMINATE: terminate a method invocation/connection to a megamodule Control: WHILE, IF CHAIMS
TERMINATE • Ends method invocation or closes a connection to a megamodule • Why necessary? • delayed extractions • repeated/progressive extractions • partial extractions • early termination • ex: in_handle.TERMINATE () mm_handle.TERMINATE () CHAIMS
CLAM Composition Language Purely compositional: • no primitives for arithmetic • no primitives for input/output Splitting up CALL-statement: • parallelism by asynchrony in sequential program • novel possibilities for optimizations • reduction of complexity of invoke statements Higher-level language: • assembler => HLLs, • HLLs => composition/megamodule paradigm CHAIMS
Ongoing & Upcoming Research Issues c o m p o s i t i o n composition wizard optimization of compositions automatedcomposition graphicalcomposition automatedscheduling ofinvocations incrementalcomposition repositorybrowser CLAM cost estimation directoryservices Repository CPAM incrementalresult extraction electronic marketplaceof services repositoryin XML, ... exploitingXML web-services sign-up andauthentication direct dataflowsbetween megamodules CHAIMS broker e - c o m m e r c e p r o t o c o l CHAIMS
Conclusion • New reuse model • computational modules stay at provider’s site • reuse of computational modules by accessing computational services over the internet • New issues • cost-estimation, progress monitoring • easy and efficient composition of remote, computation-intensive services CHAIMS
Questions? http://www-db.stanford.edu/CHAIMS/ CHAIMS
Other Approaches Traditional Languages/Extensions • FX: Self-contained language for module building composition. Much finer grain than service composition. • Orca, Opus: Extensions to HPF. Programmers require intimate knowledge of all process data. Composition Languages • MANIFOLD: Similar IWIM model, with black box process • Myriad scripting languages, generally assume complete ontological control of services CHAIMS
Megaprogram Example: Code io_mmh = SETUP ("InputOutput") route_mmh = SETUP ("RouteInfo") ... best2_mmh.SETATTRIBUTES (criterion = "cost") cities_default = route_mmh.GETPARAM(Pair_of_Cities) input_cities_ih = io_mmh.INVOKE ("input”, cities_default) WHILE (input_cities_ih.EXAMINE() != DONE) {} cities = input_cities_ih.EXTRACT() ... route_ih = route_mmh.INVOKE ("AllRoutes", Pair_of_Cities = cities) WHILE (route_ih.EXAMINE() != DONE) {} routes = route_ih.EXTRACT() … IF (best1_mmh.ESTIMATE("Best_Route") < best2_mmh.ESTIMATE("Optimum") ) THEN {best_ih = best1_mmh.INVOKE ("Best_Route", Goods = info_goods, Pair_of_Cities = cities, List_of_Routes = routes, Cost_Ground = cost_list_ground, Cost_Air = cost_list_air)} ELSE {best_ih = best2_mmh.INVOKE ("Optimum", Goods = info_goods, … ... best2_mmh.TERMINATE() // Setup connections to megamodules. // Set global variables valid for all invocations // of this client. // Get information from the megaprogram user // about the goods to be transported and about // the two desired cities. // Get all routes between the two cities. //Get all city pairs in these routes. //Calculate the costs of all the routes. // Figure out the optimal megamodule for // picking the best route. //Pick the best route and display the result. // Terminate all invocations CHAIMS
Data objects: Gentype bags Minimal Typing within CHAIMS: Integer, Boolean only for control All else is placed into an ASN.1 bag, transparent to compiler : A Gentype is a triple of name, type and value, where value is either a simple type or a list of other gentypes (i.e. a complex type). Simple types: given by ASN.1, the ASN.1-conversion library for C++, our own conversion routines. Example: Person_Information Name of Person complex Personal Data complex Address First Name string Joe Last Name string Smith Date of Birth date 6/21/54 Soc.Sec.No string 345-34-3456 CHAIMS
Scheduling: Simple Example 1 cost_ground_ih = cost_mmh.INVOKE ("Cost_for_Ground", 1 List_of_City_Pairs = city_pairs,Goods = info_goods) 2 WHILE (cost_ground_ih.EXAMINE() != DONE) {} 3 cost_list_ground = cost_ground_ih.EXTRACT() 3 cost_air_ih = cost_mmh.INVOKE ("Cost_for_Air", 2 List_of_City_Pairs = city_pairs,Goods = info_good) 4WHILE (cost_air_ih.EXAMINE() != DONE) {} 4 cost_list_air = cost_air_ih.EXTRACT() order in unscheduled megaprogram order in automatically prescheduled megaprogram CHAIMS