Orchestration vs. Choreography

127,611

Solution 1

Basic technologies (such as XML, SOAP, WSDL) provide means to describe, locate, and invoke services as an entity in its own right. However, these technologies do not give a rich behavioral detail about the role of the service in more complex collaboration. This collaboration includes a sequence of activities and relationships between activities, which build the business process. There are two ways to build this process: service orchestration and service choreography.

Service orchestration

Service orchestration represents a single centralized executable business process (the orchestrator) that coordinates the interaction among different services. The orchestrator is responsible for invoking and combining the services.

The relationship between all the participating services are described by a single endpoint (i.e., the composite service). The orchestration includes the management of transactions between individual services. Orchestration employs a centralized approach for service composition.

Orchestration

Service Choreography

Service choreography is a global description of the participating services, which is defined by exchange of messages, rules of interaction and agreements between two or more endpoints. Choreography employs a decentralized approach for service composition.

Choreography

The choreography describes the interactions between multiple services, where as orchestration represents control from one party's perspective. This means that a choreography differs from an orchestration with respect to where the logic that controls the interactions between the services involved should reside.

Solution 2

Service orchestration: you put together several services by a fixed logic. This logic is described at a single place. You can imagine a team of people with a manager doing micro-management. The manager precisly tells what, when and who should do. The team members do not care of the entire goal of the job, the manager combines the outputs into a single deliverable. A practical example is a BPEL process. BPEL process contains the logic, can invoke several services and combine their responses into a single service response.

Service choreography: the decision logic is distributed, with no centralized point. You can imagine a home, where everybody aims for the common good and works pro-actively without micro-management. Or you can imagine a human body, where different members are interdependent and work for the common goal. A practical example is event driven processing, where an agent is activated by an event and does its job. All the agents make a system together. There is no centralized logic. Choreography possibilities may go farther beyond orchestration as it is more aligned with the real world.

My opinion is that we do not need to distinguish much between these two, as we need to focus on the business logic. Where a single point of logic does the job, we do orchestration. Where a problem cannot be covered by a centralized logic, we are forced to choreography anyway. That is why we often come accross orchestration in IT, whereas choreograhy remains more an academical concept and a subject for research. And very often we do choreography without actualy knowing it, as in the real world.

Solution 3

Since the thread is old but still writing to it for those who will stumbled here in search of this question as I did. This is much debated question in Service-oriented architecture (SOA) which needs much cleaner explanation for beginners.

Orchestration: Executable Process

  • Used in private business processes
  • A central process (which can be another Web service) takes control of the involved Web services and coordinates the execution of different operations on the Web services involved in the operation
  • The involved Web services do not "know" (and do not need to know) that they are involved in a composition process and that they are taking part in a higher-level business process.
  • Only the central coordinator of the orchestration is aware of this goal, so the orchestration is centralized with explicit definitions of operations and the order of invocation of Web services.

enter image description here

Choreography: Multi-party Collaboration

  • Choreography, in contrast, does not rely on a central coordinator. Rather, each Web service involved in the choreography knows exactly when to execute its operations and with whom to interact. Choreography is a collaborative effort focusing on the exchange of messages in public business processes.

  • All participants in the choreography need to be aware of the business process, operations to execute, messages to exchange, and the timing of message exchanges.

enter image description here

Choreography vs. Orchestration

  • From the perspective of composing Web services to execute business processes, orchestration is a more flexible paradigm and has the following advantages over choreography:

  • The coordination of component processes is centrally managed by a known coordinator.

  • Web services can be incorporated without their being aware that they are taking part in a larger business process.

  • Alternative scenarios can be put in place in case faults occur.

Solution 4

Services can be distinguished between atomic services and services composed of other services. Such compositions are called "orchestration". Sometimes workflow, sometimes business process. For instance, BPEL is an orchestration language, but calls itself "business process execution language".

There is no requirement that services need to be hierarchically composed. That means, two services may talk to each other. The protocol running between them is called "choreography". It may be two services, but usually, there are more than two services involved. Each service in a choreography may be seen as orchestrator of the partner services. Each service taking part in a choreography may be realized as orchestration/workflow/process.

An orchestration shows the complete behavior of each service whereas the choreography combines the interface behavior descriptions of each service.

A good scientific article distinguishing choreography, interface behavior, provider behavior, and orchestration is the following one: Dijkman, R. & Dumas, M. Service-oriented Design: A Multi-viewpoint Approach International Journal of Cooperative Information Systems, 2004, 13, 337-368

Solution 5

Andrei and others did a good job explaining what is orchestration and what is choreography. For the software architect choosing between these two alternatives, it is also important to compare them with respect to different qualities.

