Elsevier

Computer Networks

Volume 187, 14 March 2021, 107786
Computer Networks

Reaching consensus in decentralized coordination of distributed microservices

https://doi.org/10.1016/j.comnet.2020.107786Get rights and content

Abstract

Decentralized Microservice compositions can be implemented in the environments of mobile cloud, edge or other computing paradigms. When a decentralized microservice composition wants to reach consensus among its participants at runtime, missing a coordinator makes it to adopt a feasible mechanism to coordinate service components. This work studies the issue. It begins with analyzing data dependences among composite microservices, and then summaries basic structural patterns in the compositions according to the dependences. Based on the Saga method, this paper proposes coordination mechanisms for the composite microservices, and conducts two different experiments to evaluate the mechanisms. The experimental results show that the proposed mechanisms can prompt composite microservices to reach consensus at runtime, and the corresponding implementations can work effectively.

Introduction

Mobile Cloud Computing (MCC) [1,2], Edge Computing [[41], [42], [43], [44],51] and other computing paradigms can provide diverse computing resources for distributed applications. Among them, an MCC environment allows application components to work in cloud servers, cloudlets, or mobile devices [1]; and yet, an edge environment push the computation and communication resources from the cloud to the edge of networks to provide services and perform computations [41,51]. Applications in such environments should span different computing resources to execute in pursuit of better performance and the diversity of services. Constructing this kind of applications usually relies on applying the web service and web service composition [35] techniques. A decentralized service composition is a web service composition who does not use independent central coordinators, and, therefore, the participants are coordinated by exchanging messages directly. The features make the composition flexible, extensible, and independent manageable such that it has been widely applied in mobile computing, IoT, and other distributed applications [3], [4], [5].

The consensus problem, as an elemental issue of distributed systems or applications, has been widely discussed [[45], [46], [47],52]. Service-based applications may also require composite services to reach consensus at runtime for ensuring data consistency. Take an application that is composed of an ordering service as well as an inventory service as an example. The services should reach a consensus for each order request at runtime, since all information about an order and related goods should be recorded properly in the services. To reach the consensus, a proper transactional programming model can be implemented [[6], [7], [8],48]. The idea leverages transactions to achieve a logic (sub-)goal only if all interactions within the composition complete successfully [6]. For coordinating composite services which have been configured local transactions, two-phase commit (2PC) [9,10] has been adopted [11]. The method uses a central coordinator to lead participants to commit or abort their transactions. In real situations, the method requires all participants (in a composition) to wait for a decision (of a coordinator). However, if the business data in composite services has data dependences, applying 2PC may increase the waiting time of the participants. Saga [12] is an alternative method for service compositions [13,14,48]. Originally, a saga is a long-lived transaction, which is written as a sequence of transactions (i.e. sub-transactions) that can be interleaved with other transactions [12]. A saga should configure compensations for transactions and execute them when errors occur [12,48]. Based on the method, composite services could follow commands of a coordinator and act like a saga. Participants in a Saga-based composition do not wait for a decision at the same time, when compared with 2PC, but compensating a transaction in a service may let other transactions meet “dirty” data. Apart from these, more issues should be considered before applying the methods, since a communication failure or a node failure may let a participant abort its task while other participants may have committed their tasks.

Transaction support is an important quality-of-service requirement [8], and transactions can be treated as one of the most important crosscutting concerns in the service composition [6]. A decentralized service composition has no central coordinator, so it needs a feasible coordination mechanism to trigger the transactions such that consensus across the participants can be achieved. Furthermore, as discussed previously, issues around or about the compositions may become obstacles for directly applying the proposed methods. This paper focuses on the topic, and it studies the mechanism for the fine-grained web services, which are also called as microservices [2]. Based on the Saga method, this paper proposes coordination mechanisms for decentralized microservice compositions. For evaluating the proposed mechanisms, two experiments are conducted. The experimental results show that the proposed mechanisms can work effectively and efficiently. The contribution of this paper can be stated as follows: (1) We represent and analyze data dependences between microservices under the help of the categorical tools; according to the dependences, we summary basic structural patterns in decentralized microservice compositions. (2) We propose coordination mechanisms for the compositions. (3) We evaluate the proposed mechanisms using real application data.

The rest of this paper is structured as follows. Section 2 provides an overview of related work. Section 3 introduces the basic concepts and tools which are used in the paper. Section 4 discusses main issues about constructing decentralized microservice compositions whose participants can reach consensus at runtime. Experimental evaluations and performance analysis are presented in section 5. And the last section concludes the whole paper.

Section snippets

Related work

For obtaining consensus among application components, 2PC, three-phase commit (3PC) [15], Try-Cancel/Confirm (TCC) [16], and other approaches can be applied. 3PC adds one phase and timeouts for dealing with the blocking issue of 2PC. 2PC or 3PC based compositions may require participants to spend time on waiting for their decisions which are made by a central coordinator. Research in [17] presents a new transaction protocol that avoids blocking by releasing all of a transaction's locks during

Microservices and transactions

Constructing applications in the environments of cloud computing, edge computing, or others, heavily depends on microservices. When multiple composite microservices work together, the consensus problem should be considered, i.e. the services were able to agree on a system status. To reach the agreement, a proper transactional programming model can be implemented. The implementation work should apply transactions and coordination mechanisms properly, since microservices can be independently

Transactional microservice compositions

