D EPARTMENT OF C OMPUTER S CIENCES Computation Orchestration Jayadev Misra Department of Computer Science University of Texas at Austin Email: misra@cs.utexas.edu web: http://www.cs.utexas.edu/users/psp Collaborators: William Cook, Tony Hoare, Galen Menzel U NIVERSITY OF T EXAS AT A USTIN 0
D EPARTMENT OF C OMPUTER S CIENCES Example: Airline � Contact two airlines simultaneously for price quotes. � Buy ticket from either airline if its quote is at most $300. � Buy the cheapest ticket if both quotes are above $300. � Buy any ticket if the other airline does not provide a timely quote. � Notify client if neither airline provides a timely quote. U NIVERSITY OF T EXAS AT A USTIN 1
D EPARTMENT OF C OMPUTER S CIENCES Example: workflow � An office assistant contacts a potential visitor. � The visitor responds, sends the date of her visit. � The assistant books an airline ticket and � After hearing from the airline and any of the hotels: contacts two hotels for reservation. � The visitor sends a confirmation which the assistant notes. he tells the visitor about the airline and the hotel. U NIVERSITY OF T EXAS AT A USTIN 2
D EPARTMENT OF C OMPUTER S CIENCES Example: workflow, contd. � confirms hotel and airline reservations. After receiving the confirmation, the assistant � reserves a room for the lecture. � announces the lecture by posting it at a web-site. � requests a technician to check the equipment in the room. U NIVERSITY OF T EXAS AT A USTIN 3
D EPARTMENT OF C OMPUTER S CIENCES Wide-area Computing Acquire data from remote services. Calculate with these data. Invoke yet other remote services with the results. Additionally Invoke alternate services for failure tolerance. Repeatedly poll a service. Ask a service to notify the user when it acquires the appropriate data. Download an application and invoke it locally. Have a service call another service on behalf of the user. U NIVERSITY OF T EXAS AT A USTIN 4
D EPARTMENT OF C OMPUTER S CIENCES The Nature of Distributed Applications Three major components in distributed applications: Persistent storage management databases by the airline and the hotels. Specification of sequential computational logic does ticket price exceed $300? Methods for orchestrating the computations contact the visitor for a second time only after hearing from the airline and one of the hotels. We look at only the third problem. U NIVERSITY OF T EXAS AT A USTIN 5
D EPARTMENT OF C OMPUTER S CIENCES Related Models and Languages � Process Calculi: CSP � -calculus, Join Calculus � Petri Net � Statechart , CCS, � Programming Languages � -calculus ! : Based on Join Calculus – Pict: Based on – C – Concurrent ML, Concurrent Haskell: Based on CCS (see List Monads) – Esterel, Lustre U NIVERSITY OF T EXAS AT A USTIN 6
D EPARTMENT OF C OMPUTER S CIENCES Related Work, Applications � Workflow: Based on � -calculus � Busieness Process Orchestration: BPEL, OWL-S, ... extensions to petri nets, U NIVERSITY OF T EXAS AT A USTIN 7
D EPARTMENT OF C OMPUTER S CIENCES Site � function: Compress MPEG file � method of an object: LogOn procedure at a bank Compose basic computing elements called Sites. A site is a � monitor procedure: read from a buffer � web service: CNN, get a stock quote � transaction: check account balance � distributed transaction: move money from one bank to another � Humans: Send email, expect report U NIVERSITY OF T EXAS AT A USTIN 8
D EPARTMENT OF C OMPUTER S CIENCES � Site calls are strict: Arguments must be defined. More on Sites � A site returns at most one value. � A site may not respond. � A site call may change states (of external servers) tentatively or Its response at different times (for the same input) may be different. � A site may be an argument of a site call. permanently. Tentative state changes are made permanent by explicit commitment. U NIVERSITY OF T EXAS AT A USTIN 9
D EPARTMENT OF C OMPUTER S CIENCES Some Fundamental Sites 0 : never responds. l et ( x; y ; � � � ) : returns a tuple of its argument values. if ( b ) : boolean b , b is true; remains silent if b is false. S ig nal returns a signal immediately. Same as if ( true ) . returns a signal if R timer ( t ) : integer t , t � 0 , returns a signal t time units later. U NIVERSITY OF T EXAS AT A USTIN 10
D EPARTMENT OF C OMPUTER S CIENCES Orc An Orc expression is 1. Simple: just a site call, or 2. composition of two Orc expressions Evaluation of Orc expression: calls some sites, publishes some values U NIVERSITY OF T EXAS AT A USTIN 11
D EPARTMENT OF C OMPUTER S CIENCES CNN ( d ) Simple Orc Expression CNN , calls site publishes the value, if any, returned by the site. U NIVERSITY OF T EXAS AT A USTIN 12
D EPARTMENT OF C OMPUTER S CIENCES f and g in parallel f j g Composition Operators x from f do g f > x > g x from f do g g where x : 2 f do Symmetric composition for all Sequencing for some Asymmetric composition U NIVERSITY OF T EXAS AT A USTIN 13
D EPARTMENT OF C OMPUTER S CIENCES Composition Operators, Examples � CNN j B B C � CNN > x > E mail ( addr ess; x ) Symmetric composition � ( E mail ( addr ess; x ) where x : 2 ( CNN j B B C )) Sequencing Asymmetric composition U NIVERSITY OF T EXAS AT A USTIN 14
D EPARTMENT OF C OMPUTER S CIENCES Conventions � Precedence of binding: j , � � No arithmetic or logic capability in Orc. u + v or x _ y . add ( u; v ) and or ( x; y ) , where add and or are sites. where , � Convention: In examples, I write u + v and x _ y . add ( u; v ) and or ( x; y ) . Can’t write Write Assume that a compiler converts these to U NIVERSITY OF T EXAS AT A USTIN 15
D EPARTMENT OF C OMPUTER S CIENCES Centralized Execution Model � An expression is evaluated on a single machine (client). � Client communicates with sites by messages. � R timer is local to client. � All fundamental sites are local to the client. R timer respond immediately. � We show concurrent and distributed executions later. All except U NIVERSITY OF T EXAS AT A USTIN 16
f j g D EPARTMENT OF C OMPUTER S CIENCES f and g independently. Symmetric composition: Evaluate CNN j B B C : calls both CNN and B B C simultaneously. Publish all values from both. 0 , 1 or 2 values) Example: f and g . Publishes values returned by both sites. ( Note: No direct communication or interaction between They may communicate only through sites. U NIVERSITY OF T EXAS AT A USTIN 17
f > x > g D EPARTMENT OF C OMPUTER S CIENCES f do g . Publish only the values from g . Sequencing: � CNN > x > E mail ( addr ess; x ) CNN . Name any value returned x . Call E mail ( addr ess; x ) . For all values published by E mail . � ( C N N j B B C ) > x > E mail ( addr ess; x ) Call E mail twice. Publishes up to two signals. Publish the value (a signal), if any, returned by f � g for f > x > g if x unused in g . May call Notation: Write U NIVERSITY OF T EXAS AT A USTIN 18
D EPARTMENT OF C OMPUTER S CIENCES Notes on Sequencing � � is associative. > x > is right associative. � A fresh evaluation of g is started with each returned value x . Many g may be executing, possibly, with f . � If f publishes at most one value, f > x > g is f ; g . copies of � If f publishes no value, g is never evaluated in f > x > g . U NIVERSITY OF T EXAS AT A USTIN 19
D EPARTMENT OF C OMPUTER S CIENCES ? M j M = M Questions ? ( M j N ) � R = M � R j N � R ? M � ( N j R ) = M � N j M � R ? if ( b ) � M j if ( : b ) � M = M U NIVERSITY OF T EXAS AT A USTIN 20
( M j N ) � R = M � R j N � R D EPARTMENT OF C OMPUTER S CIENCES M and N . For each published value, call R . Evaluate M N R may be called twice. R R ( E mail ( addr ess 1 ; messag e ) j E mail ( addr ess 2 ; messag e )) � Notify Thus, Double notification. U NIVERSITY OF T EXAS AT A USTIN 21
M � ( N j R ) 6 = M � N j M � R D EPARTMENT OF C OMPUTER S CIENCES M M M N R N R M >> (N | R) M >> N | M>> R U NIVERSITY OF T EXAS AT A USTIN 22
( g where x : 2 f ) D EPARTMENT OF C OMPUTER S CIENCES f do g . Publish only the values from g . Asymmetric parallel composition: � Evaluate f and g in parallel. For some value published by � When f returns a value, assign it to x and terminate f . � Any site call in g which does not name x can proceed. ( M j N ( x )) where x : 2 f � A site calls which names x waits until x gets a value. � Values published by g are the values of ( g where x : 2 f ) . U NIVERSITY OF T EXAS AT A USTIN 23
D EPARTMENT OF C OMPUTER S CIENCES ( CNN j B B C ) > x > E mail ( addr ess; x ) Pruning the computation May send two emails. E mail ( addr ess; x ) where x : 2 ( CNN j B B C ) To send just one email: U NIVERSITY OF T EXAS AT A USTIN 24
Recommend
More recommend