Координація мікросервісів із використанням машин станів
Loading...
Date
2024
Authors
Олецький, Олексій
Моголівський, Віталій
Journal Title
Journal ISSN
Volume Title
Publisher
Abstract
У статті розглянуто підхід до координації мікросервісів на основі використання машин станів як абстракції для управління розподіленим потоком виконання програми з мікросервісною архітектурою. Реалізовано прототип бібліотеки, загальну архітектуру і принципи роботи якого описано в статті.У разі застосування описаного підходу полегшується та упорядковується робота з паралельними потоками виконання і довготривалими фоновими задачами. Крім того, покращується прозорість процесів, що полегшує їх моніторинг, візуалізацію, тестування і відлагодження. Для використання машин станів у мікросервісному середовищі реалізовано інтеграцію з брокером повідомлень і належне довготривале зберігання їхнього стану.
Description
The article describes the use of state machines to coordinate microservices. The lack of well-developed microservice coordination tools presents a significant number of challenges for developers building applications with a microservice architecture. Among these challenges are the difficulty of managing multiple services and their distributed execution flow, the lack of transparency in monitoring and debugging, complications in testing, and other issues. These challenges can be addressed by utilizing state machines. State machines serve as an abstraction to control the distributed execution flow of a program in a microservice architecture. This approach simplifies working with parallel execution flows and long-running background tasks. It also improves process transparency, as well as monitoring, visualization, testing, and debugging. Integration with a message broker and adequate long-term state storage has been implemented to use state machines in a microservice environment. The paper describes the developed library, which connects three key components required for the effective functioning of state machines within microservices. These components include the XState implementation of the state machine, the Kafka message broker, and the ArangoDB multi-model database. Additionally, a prototype has been created to illustrate the usage of the developed library for a number of typical tasks. The prototype showcases the process of deleting data in accordance with GDPR regulations. The proposed approach simplifies the development of execution logic in a microservice application, specifically by facilitating and organizing the management of parallel execution flows and long-running background tasks. In addition, it improves process transparency in the microservice architecture, namely in monitoring, visualization, testing, and debugging.
Keywords
мікросервісна архітектура, машини станів, координація мікросервісів, подійно-орієнтований підхід, управління потоком виконання, моніторинг мікросервісів, візуалізація мікросервісів, тестування мікросервісів, стаття, microservice architecture, state machines, coordination of microservices, event-oriented approach, execution flow management, monitoring of microservices, visualization of microservices, testing of microservices
Citation
Олецький О. В. Координація мікросервісів із використанням машин станів / Олецький О. В., Моголівський В. О. // Наукові записки НаУКМА. Комп'ютерні науки. - 2024. - Т. 7. - С. 4-10. - https://doi.org/10.18523/2617-3808.2024.7.4-10