1 / 72

Service Choreography and Orchestration with Conversations

Service Choreography and Orchestration with Conversations. Tevfik Bultan Department of Computer Science University of California, Santa Barbara bultan@cs.ucsb.edu http://www.cs.ucsb.edu/~bultan. Acknowledgements. Joint work with Xiang Fu, Hofstra University

vui
Download Presentation

Service Choreography and Orchestration with Conversations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Service Choreography and Orchestration with Conversations Tevfik Bultan Department of Computer Science University of California, Santa Barbara bultan@cs.ucsb.edu http://www.cs.ucsb.edu/~bultan

  2. Acknowledgements • Joint work with • Xiang Fu, Hofstra University • Jianwen Su, University of California, Santa Barbara • Aysu Betin Can, Middle East Technical University • [Bultan, Fu, Hull, Su, WWW’03] Conversation specification • [Fu, Bultan, Su, CIAA’03, TCS’04] Conversation protocols, realizability • [Fu, Bultan, Su WWW’04, TSE’05] Analyzing interacting BPEL processes, realizability • [Fu, Bultan, Su CAV’04] Web Service Analysis Tool (WSAT) • [Betin Can, Bultan, Fu WWW’05] Peer controller pattern for modular interaction analysis

  3. Web Services • The World Wide Web Consortium (W3C) defines a Web service as • "a software system designed to support interoperable machine-to-machine interaction over a network” • The basic architecture Service Broker Search Register Request Service Provider Service Requester Response

  4. Web Services Standards Stack Universal Description, Discovery & Integration (UDDI) Registry Service Web Services Description Language (WSDL) Simple Object Access Protocol (SOAP) Protocol XML Schema (XSD) Type Extensible Markup Language (XML) Data Service Broker UDDI Register Search WSDL WSDL Request Service Provider Service Requester SOAP Response

  5. Web Services Characteristics/Goals • Interoperability • Platform independent (.NET, J2EE) • Service interactions across organizational boundaries • Loose coupling • Standardized data transmission via XML • Interaction based on standardized interfaces such as WSDL • Communication via messages • Synchronous and asynchronous messaging

  6. Basic Usage of Web Services • What we have so far supports basic client/server style interactions • Example: Amazon E-Commerce Web Service (AWS-ECS) • AWS-ECS WSDL specification lists 40 operations that provide differing ways of browsing Amazon’s product database such as • ItemSearch, CartCreate, CartAdd, CartModify, CartGet, CartClear • Based on the AWS-ECS WSDL specification one can implement clients that interact with AWS-ECS WSDL Request Service Provider Service Requester SOAP Response Server Client

  7. Composing Services • Can this framework support more than basic client/server style interactions? • Can we compose a set of services to construct a new service? • For example: • If we are building a bookstore service, we may want to use both Amazon’s service and Barnes & Noble’s service in order to get better prices • Another (well-known) example: • A travel agency service that uses other services (such as flight reservation, hotel reservation, and car rental services) to help customers book their trips

  8. Composing Services Two dimensions: • Define an executable process that interacts with existing services and executes them in a particular order and combines the results to achieve a new goal • Orchestration: From atomic services to stateful services • Specify how the individual services should interact with each other. Find or construct individual services that follow this interaction specification • Choreography: Global specification of interactions among services

  9. Orchestration vs. Choreography • Orchestration: Central control of the behavior of a distributed system • Like a conductor conducting an orchestra • Conductor is in charge during the performance • Orchestration specifies an executable process, identifying when and how that process should interact with other services • Orchestration is used to specify the control flow of a composite web service (as opposed to an atomic web service that does not interact with any other service)

  10. Orchestration vs. Choreography • Choreography: Specification of the behavior of a distributed system without centralized control • Choreographer specifies the behavior of the dancing team • Choreographer is not present during the execution • A choreography specifies how the services should interact • It specifies the legal sequences of messages exchanged among individual services (peers) • It is not necessarily executable • A choreography can be realized by writing an orchestration for each peer involved in the choreography • Choreography as global behavior specification • Orchestration as local behavior specification that realizes the global specification

  11. Orchestration with WS-BPEL • Web Services Business Process Execution Language (WS-BPEL) is an orchestration language • A WS-BPEL specification describes the execution logic using basic and structured activities • Basic activities: RECEIVE, REPLY, INVOKE, ASSIGN, THROW, TERMINATE, WAIT, EMPTY RECEIVE, REPLY, INVOKE • Structured activities: SEQUENCE, SWITCH, WHILE, PICK, FLOW, SCOPE, COMPENSATE • WS-BPEL supports messaging (RECEIVE, REPLY, INVOKE) and multi-threading (FLOW)

  12. Choreography with WS-CDL • Web Services Choreography Description Language (WS-CDL) • WS-CDL specifications describe ``peer-to-peer collaborations of Web Services participants by defining, from a global viewpoint, their common and complementary observable behavior; where ordered message exchanges result in accomplishing a common business goal.'' • A WS-CDL specification describes the interaction ordering among a set of peers using basic and structured activities • Basic activities: INTERACTION, PERFORM, ASSIGN, SILENT ACTION, NO ACTION • Structured activities: SEQUENCE, PARALLEL, CHOICE, PICK, FLOW, SCOPE, COMPENSATE

  13. Web Services Standards Stack Web Services Choreography Description Language (WS-CDL) Choreography Web Services Business Process Execution Language (WS-BPEL) Orchestration Service Web Services Description Language (WSDL) Simple Object Access Protocol (SOAP) Protocol Type XML Schema (XSD) Extensible Markup Language (XML) Data WSDL WS-BPEL SOAP Atomic Service Orchestrated Service WS-CDL SOAP SOAP WS-BPEL WSDL Orchestrated Service SOAP Atomic Service SOAP

  14. Asynchronous Messages • Sender does not have to wait for the receiver • Message is inserted to a message queue • Messaging platform guarantees the delivery of the message • Why support asynchronous messaging? • Otherwise the sender has to block and wait for the receiver • Sender may not need any data to be returned • If the sender needs some data to be returned, it should wait when it needs to use that data • Asynchronous messaging can alleviate the latency of message transmission through the Internet • Asynchronous messaging can prevent sender from blocking if the receiver service is temporarily unavailable • Rather then creating a thread to handle the send, use asynchronous messaging

  15. Outline • Motivation: Web Services • Conversations • Realizability • Synchronizability • Web Service Analysis Tool • An Application (Reality Check) • Conclusions

  16. Going to Lunch at UCSB • Before Xiang left UCSB, Xiang, Jianwen and I were using the following protocol for going to lunch: • Sometime around noon one of us would call another one by phone and tell him where and when we would meet for lunch. • The receiver of this first call would call the remaining peer and pass the information. • Let’s call this protocol the First Caller Decides (FCD) protocol. • At the time we did not have answering machines or voicemail!

  17. FCD Protocol Scenarios • Possible scenario • Tevfik calls Jianwen with the decision of where and when to eat • Jianwen calls Xiang and passes the information • Another scenario • Jianwen calls Tevfik with the decision of where and when to eat • Tevfik calls Xiang and passes the information • Yet another scenario • Tevfik calls Xiang with the decision of where and when to eat • Maybe Jianwen also calls Xiang at the same time with a different decision. But the phone is busy. • Jianwen keeps calling. But Xiang is not going to answer because according to the protocol the next thing Xiang has to do is call Jianwen. • Xiang calls Jianwen and passes the information

  18. FCD Protocol: Tevfik’s Behavior Let’s look at all possible behaviors of Tevfik based on the FCD protocol Tevfik is hungry Tevfik receives a call from Jianwen passing him the lunch decision Tevfik calls Jianwen with the lunch decision Tevfik receives a call from Xiang passing him the lunch decision Tevfik calls Xiang with the lunch decision Tevfik receives a call from Xiang telling him the lunch decision that Tevfik has to pass to Jianwen

  19. FCD Protocol: Tevfik’s Behavior T->J(D) Message Labels: Tevfik calls Jianwen with the lunch decision !send ?receive J->X(P) Jianwen calls Xiang to pass the decision !T->J(D) ?J->T(P) ?X->T(P) !T->X(D) ?X->T(D) ?J->T(D) !T->X(P) !T->J(P)

  20. State machines for the FCD Protocol • Three state machines characterizing the behaviors of Tevfik, Xiang and Jianwen according to the FCD protocol Tevfik Xiang Jianwen ?J->X(P) !J->T(D) !X->J(D) ?T->J(P) !T->J(D) ?J->T(P) ?X->J(P) !X->T(D) ?T->X(P) !T->J(D) !J->X(D) ?X->T(P) ?T->X(D) ?X->T(D) ?J->X(D) ?J->T(D) ?X->J(D) ?T->J(D) !X->J(P) !X->T(P) !T->J(P) !J->X(P) !J->T(P) !T->X(P)

  21. FCD Protocol Has Voicemail Problems • When the university installed a voicemail system FCD protocol started causing problems • We were showing up at different restaurants at different times! • Example scenario: • Tevfik calls Xiang with the lunch decision • Jianwen also calls Xiang with the lunch decision • The phone is busy (Xiang is talking to Tevfik) so Jianwen leaves a message • Xiang calls Jianwen passing the lunch decision • Jianwen does not answer (he already left for lunch) so Xiang leaves a message • Jianwen shows up at a different restaurant! • Message sequence is: T->X(D) J->X(D)X->J(P) • The messages J->X(D) andX->J(P) are never consumed • This scenario is not possible without voicemail!

  22. A Different Lunch Protocol • To fix this problem, Jianwen suggested that we change our lunch protocol as follows: • As the most senior researcher among us Jianwen would make the first call to either Xiang or Tevfik and tell when and where we would meet for lunch. • Then, the receiver of this call would pass the information to the other peer. • Let’s call this protocol the Jianwen Decides (JD) protocol

  23. State machines for the JD Protocol • JD protocol works fine with voicemail! Xiang Jianwen Tevfik ?T->X(P) ?X->T(P) ?J->X(D) ?J->T(D) !J->T(D) !J->X(D) !T->X(P) !X->T(P)

  24. Conversations • The FCD and JD protocols specify a set of conversations • A conversation is the sequence of messages generated during an execution of the protocol • We can specify the set of conversations without showing how the peers implement them • we call such a specification a conversation protocol

  25. FCD and JD Conversation Protocols JD Protocol FCD Protocol T->X(D) J->X(D) J->T(D) J->X(D) X->T(D) X->J(D) T->J(D) J->T(D) J->X(P) X->T(P) T->J(P) J->T(P) X->T(P) T->X(P) T->X(P) X->J(P) Conversation set: { T->X(D)X->J(P), T->J(D)J->X(P), X->T(D)T->J(P), X->J(D)J->T(P), J->T(D)T->X(P), J->X(D)X->T(P) } Conversation set: { J->T(D)T->X(P), J->X(D)X->T(P)}

  26. Observations & Questions • The implementation of the FCD protocol behaves differently with synchronous and asynchronous communication whereas the implementation of the JD protocol behaves the same. • Can we find a way to identify such implementations? • The implementation of the FCD protocol does not obey the FCD protocol if asynchronous communication is used whereas the implementation of the JD protocol obeys the JD protocol even if asynchronous communication used. • Given a conversation protocol can we figure out if there is an implementation which generates the same conversation set?

  27. Conversations, Choreography, Orchestration • A conversation protocol is a choreography specification • A conversation set corresponds to a choreography • A conversation set can be specified using a choreography language such as WS-CDL • One can translate WS-CDL specifications to conversation protocols • Peer state machines are orchestrations • A peer state machine can be specified using an orchestration language such as WS-BPEL • One can translate WS-BPEL specifications to peer state machines

  28. A Model for Composite Web Services • A composite web service consists of • a finite set of peers • Lunch example: T, X, J • and a finite set of messages • Lunch example (JD protocol): J->T(D), T->X(P), J->X(D), X->T(P) T->X(P) Peer T Peer X X->T(P) J->T(D) J->X(D) Peer J

  29. Communication Model • We assume that the messages among the peers are exchanged using reliable and asynchronous messaging • FIFO and unbounded message queues Peer J Peer T J->T(D) J->T(D) • This model is similar to existing messaging platforms such as • JMS (Java Message Service) • Java API for XML messaging (JAXM) • MSMQ (Microsoft Message Queuing Service)

  30. Conversations T->X(P) J->T(D) • Record the messages in the order they are sent Peer T Peer X Generated conversation: J->T(D) T->X(P) Peer J • A conversation is a sequence of messages generated during an execution

  31. Properties of Conversations • The notion of conversation enables us to reason about temporal properties of the composite web services • LTL framework extends naturally to conversations • LTL temporal operators X (neXt), U (Until), G (Globally), F (Future) • Atomic properties Predicates on message classes (or contents) Example: G ( payment F receipt) • Model checking problem: Given an LTL property, does the conversation set satisfy the property?

  32. Bottom-Up vs. Top-Down Bottom-up approach • Specify the behavior of each peer • For example using an orchestration language such as WS-BPEL • The global communication behavior (conversation set) is implicitly defined based on the composed behavior of the peers • Global communication behavior is hard to understand and analyze Top-down approach • Specify the global communication behavior (conversation set) explicitly as a protocol • For example using a choreography language such as WS-CDL • Ensure that the conversations generated by the peers obey the protocol

  33. Top-Down vs. Bottom-Up J->T(D) J->X(D) Conversation Protocol LTL property ? GF(T->X(P)  X->T(P)) T->X(P) X->T(P) Peer T Peer X Peer J Input Queue !J->T(D) ?X->T(P) ?T->X(P) ?J->X(D) ?J->T(D) !J->X(D) !T->X(P) !X->T(P) ... ? Virtual Watcher GF(T->X(P)  X->T(P)) LTL property

  34. Conversation Protocols • Conversation Protocol: • An automaton that accepts the desired conversation set • A conversation protocol is a contract agreed by all peers • Each peer must act according to the protocol • For reactive protocols with infinite message sequences use: • Büchi automata which accept infinite strings • For specifying message contents, use: • Guarded automata • Guards are constraints on the message contents

  35. Synthesize Peer Implementations • Conversation protocol specifies the global communication behavior • How do we implement the peers? • How do we obtain the contracts that peers have to obey from the global contract specified by the conversation protocol? • Project the global protocol to each peer • By dropping unrelated messages for each peer

  36. Question If this equality holds the conversation protocol is realizable • The JD protocol is realizable • The FCD protocol is not realizable Are there conditions which ensure the equivalence? ? Conversations specified by the conversation protocol  Conversations generated by the projected services

  37. Outline • Motivation: Web Services • Formalizing Conversations • Realizability • Synchronizability • Web Service Analysis Tool • An Application (Reality Check) • Conclusions

  38. Realizability Problem !m2 ?m2 ?m1 !m1 Peer A Peer B Peer C Peer D Projection of the conversation protocol to the peers • Not all conversation protocols are realizable! AB: m1 CD: m2 Conversation protocol Conversation “m2 m1” will also be generated by all peer implementations which follow the protocol

  39. Another Unrealizable Protocol m1 A B m2 A m2 m2 m3 C m1 m3 B m1 B A, C C BA:m2 AB:m1 m3 Watcher BA:m2 Generated conversation: m2 m1 m3 AB:m1 AC:m3

  40. Realizability Conditions Three sufficient conditions for realizability (no message content) • Lossless join • Conversation set should be equivalent to the join of its projections to each peer • Synchronous compatible • When the projections are composed synchronously, there should not be a state where a peer is ready to send a message while the corresponding receiver is not ready to receive • Autonomous • At any state, each peer should be able to do only one of the following: send, receive or terminate (a peer can still choose among multiple messages)

  41. Realizability Conditions • Following protocols fail one of the three conditions but satisfy the other two BA:m2 AB:m1 AB: m1 AB: m1 BA:m2 AB:m1 CD: m2 CA: m2 AC:m3 Not lossless join Not synchronous compatible Not autonomous

  42. Outline • Motivation: Web Services • Formalizing Conversations • Realizability • Synchronizability • Web Service Analysis Tool • An Application (Reality Check) • Conclusions

  43. Bottom-Up Approach • We know that analyzing conversations of composite web services is difficult due to asynchronous communication • Model checking for conversation properties is undecidable even for finite state peers • The question is: • Can we identify the composite web services where asynchronous communication does not create a problem? • We call such compositions synchronizable • The implementation of the JD protocol is synchronizable • The implementation of the FCD protocol is not synchronizable

  44. Three Examples, Example 1 • Conversation set is regular: (r1a1 | r2a2)* e • During all executions the message queues are bounded !a1 !a2 r1, r2 !e e ?r1 ?r2 ?a1 ?a2 ?e a1, a2 !r1 !r2 requester server

  45. Example 2 • Conversation set is not regular • Queues are not bounded !a1 !a2 r1, r2 !e ?a1 ?a2 e ?r1 ?r2 ?e !r1 !r2 a1, a2 requester server

  46. Example 3 r1, r2 !e !r1 !r2 ?r !a e ?r1 ?r2 ?a !r a1, a2 ?e requester server • Conversation set is regular: (r1 | r2 | ra)* e • Queues are not bounded

  47. State Spaces of the Three Examples # of states in thousands queue length • Verification of Examples 2 and 3 are difficult even if we bound the queue length • How can we distinguish Examples 1 and 3 (with regular conversation sets) from 2? • Synchronizability Analysis

  48. Synchronizability Analysis • A composite web service issynchronizable if its conversation setdoes not change • when asynchronous communication is replaced with synchronous communication • If a composite web service is synchronizable we can check the properties about its conversations using synchronous communication semantics • For finite state peers this is a finite state model checking problem

  49. Synchronizability Analysis Sufficient conditions for synchronizability: • A composite web service is synchronizable, if it satisfies the synchronous compatible and autonomousconditions • Connection between realizability and synchronizability: • A conversation protocol is realizable if its projections to peers are synchronizable and the protocol itself satisfies the lossless join condition

  50. Outline • Motivation: Web Services • Formalizing Conversations • Realizability • Synchronizability • Web Service Analysis Tool • An Application (Reality Check) • Conclusions

More Related