Comparing Transaction Management Methods in Microservice Architecture
Nylund, William (2023)
Nylund, William
2023
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi-fe20231120147939
https://urn.fi/URN:NBN:fi-fe20231120147939
Tiivistelmä
Microservice architectures promise frequent and low-risk deployments, high scalability and flexible technologies. Microservices are independently deployed units of software modeled around a business domain, collectively forming a complete software application. Services should maintain their own data in order to keep services decoupled, leading to cases where transactions span several databases, which is one of many challenges in microservice architectures. This thesis compares two methods for managing transactions in microservice architecture: the two-phase commit and the saga pattern. A prototype e-commerce system is implemented using a microservice architecture consisting of three services with their own databases. Each service contributes to fulfilling an order, requiring extra care to maintain data consistency in the system. The two-phase commit and the saga pattern are evaluated on their performance, scalability, complexity, availability and consistency. The evaluation shows that the two-phase commit could be better in edge cases that require strong consistency. However, the saga pattern is the superior choice in most use cases, with its ability to operate well under heavy loads and high availability in the case of a network partition.