Choreography Or Orchestration – What Is Your Choice in Serverless Microservices

Microservices and digital transformation are spoken in the same breath today. Microservices play a significant role in building applications. It enables developers to add or update new features in the application easily without worrying about downtime. Microservices can be deployed in various ways, but hosting within a serverless architecture is the most popular method.

Serverless microservices offer many benefits.

To begin with, developers don’t have to worry about provisioning servers or managing their capacity. They can entirely focus on building and deploying the microservices. It’s also a great way for companies to save on upfront costs as they pay only when a pre-configured action is executed in response to an event such as an HTTP request or API call. The pay-per-use model also allows developers to scale up and down depending on the load conditions.

Microservices is a unit of small services that carry specific functions and work independently. However, they need a medium to work together to interact and share data.

That’s where orchestration and choreography play a role. 

Let’s find out what are choreography and orchestration, and what developers should choose.

Understanding Choreography and Orchestration Microservices

Before getting into what developers must choose, let’s understand them better.

Orchestration: As the name suggests, orchestration is an arrangement where microservices are controlled centrally with an orchestrator or controller. Think of it as an orchestra where the individual services are like instruments playing together on the orchestrator’s cue. In the microservices context, the individual services communicate and perform actions on the orchestrator’s direction. The orchestrator controls the business logic workflow and coordinates with the individual services to complete an action. Maintaining the business logic becomes easy as it is centrally located. It is also easy to implement because every action happens in a controlled manner. So, the coordination is seamless. 

However, orchestration has downsides too. As orchestrators control everything, a single issue could lead to complete failure. Also, the services are tightly coupled and work synchronously. So, if a particular service stops processing, the next step will not occur. Another downside of orchestration is that since the orchestrator communicates directly with each service and awaits a response from them, the requests take longer to complete. This would affect the app’s performance, especially when there is increased business demand. 

Choreography: In choreography, the individual services work and communicate independently. They are not centrally controlled. The individual services work asynchronously and are event-based, i.e., they act in response to the cue they receive from other services. So, the request and response take less time as compared to orchestration. Unlike with orchestrators, developers don’t have to worry if a single service fails. The other services that are not dependent on them can carry on with their functions. Developers can also easily add or remove services and share already developed services with other teams for reuse. These features make choreography the best fit for today’s fast-paced environment, where agile methods are used to quickly build, launch, and update applications. It saves the developer’s time and effort. 

However, choreography also has some disadvantages. Each service has a brain of its own. It becomes difficult for developers to manage them in the absence of a centrally controlled orchestrator. It could get even more complicated when the business processes are complex to manage, and developers cannot pinpoint where and why the failure happened. It’s also difficult for developers to roll back certain transactions when errors occur.  

What Should Developers Choose?

Now that we know the difference between choreography and orchestration microservices, the next question is what should developers choose?

There’s no straightforward answer to this question. It depends upon the business needs. Let’s look at a few sample cases to determine which one would be a better fit.

  1. Business process model: Orchestration would be an ideal option if the business process model is centralized. If it is distributed, then choreography might work better. 
  2. Environment: Orchestration may not be able to manage an environment in which thousands of microservices work together to complete a single business function. In such cases, choreography would work as each of these services work asynchronously.
  3. SAGA: If SAGA is implemented to manage and roll back transactions, orchestration might be a better option than choreography, as developers can quickly identify and fix the failures.

Another solution is to combine the best of both worlds and implement the hybrid approach. The hybrid approach uses orchestration as the centralized service and leverages choreography to communicate with other services. 

Companies and developers must work with the right partners to choose the right microservices. 

Posted by wissenadmin | 14 January 2022
A 17% YoY increase in data breaches was recorded by Identity Theft Resource Center in 2021. Almost 100 million victims in Q3 were, in one way or the other, affected by cloud…
Service Mesh Architecture
Posted by imidas | 13 January 2022
Microservices are now everywhere and have taken the software development landscape by storm. In a recently concluded survey, 28% of the respondents revealed that they had been employing microservices for…
Edge Machine Learning
Posted by imidas | 04 January 2022
With IoT rising in prominence came the subsequent explosion of smart devices connected to the cloud. However, this surge led to network congestion since networks were not ready to support…