OPTIMIZING DATA CONSISTENCY IN MICROSERVICE ARCHITECTURE USING THE SAGA PATTERN AND EVENT-DRIVEN APPROACH

Authors

  • Arif Nurdiansyah Universitas Widyatama
  • Esa Fauzi Universitas Widyatama

DOI:

https://doi.org/10.31539/z8mxcf78

Abstract

An event-driven microservice architecture offers flexibility and scalability but introduces significant challenges in maintaining data consistency across distributed services. Traditional ACID transactions are not viable in such environments, leading to potential data integrity issues during partial failures. This research proposes and evaluates the use of the Saga orchestration pattern as a solution to this problem. A comparative study was conducted by developing two systems in Golang: a baseline system using synchronous inter-service communication and a second system implementing an event-driven Saga pattern with Redis Streams as the event bus. The systems, utilizing MySQL, MongoDB, Redis, and Elasticsearch, were subjected to various failure scenarios. The results demonstrate that the synchronous system consistently produced data inconsistencies during partial failures, while the Saga-based system successfully maintained data integrity by executing compensating transactions, thus restoring the system to a consistent state. The study concludes that the Saga pattern is an effective strategy for optimizing data consistency and reliability in complex microservice architectures.

References

Alchuluq, L. M., & Nurzaman, F. (2021). Analisis pada arsitektur microservice untuk layanan bisnis toko online. TEKINFO, 22(2), 61-68.

Andaru, A. (2018). Pengertian database secara umum. OSF Preprints. https://doi.org/10.31219/osf.io/zpu8e

Balalaie, A., Heydarnoori, A., & Jamshidi, P. (2016). Microservices architecture enables DevOps: Migration to a cloud-native architecture. IEEE Software, 33(3), 42–52.

Baresi, L., Garriga, M., & De Renzis, A. (2017). Microservices identification through interface analysis. In F. De Paoli, E. Pimentel, & E. B. Johnsen (Eds.), Lecture Notes in Computer Science: Vol. 10465. Service-Oriented and Cloud Computing (pp. 19–33). Springer.

Cerny, T., Donahoo, M. J., & Trnka, M. (2017). Contextual understanding of microservice architecture: Current and future directions. Applied Computing Review, 17(4), 29–45.

Di Francesco, P., Lago, P., & Malavolta, I. (2019). Architecting with microservices: A systematic mapping study. The Journal of Systems and Software, 150, 77–97.

Dragoni, N., Giallorenzo, S., Lafuente, A. L., Mazzara, M., Montesi, F., Mustafin, R., & Safina, L. (2017). Microservices: Yesterday, today, and tomorrow. In Present and Ulterior Software Engineering (pp. 195-216). Springer, Cham.

Fauzi, E., & Iriani, Y. (2020). Architecture of monitor api to handle integration data problem in database-microservice. PalArch's Journal of Archaeology of Egypt/Egyptology, 17(10), 1422-1428.

Febrian, T. (2021). Analisis performansi web services pada arsitektur microservices pada domain kasus learning management system di Seskoau. [Disertasi doktoral, Universitas Komputer Indonesia].

Gadge, S., & Kotwani, V. (2018). Microservice architecture: API gateway considerations [White paper]. GlobalLogic.

Garcia-Molina, H., & Salem, K. (1987). Sagas. ACM SIGMOD Record, 16(3), 249–259.

Gray, J. (1981). The transaction concept: Virtues and limitations. In Proceedings of the Seventh International Conference on Very Large Data Bases (pp. 144-154).

Hasselbring, W., & Steinacker, G. (2017). Microservice architectures for scalability, agility and reliability in E-commerce. In 2017 IEEE International Conference on Software Architecture Workshops (ICSAW) (pp. 243-246). IEEE.

Nugraha, F. (2022). Implementasi event-driven architecture untuk meningkatkan kinerja pada microservice. [Disertasi doktoral, Universitas Siliwangi].

Soldani, J., & Tamburri, D. A. (2021). The pains and gains of microservices: A systematic grey literature review. Journal of Systems and Software, 174, 110893. https://doi.org/10.1016/j.jss.2020.110893

Tijms, S., van der Aalst, W. M., & van den Heuvel, W. J. (2020). A pattern-based comparison of decentralized approaches for business process execution. Information and Software Technology, 125, 106318. https://doi.org/10.1016/j.infsof.2020.106318

Vogels, W. (2009). Eventually consistent. Communications of the ACM, 52(1), 40–44.

Voloshina, I. (2020). Applying microservices pattern to monolithic software [Bachelor's thesis, Metropolia University of Applied Sciences]. Theseus. http://www.theseus.fi/handle/10024/348638

Downloads

Published

2025-07-14