2018 ACM An Automatic Extraction Approach - Transition To MS Architecture From Monolithic Application
2018 ACM An Automatic Extraction Approach - Transition To MS Architecture From Monolithic Application
ABSTRACT
Microservice architecture has been introduced as a new 1 INTRODUCTION
alternative to the monolithic architecture. It has several benefits In recent years, applications that need to scale up to thousands
like scalability, reliability, increase in agility and productivity, or millions of users are very common due to many factors such
resilience to failure, ease of deployment and maintenance, and as the number of users with Internet access, the use of mobile
decrease in time to market. Therefore, software companies have application stores etc. Traditional enterprise systems are
showed a tendency to transform architecture of their legacy designed as monolithic applications, which are difficult to scale,
applications from monoliths to microservice architecture. In this understand and maintain. Microservice architecture is
transformation process, software development teams face the introduced to solve these problems.
challenge of migration of large applications to the new
Lewis and Fowler define the microservice architecture as an
architecture, where understanding the current application and
approach to develop a single system as a suite of small services,
reusing existing code base are important. In this paper, we
each running in its own process and communicating with
propose a new approach to transform existing applications into
lightweight mechanisms, often an HTTP resource API [1,2].
microservices using code repositories. We use evolutionary and
Microservice architecture is an intuitive concept, it advocates
static code coupling information, and the graph clustering
creating a system as a collection of autonomous services that
methodology, in order to automatically extract microservices interact with each other [1, 2]. Each microservice is designed to
from monoliths. In experimental analysis, we investigate two “do one thing and do it well”, known as the Unix philosophy [3].
software projects and our approach reach up to 89% of success Microservices are the next evolutionary design paradigm in
rate by comparing extracted microservices with the actual software not purely because of technical reasons but also
results. microservices enable companies to structure their system in the
same way they structure their teams, dividing responsibilities
CCS CONCEPTS among team members and building autonomous teams to act
• Computer systems organization → Cloud computing; • according to their needs. The microservice architecture is being
Software and its engineering → Software configuration adopted by many key technological players such as Netflix,
management and version control systems; • Software and its SoundCloud and Amazon [4, 5].
engineering → Software design techniques Correctly identifying software modules gains importance
with the increasing popularity of distributed systems and cloud
KEYWORDS computing, there has been a tendency to transform existing
Microservices, Graph Clustering, Software Architecture, monoliths into discrete and isolated services. Developers attempt
Microservice Transformation to manually identify modules in a software system to migrate
the underlying services into standard, autonomous and
ACM Reference format: distributed services. Distributing these services by transferring
them into cloud-based and service-oriented platforms properly
Permission to make digital or hard copies of all or part of this work for personal or can improve the performance, reliability and security of the
classroom use is granted without fee provided that copies are not made or programs. The common problem in these efforts is that
distributed for profit or commercial advantage and that copies bear this notice and
the full citation on the first page. Copyrights for components of this work owned
identifying components of monoliths that can be turned into
by others than ACM must be honored. Abstracting with credit is permitted. To cohesive services with well-defined boundaries and single
copy otherwise, or republish, to post on servers or to redistribute to lists, requires responsibility.
prior specific permission and/or a fee. Request permissions from
[email protected]. In this paper, we propose a method for decomposition of the
monolithic systems by identifying microservices automatically.
XP '18 Companion, May 21–25 2018, Porto, Portugal
© 2018 Association for Computing Machinery.
We obtain static and evolutionary coupling properties of
ACM ISBN 978-1-4503-6422-5/18/05…$15.00 software classes from existing code repositories and apply graph
https://doi.org/10.1145/3234152.3234195 clustering methods to identify microservices. To the best of our
XP '18 Companion, May 21–25 2018, Porto, Portugal S. Eski et al.
knowledge, this is the first research study that employs static monolithic application and show how this VM family turns into
and evolutionary coupling information together for automatic microservices by using image synthesis and analysis techniques.
extraction of microservices from monoliths. In this study, we In order to take benefits of microservices, [14] describes a
have two hypotheses that we have tested empirically: technique to identify and define microservices on a monolithic
enterprise system. They migrate a 750 KLOC banking system
Extracting microservices from monoliths using into microservice architecture with mapping database tables to
combination of static and evolutionary coupling gives subsystems, then create a dependency graph between facade and
better results than just using static coupling, because business classes, pair them and group this pair by relation with
evolutionary coupling can identify logical coupling subsystems and identify microservice candidates. They migrate
that cannot be seen in static analysis. monolith application to microservices using as a case study.
Extracting microservices from monoliths using Mazlami et al. use logical, semantic and developer coupling to
combination of static and evolutionary coupling gives extract microservices from existing systems [15]. They create
better results than just using evolutionary coupling. different graphs according to these couplings and cluster graphs
Since stable code parts are not changed so often and using their approaches which is an evaluated version of
some parts of code are lesser affected by change Minimum Spanning Tree algorithm, then they validate results
requests, we can see these relations in static analysis. with two quality metrics, defined by them, as team size
In our experimental analysis, we show that using both static reduction and average domain redundancy. They do not
and evolutionary coupling gives better results than just using compare results with a reference microservice model that is
static or evolutionary coupling. The remainder of this paper is provided by development teams or experts, and their results do
organized as follows: Related works are presented in the Section not include clustered module count and sizes. Also, their quality
2. The proposed method, system architecture and methodologies metrics give best results when each class is mapped as a
that are used in empirical analysis are presented in Section 3. microservice.
Section 4 shows the case studies and obtained results. Section 5
concludes the paper.
3 PROPOSED MICROSERVICE EXTRACTION
APPROACH
2 RELATED WORK
In this approach, we analyse static codes and software
Decomposing software systems has been an important branch in repositories to extract relations and changes in the software
the software engineering research discipline – extracting system. We represent the software system as a graph that shows
microservices from monoliths is the next evolutionary form of different relations and couplings between the classes. We apply
the original challenge of decomposing systems. The research for graph clustering technique on the graph to identify microservice
microservices starts from 2014 and increases following years, candidates. Model Representation:
and previous microservice studies are collected and classified
systematically in the survey articles [5, 6, 7, 8]. Decomposing Graph: G<V, E> where V is the set of vertices and E is
software systems has been an important branch in the software the set of directed edges.
engineering. Extracting microservices from monoliths is the next Vertices {vi} : Class or Interface
evolutionary form of the original challenge of decomposing Edges{ei}: Static and/or evolutionary coupling
systems. Static coupling: Inheritance, method call, aggregation,
Today some researchers have leant towards migration of creation, parameter, … etc
monoliths to microservice architecture published case studies Evolutionary coupling: Co-changes where two
and empirical studies [4, 9]. Several approaches have been artefacts change frequently.
declared to transition into a microservice architecture [10, 11, 12,
Shape: Same shape and colour indicates vertices in the
13, 14, 15]. One of these approaches is defined as a strangulation
same reference microservice.
method [10, 11]. In this method, microservice is written when a
Cluster: Identified microservice candidates with our
change is needed and deciding which domain object is affected
proposed approach
by this change is conducted by domain experts. A sample work
on converting monoliths into microservices is done on Java
3.1 System Architecture of the Extraction
applications using Spring MVC [12], they propose a model-
centered process to analyze and visualize the current structure Methodology
and dependencies between the business layer and the data layer. The proposed system architecture of the extraction methodology
First, they identify and cluster Java Beans according to data they is given in Figure 1. The evolutionary Analysis module extract
manipulate and then form these groups according to persistence and save software change information using repositories. We
of shared types to find microservices. Kecskemeti et al. propose detect rename and move operation and protect historical
to [13], they introduce another methodology in their ENTICE information of renamed or moved class in the software
environment with creating a recipe based on a generic Virtual refactoring process. We extract evolutionary coupling by
Machine (VM) image, utilize this image using previous detecting changes between consecutive commits. The static
Analysis module extract static couplings on final revision of an
2
An Automatic Extraction Approach - Transition to Microservices
XP '18 Companion, May 21–25 2018, Porto, Portugal
Architecture from Monolithic Application
3
XP '18 Companion, May 21–25 2018, Porto, Portugal S. Eski et al.
4
An Automatic Extraction Approach - Transition to Microservices
XP '18 Companion, May 21–25 2018, Porto, Portugal
Architecture from Monolithic Application
Table 3: MoJoSim similarity results for Academics results may not be generalizable to all open-source projects or
commercial projects. More results are needed to be gathered
Coupling MoJoSim(A, B) #Microservice from projects with different characteristics.
S 71.81 10
E (2 OR 0.6) 61.22 19
5 CONCLUSION
S+E(2 OR 0.6) 74.03 3 In this paper, we propose a graph based microservice clustering
S+E(2 OR 0.8) 72.08 3 approach using static and evolutionary coupling between
S+E(3 OR 0.6) 77.78 4 software classes.
S+E(3 OR 0.8) 78.55 6 In empirical analysis, we show that using both static and
S+E(2 AND 0.3) 70.55 4 evolutionary coupling give better results than just using static
One of the differences between the reference model and coupling (Hypothesis 1) or evolutionary coupling (Hypothesis 2)
microservice candidates is that our model split academician for both eQuality and Academics projects. We displayed that
collection microservices to three microservices. Our method some extracted services were too big and violated single
combines some microservices into one microservice candidate. responsibility principle, so we sub-clustered these services in
After we investigate these candidates, we saw that combined order to decompose them into microservices. Extracted
microservices are related to each other for example browser- microservice candidates were compared with authoritative
crawler and faculty-crawler are combined since faculty-crawler reference microservice models that were prepared by developers.
has a strong relation with browser-crawler microservices. We measured similarity between candidates and actual services
In this part we tested our Hypotheses. In the experiment of and showed that the success rate of our approach reached to
eQuality project, we show that MoJoSim(A, B) reached up to 89%. Also, we examined the candidate microservices with
88.32 when using both coupling types together; on the other developers and analysed differences between the results of our
hand, when we used these methods separately, we got similarity approach and developers’ reference model. We saw that in some
success rates as 76.99 and 48.52 for static and evolutionary cases, our approach decomposed services into more
coupling respectively. In the experiment of Academics projects, microservices compared to developers’ model. Developers agreed
we saw similar results for MoJoSim(A, B) 78.55, 71.81 and 62.22 that more fine-grained microservices could be also developed
corresponding for both coupling, only static and only based on single responsibility principle. However, they preferred
evolutionary coupling respectively. to collect these fine-grained services in one microservices for
maintenance purposes.
As a future study, we are planning to improve our approach
by giving weights to graph edges to increase accuracy of
extraction results and automatically determining thresholds for
sub-clustering services. We are also planning to experiment with
more industrial and open-source projects and compare result
using different clustering algorithms.
REFERENCES
1 S. Newman, Building Microservices, O’Reilly, 2015.
2 M. Fowler, J. Lewis, Microservices a definition of this new architectural term,
Retrieved 2018, January, from
http://martinfowler.com/articles/microservices.html.
3 Basics of the Unix Philosophy - Chapter1.Philosophy, Retrieved 2018, March
from: https://homepage.cs.uri.edu/~thenry/resources/unix_art/ch01s06.html
4 C. Y. Fan and S. P. Ma, Migrating Monolithic Mobile Application to
Microservice Architecture: An Experiment Report, 2017 IEEE International
Conference on AI & Mobile Services (AIMS), Honolulu, HI, 2017, pp. 109-112.
5 N. Alshuqayran, N. Ali, R. Evans, A systematic Mapping Study in Microservice
Architecture, IEEE 9th International Conference on Service-Oriented
Figure 5: Academics microservice candidates Computing and Applications, 2016, DOI: 10.1109/SOCA.2016.15
6 Vural H., Koyuncu M., Guney S. (2017) A Systematic Literature Review on
Microservices, In: Gervasi O. et al. (eds) Computational Science and Its
4.3 Threats to validity Applications – ICCSA 2017. ICCSA 2017. Lecture Notes in Computer Science,
vol 10409. Springer, Cham
A threat to internal validity is that the developers extract 7 C. Pahl, P. Jamshidi, Microservices: A Systematic Mapping Study, Proceedings
authoritative reference microservices from projects manually. of the 6th International Conference on Cloud Computing and Services
Science, pp. 137-146, 2016, DOI: 10.5220/0005785501370146.
Although, to overcome misclassification, developers cross-check 8 D. Taibi, V. Lenarduzzi, C. Pahl., Architectural Patterns for Microservices: a
reference microservices, we cannot exclude that manual analysis Systematic Mapping Study, 8th International Conference on Cloud Computing
could have miss assigning some classes to microservices. Threats and Services Science, XCLOSER 2018
9 J. P. Gouigoux and D. Tamzalit, From Monolith to Microservices: Lessons
to external validity concern the generalization of the results. Learned on an Industrial Migration to a Web Oriented Architecture, 2017 IEEE
Although we select two commercial projects for this study, the International Conference on Software Architecture Workshops (ICSAW),
Gothenburg, 2017, pp. 62-65
5
XP '18 Companion, May 21–25 2018, Porto, Portugal S. Eski et al.