Professional Documents
Culture Documents
Using Microservices For Legacy Software
Using Microservices For Legacy Software
Microservices
companies are considering micro
service adoption as a viable option
for modernizing their existing soft
ware assets. Although some compa
Modernization
modernization—e.g., restructuring
and refactoring of existing legacy
applications—are also valid options.4
However, decomposing a large, com
plex application is far from trivial.
Holger Knoche and Wilhelm Hasselbring, Kiel University
Even seemingly easy questions like
“Where should I start?” or “What
services do I need?” can actually be
// Microservices promise high maintainability,
very hard to answer.
making them an interesting option for In this article, we present a pro
software modernization. This article presents cess to modernize a large existing
software application using micro
a migration process to decompose an service principles, and report on ex
application into microservices, and presents periences from implementing it in an
ongoing industrial modernization
experiences from applying this process project. We particularly focus on the
in a legacy modernization project. // process of actually decomposing the
existing application, and point out
best practices as well as challenges
and pitfalls that practitioners should
watch out for.
M AY/J U N E 2 0 1 8 | I E E E S O F T WA R E 45
FOCUS: MICROSERVICES
A1 A1
Client A Client A
C2 B1 C2 B1
A1 A1
Client A Client A
A1 A1 Platform migration
Client A Client A
Ad Client B Ad Client B
C1 C1
Ad Ad
Ad C2 B1 Ad C2 B1
Platform migration
FIGURE 1. Overview of the modernization process. (a) The initial situation. (b) Defining an external service facade. (c) Adapting
the service facade. (d) Migrating clients to the service facade. (e) Establishing internal service facades. (f) Replacing the service
implementations by microservices. Changes in the respective process steps are highlighted in blue.
46 I E E E S O F T WA R E | W W W. C O M P U T E R . O R G / S O F T W A R E | @ I E E E S O F T WA R E
provisional operations were seman mocking for the legacy database was, however, discarded, as this
tically matched against the expected proved to be a particular challenge. would have preserved the highly
operations. Ultimately, 29 service in All tests were therefore designed so complex interface structure the mod
terfaces with about 150 service oper that modifications to the test data ernization was aiming to improve.
ations were derived from more than were either rolled back or explicitly During the migration, a few ser
500 entry points. compensated. vice methods proved to be too finely
An important advantage of this grained, leading to performance deg
approach is that in addition to the Step 3: Migrating Clients to the radation due to invocation overhead.
actual facade, it also produces in Service Facade Therefore, these methods had to be
formation on how to replace the Once the service operations are im refined during the migration.
existing entry points with service op plemented, client applications can In our project, the client migra
erations, and provides candidates for start migrating to the new facade by tion took almost two years. To keep
adaptation. This information is used replacing their existing accesses with track of the overall migration prog
extensively in subsequent steps. service invocations (see Figure 1d). ress, we employed the staticanalysis
This step poses organizational as toolset used in step 1, regularly creat
Step 2: Adapting the Service Facade well as technical challenges and ing a report of modules still using the
After defining the service operations, usually consumes a large part of old entry points. This report was then
implementations must be supplied. the overall project time and budget, compared to the migration plans of
While it is possible to immediately since large parts of the client appli the client applications to ensure that
provide microservice implemen cations must be changed and tested. the migration proceeded as planned.
tations, we chose to first build an In order to support the develop
implementation by adapting the ex ment teams during the migration, we Step 4: Establishing Internal Service
isting system, as shown in Figure 1c. created a transition documentation. Facades
Thus, the client migration to the This documentation contained a tex The techniques described in steps 1
service facade and the platform tual description of how to replace to 3 can also be used to restructure
migration, which both posed con each of the entry points identified in applications internally (see Figure 1e).
siderable risk, were split into sepa step 1 with one or more service op Although this restructuring can be
rate steps, at the cost of creating a erations. For each of the new opera done in parallel with establishing the
throwaway implementation. tions, detailed descriptions and code external service facade, we decided to
A key challenge of this step is to snippets were provided to facilitate perform this step separately, as per
find appropriate candidates for adap the transition as much as possible. forming both restructurings at the
tation. For this task, the results from This documentation was considered same time was considered both too
the entry point analysis from step 1 very helpful by the developers. risky and resourcedemanding. Since
proved to be particularly helpful. For the actual migration, many no naming conventions could be ex
However, due the refinement of the client applications successfully em ploited, all programs were inspected
service operations, several operations ployed clientside adapters that manually and assigned to the appro
had to be implemented from scratch. emulated specific parts of the old priate components. Programs con
For a successful adaptation, it is interfaces using the new service taining functionality from different
imperative to ensure sufficient test facade. Thus, the changes to the components were assigned to all the
ing. This can be difficult in legacy existing modules could be reduced respective components and marked
environments, as such environments significantly. Following the idea of for separation. Potentially obso
may provide little to no facilities the Tolerant Reader pattern, 5 these lete programs were flagged for later
for common testing techniques like adapters relied on only those fields deletion.
mocking. The new microservices and operations actually required
are usually much easier to test, as for the respective application, thus Step 5: Replacing the Service
technologies like Docker Com preventing interface changes from Implementations with Microservices
pose can be used to set up environ trickling into the client applications. Once all desired service facades are
ments in an ad hoc fashion. In our The idea of creating a shared adapta established, the process of actually
modernization project, the lack of tion facility for all client applications introducing microservices can begin,
M AY/J U N E 2 0 1 8 | I E E E S O F T WA R E 47
FOCUS: MICROSERVICES
48 I E E E S O F T WA R E | W W W. C O M P U T E R . O R G / S O F T W A R E | @ I E E E S O F T WA R E
ABOUT THE AUTHORS
matter. Therefore, additional mate
rial on the topic has been compiled
in the “Further Reading” sidebar. HOLGER KNOCHE is a senior software architect at b1m
Even though our modernization Informatik and a PhD student in Kiel University’s Software
is not yet complete, we have already Engineering Group. His research interests include software
reached essential goals, as we were architecture and software modernization, especially runtime
able to eliminate uncontrolled access performance and data consistency during the move toward
to the internals of the application decentralized architectures such as microservices. Knoche
and we met the first batch of new received a master’s in computer science from FHDW Han-
requirements on time. Furthermore, nover. He’s a member of the German Association for Computer
practices like automated testing and Science. Contact him at hkn@informatik.uni-kiel.de.
code reviews have been established
as a byproduct of the moderniza
tion, which is considered a notable WILHELM HASSELBRING is a professor of software engi-
success. neering at Kiel University. In the Software Systems Engineer-
In retrospect, we conclude that ing competence cluster, he coordinates technology-transfer
despite the additional cost of creat projects with industry. His research interests include software
ing throwaway implementations, engineering and distributed systems, particularly software
separating the client migration from architecture design and evaluation. Hasselbring received a
the platform migration was the right PhD in computer science from the University of Dortmund.
thing to do in this particular project, He’s a member of ACM, the IEEE Computer Society, and the
as several technical challenges are German Association for Computer Science. Contact him at
still not solved. For projects with a hasselbring@email.uni-kiel.de.
less risky platform migration, how
ever, this effort is not justified, and
new service implementations should
be immediately provided as micro
services. Furthermore, due to the
effort involved, this process is viable
only for migrating large, complex Systems,” Proc. 26th Int’l Conf. 11. A. Balalaie, A. Heydarnoori, and P.
software systems with a high busi Software Eng. (ICSE 04), 2004, pp. Jamshidi, “Microservices Architec
ness value. 117–126. ture Enables DevOps: Migration to
5. M. Fowler, “Tolerant Reader,” 9 May a CloudNative Architecture,” IEEE
References 2011; martinfowler.com/bliki Software, vol. 33, no. 3, 2016, pp.
1. J. Lewis and M. Fowler, “Micro /TolerantReader.html. 42–52.
services,” 2014; martinfowler.com 6. M. Nygard, Release It! Design and 12. B. Familiar, Microservices, IoT, and
/articles/microservices.html. Deploy Production-Ready Software, Azure: Leveraging DevOps and
2. W. Hasselbring and G. Steinacker, Pragmatic Bookshelf, 2007. Microservice Architecture to Deliver
“Microservice Architectures for Scal 7. L. Bass, I. Weber, and L. Zhu, SaaS Solutions, Apress, 2015.
ability, Agility and Reliability in DevOps: A Software Architect’s 13. J. Carnell, Spring Microservices in
ECommerce,” Proc. IEEE Int’l Conf. Perspective, AddisonWesley, 2015. Action, Manning, 2017.
Software Architecture Workshops 8. S Newman, Building Microservices,
(ICSAW 17), 2017, pp. 243–246. O’Reilly, 2015.
3. M. Stine, Migrating to Cloud-Native 9. M. Richards, Microservices AntiPat-
Application Architectures, O’Reilly, terns and Pitfalls, O’Reilly, 2015.
2015. 10. G. Steinacker, “On Monoliths and Read your subscriptions
4. W. Hasselbring et al., “The Dublo Microservices,” 2015; dev.otto.de through the myCS
publications portal at
Architecture Pattern for Smooth /2015/09/30/onmonolithsand
Migration of Business Information microservices.
http://mycs.computer.org
M AY/J U N E 2 0 1 8 | I E E E S O F T WA R E 49