A Survey of Saga Frameworks for Distributed Transactions in Event-driven Microservices

Krishna Mohan Koyya, B Muthukumar · 2022

Event-driven microservices use events for inter-service communication. Such an asynchronous communication model preempts distributed monoliths and allows microservices to scale well and evolve autonomously. Typically, a message broker is employed to carry the events across the participating microservices. However, it is impractical for the event-driven microservices to accomplish the distributed transactions using traditional 2-phase commits. Hence, the microservice architecture advises implementing a distributed transaction as a saga of local transactions. Though a saga does not offer the automaticity and consistency of a traditional transaction, it indeed offers eventual consistency. The saga takes the form of either orchestration or choreography depending on the number of microservices that intend to collaborate. Sagas are used across various business domains such as e-commerce, banking, social media, logistics, etc. However, saga-based transactions require careful design of the individual microservices to take care of their interactions and error handling. It is even more tedious to implement Sagas in event-driven microservices because of the asynchronous nature of the interactions. Thus, it is always suggested to use a well-tested framework for implementing the sagas instead of building them from scratch. This paper surveys some of the available frameworks for saga implementation across three popular platforms namely Java, Python, and NodeJS. This survey finds the need for a vendor-agnostic abstraction for separating the transaction layer from the business layer.

Read the paper · More papers on PaperTik