Orchestration pluses over choreography

  • Reliability: Orchestration platforms have built-in support for error handling and transaction management (compensating transactions). In choreography, custom-developed workflow and error handling tends to be more error-prone. Also, choreography is often event-driven and much of the processing is asynchronous. Therefore, choreography may require undo/correction events that add complexity to the solution.
  • Modifiability: Creating and changing process workflows and complex service compositions is easier in the visual BPM tools found in orchestration platforms. You gain in "process visibility".

Choreography pluses over orchestration

  • Performance: Orchestration incurs a performance overhead due to workflow script interpretation and the additional layer of the orchestration platform itself.

  • Cost: Choreography does not require additional middleware or language, which have associated learning curves and governance burden.

EDIT

An orchestration solution might introduce a SPOF if the orchestrator element doesn't employ a mechanism for high availability. Thanks @Deepak por pointing this out in a comment.

Share:
127,611

Related videos on Youtube

PetrosB
Author by

PetrosB

Updated on March 17, 2022

Comments

  • PetrosB
    PetrosB about 2 years

    What are the differences between service orchestration and service choreography from an intra-organization point of view.

  • Andrei
    Andrei about 8 years
    Except choreography does require additional middleware. Requirements (tasks) need to be matched to different nodes. Afterwards the choreography is deployed, enacted, monitored and adapted. All this management requires tools that are usually provided by a middleware.
  • David Mann
    David Mann about 7 years
    Fantastic images to show the two! Where did you get them?
  • Andrei
    Andrei almost 7 years
    @DavidMann Many thanks for your comment, and please upvote if you think it was useful to you. I made these diagrams in Visio, and as inspiration I used some literature in service composition. However, I realised that this answer was 2 years ago when I just started reading about service composition. I will update this answer with references and expand on the proprieties of both
  • Anshul Nigam
    Anshul Nigam almost 6 years
    @Andrei: Couldn't have been more simpler than this.
  • Rodney P. Barbati
    Rodney P. Barbati over 4 years
    Actually, choreography usually does rely on a central coordinator - and usually that coordinator is some form of distributed message broker. Not using something like a message broker would tie your services together in very inflexible ways leading to brittleness and low reusability.
  • Ryan.Bartsch
    Ryan.Bartsch over 4 years
    Is it reasonable to mix orchestration and choreography? e.g. have orchestration for the core synchronous workflow, but then some choreography to stream async events back to the source capabilities (microservices). In my scenario, this approach might save me having to do saga/state-machine and compensation logic.
  • Christoph
    Christoph about 4 years
    Some readers may infer from your orchestration diagram that orchestration means synchronous invocations from the controlling service to providing services. I'd like to clarify that Invoke-Reply communication can also be accomplished using asynchronous methods, incl. via a message broker.
  • Deepak
    Deepak about 4 years
    Doesn't orchestration bring a disadvantage of single point of failure which is not the case with Choreography?
  • Paul de Vrieze
    Paul de Vrieze over 3 years
    Note that for business processes, the runtime of a process that could span days or weeks, some overhead in hitting a process engine is not that impactful.
  • Paul de Vrieze
    Paul de Vrieze over 3 years
    @Deepak, A process engine could be using a replicated database for it's state. Fallover would not be too hard to do in such a setup. In addition, there can be multiple engines (just only one per process instance, which you would also have for choreography - except that choreography doesn't store per design (individual components could/can)).
  • Benny Bottema
    Benny Bottema about 3 years
    Don't follow @RodneyP.Barbati. How is an asynchronous message bus to alleviate dependency brittleness equivalent to a central coordinator. The message broker is completely dumb and unaware of any processes that might rely on it.
  • Benny Bottema
    Benny Bottema about 3 years
    By far the biggest plus of an orchestrator is the transparency of the process whereas with choreography the process flow is often not clear at all unless there is comprehensive documentation available (which often there is not). For example event driven processes (choreography) have great advantages, but damn if it isn't a complete puzzle sometimes to figure out how the process flows.
  • varun
    varun almost 3 years
    not to mention when the service composition in choreography gets huge enough you'll need reconciliation mechanisms to ensure system correctness and anomaly detection
  • Rodney P. Barbati
    Rodney P. Barbati over 2 years
    @Benny Bottema - because each service/function involved in the process is sending messages out that trigger the next service/function in the process chain. They are not calling the next service/function directly.
  • Benny Bottema
    Benny Bottema over 2 years
    Except the bus doesn't coordinate anything, quite the opposite: the events and consuming services form a choreography of which the bus has no notion whatsoever. solace.com/blog/microservices-choreography-vs-orchestration
  • cellepo
    cellepo about 2 years
    Yes, and this seems to be referred to in industry as the "Hybrid" approach of both: Searching the web with "orchestration choreography hybrid" yields numerous results of use case examples.