29 Jan 2024 |
Research article |
Software Systems, Multimedia and Cybersecurity
MicroMiner: an Approach in Identifying Microservices
Microservices architecture (MSA) has gained increasing popularity in recent years, due to its remarkable scalability, compatibility with cloud environments and alignment with modern DevOps practices. While adopting MSA is relatively straightforward for new applications, migrating existing monolithic systems to the MSA architecture is a challenging task. This is where our MicroMiner solution comes in. MicroMiner is an approach that helps identify Microservices within monolithic systems based on machine learning. This is achieved by analyzing the interrelationships between code elements and extracting semantic information embedded in the code itself. We rigorously evaluated MicroMiner's accuracy using real systems. We compared its results with standards and other state-of-the-art approaches. Our results show that MicroMiner excels in automating the process of identifying microservices. Key words: Microservices, monolith, architecture, migration, machine learning
Migrating Monolithic Software to Microservices
A monolithic legacy system is an obsolete software architecture characterized by a single, extensive code base that tightly integrates all application components and functionalities. These systems typically evolve over time and tend to become increasingly complex, encompassing everything from user interfaces and business logic to data access, within a unified code base. This complexity makes them difficult to maintain, modify and evolve.
Recognizing these challenges, and the imperative for modernization, organizations frequently consider adopting a new architectural paradigm, such as microservices, which offers a more agile and modular approach to software development and deployment. Microservice architecture (MSA) is a way of designing and organizing software applications as a collection of small, independent services, rather than as one large, monolithic application. Each of these services, known as ‘microservices’, is responsible for specific, well-defined tasks within the application. Several major organizations, such as Netflix, Amazon and eBay, have already adopted this architectural style in their enterprise systems by refactoring their monolithic systems. However this migration is costly in terms of time and resources.
A survey (Fritzsch 2019) investigated the migration process of 14 systems across different domains, revealing the cost in time and resources of migration. Times ranged from 1.5 to over 3 years for completed migrations. Also, in certain instances, project teams even swelled to an impressive 40 member force, reflecting a concerted effort to expedite the migration process.
With the purpose of automating this process and reducing the costs, we propose an approach called MicroMiner (Trabelsi 2022), a type-based microservice identification approach that leverages machine learning and semantic analyses to decompose monolithic software systems into microservices. The resulting microservices respect two main principles: the single responsibility principle and the loose coupling principle.
MicroMiner: A Three-Phase Process
We present MicroMiner, a tool dedicated to the automatic identification of microservices within monolithic software systems by exclusively analyzing the source code of object-oriented monolithic software systems, thus eliminating the need to rely on other artifacts that may be difficult to find. Figure 1 provides an overview of our proposed approach.
The approach consists of three main phases:
- Class Typing: The purpose of this first phase is to distinguish classes within the monolithic software system based on their roles or responsibilities. We used a machine learning-based method to categorize each class, thereby horizontally deconstructing the system into three distinct layers. This process predicts and assigns labels to each class, designating them as ‘Application’ for classes belonging to the Business layer, ‘Entity’ for those within the Persistence layer, and ‘Utility’ for those situated in the Utility layer, as illustrated in Figure 2.
- Typed Services Identification: In the second phase, we identified ‘Application,’ ‘Entity’ and ‘Utility’ services, or what we call typed services by clustering (grouping) the classes within each layer. This process leverages a graph clustering technique that considers the relationships between classes.
- Mapping Services to Microservices Mapping: The last phase involves the generation of microservices. We split the system according to functionalities (see figure 2). It groups the typed services using a soft clustering approach, wherein each element can belong to multiple clusters. In our context, elements represent services, while clusters correspond to microservices. Microservices are determined according to (1) the relationships between services and (2) the application domain (context boundaries). Each microservice may consist of one or more Application, Entity and Utility services.”
Objective Evaluation of MicroMiner
The results generated by our approach underwent a comprehensive evaluation process, encompassing two key aspects:
- Comparison with State-of-the-Art Approaches: We first assessed the quality of our results by comparing them with those obtained through two state-of-the-art microservice identification methodologies. This rigorous comparison allowed us to gauge the effectiveness of our approach.
- Evaluation of Qualitative Metrics: In addition to quantitative comparisons, we conducted an in-depth evaluation using qualitative metrics to further scrutinize the quality of the identified microservices. This evaluation approach provides a comprehensive perspective on the quality of our results.
Our evaluation studies encompassed four diverse software systems, namely:
- Compiere: A sizable ERP system, comprising a total of 1,042 classes.
- JForum: A medium-sized online retail system.
- PetClinic and POS: Both systems contained fewer than 100 classes each.
To ensure the reliability of our approach, we established a ground truth against which we compared our results. Additionally, we measured precision, recall and F-measure for each system. Notably, our results demonstrate that MicroMiner excels in identifying architecturally relevant microservices, achieving a precision rate of 68.15%, a recall of 77%, and an impressive F-measure of 72.1%, outperforming the other two state-of-the-art approaches.
In this project, we introduced MicroMiner, a promising approach designed to identify microservices within monolithic software systems using machine learning. MicroMiner dives deep into code bases, identifies distinct service types and carefully examines the relationships between components. The exhaustive tests we carried out on four existing systems underline its competence, with an accuracy rate of around 72%.
With MicroMiner, we are shaping a vision of the future where software systems naturally embody modularity, scalability and agility, facilitating their seamless adjustment to evolving user needs. Our primary objective is to minimize migration costs, which will encourage companies to move to more flexible architectures and, consequently, deliver highly efficient user-friendly software solutions. However, this journey is far from over. We remain committed to automating other facets of the migration process, including the generation of microservice-specific components and the optimization of deployment procedures.
For more information, please read the following research paper: Trabelsi, Imen, et al. “From legacy to microservices: A type‐based approach for microservices identification using machine learning and semantic analysis.” Journal of Software: Evolution and Process (2022): e2503.
Imen Trabelsi is a PhD candidate at ETS Montréal, focusing on migrating monolithic systems into microservice architectures.
Manel Abdellatif has been an Institutional Researcher at École de Technologie Supérieure since 2022. Before her current position, she was a postdoctoral fellow at the School of EECS, University of Ottawa. She received her PhD in Computer Science from Polytechnique Montréal in 2021.
Naouel Moha has been a professor at ÉTS. Previously, she held the position of Professor at Université du Québec à Montréal. Her academic career began as an Assistant Professor at the University of Rennes in 2009.