This section introduces decentralized microservice compositions whose participants can reach distributed consensus at runtime.

Evaluations

To evaluate the proposed mechanisms, two experiments are conducted. The experimental result considers the following items: (a) total request time, (b) finished requests and compensated requests, (c) resource reservation time in a service. For client programs, the total request time is the time of sending requests to a service composition, and it is measured by the time between sending the first request and receiving the last response. The finished requests and the compensated requests are the

Conclusion

Decentralized microservice compositions need feasible coordination mechanisms for reaching consensus among the participants, since they have no independent central coordinators. For the issue, this work begins with analyzing data dependences among composite microservices and summarizing basic structural patterns in the compositions. Based on the dependences, it proposes coordination mechanisms for the composite microservices that are built according to the Saga method. Two experiments are

CRediT authorship contribution statement

Gang Xue: Conceptualization, Methodology, Software, Data curation, Investigation, Validation, Writing - original draft. Shuiguang Deng: Supervision, Writing - review & editing. Di Liu: Writing - review & editing. Zeming Yan: Resources, Data curation, Investigation, Validation, Visualization.

Declaration of Competing Interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Acknowledgment

This research was partially supported by the National Key Research and Development Program of China (No. 2019YFD1101105), the National Science Foundation of China (No. U20A20173, No. 61772461), the Natural Science Foundation of Zhejiang Province (No. LR18F020003), and the Open Foundation of Key Laboratory in Software Engineering of Yunnan Province under Grant No. 2020SE318.

Gang Xue received the B.Eng. degree from Wuhan Technical University of Surveying and Mapping in 2000. He received the M.Eng. and Ph.D. degrees from Yunnan University in 2006 and 2009, respectively. From September 2019 to July 2020, he worked at Zhejiang University as a visiting scholar. He is currently an associate professor at the School of Software, Yunnan University, China. His research interests include service computing, edge computing, and embedded systems.

References (52)

  • N. Mihindukulasooriya et al.

    Seven challenges for RESTful transaction models

  • J.N. Gray

    Notes on data base operating systems

  • B.W. Lampson, H.E. Sturgis, Crash recovery in a distributed data storage system, 1979....
  • Advancing Open Standards for the Information Society (OASIS), Web Services Atomic Transaction (WS-AtomicTransaction)...
  • H. Garcia-Molina et al.

    Sagas

    ACM SIGMOD Rec.

    (1987)
  • C. Richardson

    Microservices Patterns: With Examples in Java

    (2018)
  • A. Rotem-Gal-Oz

    SOA Patterns

    (2012)
  • D. Skeen

    Nonblocking commit protocols

  • G. Pardon et al.

    Atomic distributed transactions: a RESTful design

  • T. Eldeeb, P.A. Bernstein, Transactions for distributed actors in the cloud, MSR-TR-2016-1001, 2016....
  • Advancing Open Standards for the Information Society (OASIS), Business Transaction Protocol, version 1.1.0, 2004....
  • Advancing Open Standards for the Information Society (OASIS), OASIS Web Services Transaction (WS-TX) TC....
  • Advancing Open Standards for the Information Society (OASIS), Web Services Coordination (WS-Coordination) Version 1.2,...
  • Advancing Open Standards for the Information Society (OASIS), Web Services Business Activity (WS-BusinessActivity)...
  • M. Von Riegen et al.

    Rule-based coordination of distributed web service transactions

    IEEE Trans. Serv. Comput.

    (2010)
  • C.A. Sun et al.

    Transaction management in service-oriented systems: requirements and a proposal

    IEEE Trans. Serv. Comput.

    (2011)
  • Cited by (4)

    • A Survey of Saga Frameworks for Distributed Transactions in Event-driven Microservices

      2022, Proceedings of the 3rd International Conference on Smart Technologies in Computing, Electrical and Electronics, ICSTCEE 2022
    • Comparison of Choreography vs Orchestration Based Saga Patterns in Microservices

      2022, International Conference on Electrical, Computer, and Energy Technologies, ICECET 2022

    Gang Xue received the B.Eng. degree from Wuhan Technical University of Surveying and Mapping in 2000. He received the M.Eng. and Ph.D. degrees from Yunnan University in 2006 and 2009, respectively. From September 2019 to July 2020, he worked at Zhejiang University as a visiting scholar. He is currently an associate professor at the School of Software, Yunnan University, China. His research interests include service computing, edge computing, and embedded systems.

    Shuiguang Deng is a full professor at the College of Computer Science and Technology in Zhejiang University. He received the B.S. and Ph.D. both in Computer Science from Zhejiang University in 2002 and 2007, respectively. He worked at Massachusetts Institute of Technology (MIT) in 2014 and at Stanford University in 2015 as a visiting scholar. His research interests include service computing, edge computing, business process management and big data.

    Di Liu received the B.Eng. and M.Eng. degrees from Northwestern Polytechnical University, Xi'an, China, in 2007 and 2011, respectively, and the Ph.D. degree from Leiden University, The Netherlands, in 2017. He is currently an assistant professor at the School of Software, Yunnan University, China. His research interests include the fields of real-time systems, energy-efficient multicore/many core systems, and cyber-physical systems.

    Zeming Yan is a master student at the School of Software, Yunnan University, China. He received the B.Eng. degree from Jishou University, China, in 2019. His research interests include service computing and edge computing.

    View full text