Professional Documents
Culture Documents
net/publication/321198405
CITATIONS READS
25 663
5 authors, including:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Andrei Furda on 25 March 2019.
be increased by reducing the mean time to repair (MTTR). Listing 2. Examples of stateful procedures.
f u n c t i o n p1 ( ) {
This can be achieved by allowing the load balancer to stop static $static state = 0;
routing incoming consumer requests to failed microservice $ s t a t i c s t a t e ++;
instances and to re-route them to operating instances in- return $ s t a t i c s t a t e ;
stead. The load balancer is only able to immediately route }
$glbl state ;
requests to already deployed redundant microservices if f u n c t i o n p2 ( ) {
these are stateless. global $glbl state ;
MTBF $ g l b l s t a t e ++;
Availability = (1) return $ g l b l s t a t e ;
MTBF + MTTR }
f u n c t i o n p3 ( ) {
Successful Responses r e t u r n p1 ( ) ;
Reliability = ∗ 100% (2)
Total Requests }
Stateless microservices also achieve a higher system The most common form of legacy code statefulness is
reliability through redundancy. The reliability of a system found in objects (class instances). An object can be stateful
is defined as the ratio between the number of successful by instantiating a class that implements stateful procedures
responses to the total number of requests (Equation 2) [1]. (Section 3.2.2) or one with (state) properties (Listing 3).
If the services are stateless, the load balancer can increase
State properties can be static, or non-static. Static proper-
the probability of receiving a successful response from one
ties lead to class-level statefulness that affect all instances of
of the available microservices by sending the same request
a class when modified (Listing 3, class StatefulStatic). In this
to multiple available microservices, without the need to
case, the state can only be changed for all class instances at
synchronize or replicate session state in a session database.
once, not for individual ones. Non-static properties on the
other hand affect individual class instances (Listing 3, class
3.2 Statefulness in legacy code StatefulNonStatic).
In the context of extracting microservices, legacy source
Listing 3. Stateful classes using a static state variable.
code is stateful if it is capable of retaining values (i.e., its class StatefulStatic {
state) between invocations and is able to generate outputs private s t a t i c $state ;
that depend not only on the current input parameters, but p u b l i c s t a t i c f u n c t i o n s e t S t a t e ( $s ) {
also on the previously retained state (Figure 7). s e l f : : $ s t a t e = $s ;
}
public function getState ( ) {
3.2.1 Statefulness in the context of microservices return s e l f : : $state ;
When analysing the statefulness of legacy code for the pur- }
}
pose of microservice extraction, the inclusion or exclusion class StatefulNonStatic {
of state variable definitions (i.e., in-memory session state) private $state ;
determines whether or not the analysed code is stateful p u b l i c f u n c t i o n s e t S t a t e ( $s ) {
$ t h i s −> s t a t e = $s ;
with respect to a specific state variable. Figure 7 depicts this }
in an example. Session state variable s1 is defined within public function getState ( ) {
the analysed code, a second state variable s2 is defined r e t u r n $ t h i s −> s t a t e ;
outside the analysed code (this could be either session or }
}
domain state) and a third domain state value s3 is stored
5
replicas is not feasible (Figure 8). Instead, only one replica is [10] I. Gorton. Software Architecture for Big Data and the Cloud, chapter
accessed for read/write operations, resulting in temporary Hyper Scalability - the Changing Face of Software Architecture.
Elsevier, 2017.
data inconsistencies for the benefit of increased availability [11] S. Johann. Dave Thomas on innovating legacy systems. IEEE
and performance. The inconsistencies are eventually cor- Softw., 33(2):105–108, 2016.
rected through synchronisation of the data replicas. Data [12] J. Kabbedijk, C.-P. Bezemer, S. Jansen, and A. Zaidman. Defining
inconsistencies can persist if data entries in different replicas multi-tenancy: A systematic mapping study on the academic and
the industrial perspective. Journal of Systems and Software, 2014.
have been modified at the same time. In such a case, rules [13] V. Narasayya, S. Das, M. Syamala, B. Chandramouli, and
specify how such issues are resolved, for example by simply S. Chaudhuri. Sqlvm: Performance isolation in multi-tenant re-
dropping one of the modified versions [4]. We are of the lational database-as-a-service. 2013.
[14] C. Pautasso, O. Zimmermann, M. Amundsen, J. Lewis, and N. Jo-
view that this rule only works in a non data-critical system, suttis. Microservices in practice, part 1: Reality check and service
while a critical enterprise system would require a roll-back. design. IEEE Software, 34(1):91–98, Jan 2017.
[15] R. Taft, W. Lang, J. Duggan, A. J. Elmore, M. Stonebraker, and
D. DeWitt. Step: Scalable tenant placement for managing database-
5 C ONCLUSION as-a-service deployments. In Proceedings of the Seventh ACM
Symposium on Cloud Computing, pages 388–400. ACM, 2016.
We have described three basic challenges for migrating [16] W. Vogels. Eventually consistent. Communications of the ACM,
52(1):40–44, 2009.
legacy code to microservices. A best practice solution is to
[17] S. Walraven, E. Truyen, and W. Joosen. Comparing PaaS offerings
develop a microservice iteratively, focussing on: in light of SaaS development. Computing, 96(8):669–724, 2014.
(i) eliminating statefulness from the extracted legacy [18] O. Zimmermann. Architectural refactoring: A task-centric view on
software evolution. IEEE Software, 32(2):26–29, 2015.
code, [19] O. Zimmermann. Microservices tenets. Computer Science - Research
(ii) implementing multi-tenancy functionalities, and and Development, pages 1–10, 2016.
(iii) solving potential new introduced data consistency
challenges.
It is important to note that while these three challenges
are interrelated, they are created by different types of re-
quirements. Multi-tenancy is driven by the economic advan-
tages resulting from sharing resources and infrastructure,
while taking into consideration the tenants’ data privacy
needs. Statefulness is a characteristic that influences non-
functional requirements with respect to scalability, reliability
and availability of the modernized system. Finally, data
consistency is a functional requirement that defines the
correct operation of the system and ranges from relaxed
eventual consistent systems to strictly consistent ones.
6 ACKNOWLEDGMENTS
This research was supported in part by ARC-DP grant
DP140103788.
R EFERENCES
[1] E. Bauer and R. Adams. Reliability and Availability of Cloud Com-
puting. Wiley-IEEE Press, 2012.
[2] F. Chong, G. Carraro, and R. Wolter. Multi-tenant data archi-
tecture. http://msdn.microsoft.com/en-us\\/library/aa479086.
aspx, 2006. last accessed Jan 2017.
[3] T. Erl. SOA design patterns. Prentice Hall, Upper Saddle River, NJ,
1st edition, 2009.
[4] C. Fehling, F. Leymann, R. Retter, W. Schupeck, and P. Arbitter.
Cloud Computing Patterns. Springer Verlag, 2013 edition, 2014.
[5] M. Fowler. Patterns of enterprise application architecture. Addison-
Wesley, Boston, 2003.
[6] M. Fowler. Eventual consistency. http://martinfowler.com/
articles/microservice-trade-offs.html#consistency, 2015. last ac-
cessed Dec. 2016.
[7] M. Fowler, K. Beck, J. Brant, W. Opdyke, and D. Roberts. Refactor-
ing: improving the design of existing code. Addison-Wesley, Reading,
MA, 1999.
[8] A. Furda, C. Fidge, A. Barros, and O. Zimmermann. Software
Architecture for Big Data and the Cloud, chapter Re-Engineering
Data-Centric Information Systems for the Cloud - A Method and
Architectural Patterns Promoting Multi-Tenancy. Elsevier, 2017.
[9] M. F. Gholami, F. Daneshgar, G. Low, and G. Beydoun. Cloud
migration process-a survey, evaluation framework, and open chal-
lenges. J. Syst. Softw., 120(C):31–69, 2016.