1
XI INTERNATIONAL CONFERENCE
“INFORMATION TECHNOLOGY AND IMPLEMENTATION” (IT&I-2024)
ON SUPERVISING AND COORDINATING MICROSERVICES WITHIN WEB APPLICATIONS ON THE BASIS OF STATE MACHINES
�National University of Kyiv-Mohyla Academy��Oleksiy Oletsky - PhD, Faculty of Informatics�Vitalii Moholivskyi - PhD Student, Faculty of Informatics
2 / 16
Supervision and coordination challenges of microservice architecture
Traditional monolithic architecture exposes more and more weaknesses and vulnerabilities in coping with such challenges as scalability demands, fault tolerance standards, flexibility and deployment requirements.�
Handling those issues, microservice architecture has gained wide acknowledgment among software architects since its introduction in 2011. According to O’Reilly’s subscribers survey conducted in 2020, 77% of responders use microservices architecture at work.�
On the other hand, microservice architecture puts forward new challenges. Developers and admins suffer from a lack of control, observability and monitoring capabilities over the distributed execution flow within microservice-based web applications. Testing and debugging complexity have also increased significantly compared to the monolithic architecture.
3 / 16
State machines as the theoretical model for describing microservices
A state machine can be defined as a 5-tuple:
(Q,Σ,δ,q_0,F),
where
Q is a finite set called the states,
Σ is a finite set called the alphabet,
δ is a state transition function δ:Q×Σ→Q , which determines the next state given a current state and an input symbol,
q_0 is the start state, where q_0∈Q,
F is a set of final state, where F⊆Q.
Within the context of microservices, the alphabet Σ is a set of messages (events) occurring between or within microservices. Therefore, a state transition function δ:Q×Σ→Q receives an internal or external event with a current state and returns the next state. Moreover, the function δ could trigger control procedures for meeting the functional requirements of an application.
4 / 16
The active development of state machines in recent years is a sign of the prospects for their use in modern systems.
5 / 16
Supervision and coordination challenges of microservice architecture
As microservices are typically deployed as independent containers running on different servers, having effective means of communication and coordination between microservices is essential for managing distributed execution control flow between independent services. Therefore, several methods of microservices coordination have emerged:
1. Orchestration
2. Choreography
3. Saga Pattern for distributed transactions
4. API Gateway Pattern
5. Service Mesh
6 / 16
Orchestration and choreography coordination methods using state machines
7 / 16
Characteristic | Orchestration | Choreography |
Control | Centralized through an orchestrator microservice | Decentralized, each microservice is independent |
Coordination | The orchestrator directs the flow and interactions | Microservices communicate directly |
State Machine | One main state machine inside the orchestrator | Each microservice has its own state machine |
Advantages | Easier to monitor and manage | Greater flexibility, scalability, and resilience |
Disadvantages | Orchestrator can become a bottleneck and single point of failure | Harder to debug, more complex coordination between services |
Comparison of orchestration and choreography coordination with state machines
8 / 16
Library for coordinating microservices using state machines
9 / 16
The example of state machine definition and its visualization created using XState visualizator
10 / 16
Visualization of workflows in the form of a graph
11 / 16
Use of PageRank-like techniques for analyzing importance of microservices
We propose to compute the weight of a relationship between microservice Mj and microservice Mi using the formula:�
where N_ij is a number of event dependencies specified in state machines between Mj and Mi, and N_max is a maximum number of event dependencies detected between any Mj and Mi.
Then, PageRank-like technique can be applied to the graph in order to get microservices importance scores. Brin and Page defined PageRank algorithm as:
By adding Ding concept of weight [24] we get:
12 / 16
The graph with weights of microservices relationship importance
13 / 16
Microservices and their importance scores
Microservice | Importance score |
Policies management service | 0.141 |
Firewall management service | 0.179 |
Treat detection service | 0.082 |
Vulnerability management service | 0.069 |
Vulnerability scanning service | 0.098 |
Incident response service | 0.279 |
Monitoring service | 0.088 |
Metrics service | 0.064 |
14 / 16
Conclusions and discussion
The paper considers how to improve processes of control and monitoring within a microservice-based application, mainly by means of entrenching coordination across microservices. We are suggesting an approach based on using state machines for declarative describing the overall build of an application and workflows within it.� The main functions implemented by the prototype are as follows:
• registering state machines definitions
• handling the creation and execution of a state machine instance, its suspension and persistence, retrieval and revival when required
• creating required data structures in ArangoDB database and Kafka message broker
• handling the exchange of events between microservices
• handling graceful shutdown
• guaranteeing scalability, high availability, and fault tolerance based on both infrastructure and implementation choices.
15 / 16
Conclusions and discussion
Advantages of using state machines for typical tasks are
Declarative descriptions provided by state machines enable to explore the microservice-based application by means of various mathematical methods and on this base to work out recommendations for how to improve certain features of it.
� Namely, this paper illustrates the use of PageRank-like techniques for evaluating measures of importance for different microservices.�
There are many other possible applications of mathematical models and methods based on descriptions provided by the state machine.
16 / 16
Thank you for your attention!����
Vitalii Moholivskyi
mogolivskiy@gmail.com
Q&A