Introduction

With the development of the Internet and cloud computing, increasingly more services are provided on the Internet [1,2,3,4,5]. As a method of utilizing services, service composition has been widely used in different fields [6,7,8]. It combines atomic services in different areas to meet the needs of users with multiple functions and different QoSs. The service composition approach has been widely used in different industries, such as cloud manufacturing [7, 9, 10] and metro services [11].

The service composition approach is important both to the user and to the benefits of the entire system. For the user, it is necessary to meet the user's functional and performance requirements. For service providers, it is necessary to improve overall efficiency while meeting the needs of users. Most service composition methods take into account the user's QoS. These QoSs include both hard requirements [12,13,14,15], such as time limits [3, 16,17,18] and costs [6, 19,20,21,22], and soft requirements [11, 18, 23,24,25,26,27,28,29,30,31,32], such as security [4, 5, 9, 10, 33], reliability and flexibility.

Past work has mainly focused on researching service composition methods to meet user requirements and achieve system scheduling goals. These methods include Markov method [6], GA (genetic algorithm) [34], blockchain method [12], and deep learning method [11]. The scheduling targets of those service composition methods include (1) meeting time requirements, (2) reducing cost, (3) ensuring security, (4) satisfying reliability, and (5) a tradeoff between some of them [5, 19, 21, 35,36,37].

On the internet, different clouds provide different services. A single cloud cannot provide enough services for a user. Most of the time, a service request may need multiple clouds to obtain the service. For example, when we buy clothes on the internet, we need to visit the website to look for the related clothes, then we pay the money through the service provided by someone bank service, last, a service provided by a courier services company to send the clothes to us.

In the past, service composition methods rarely considered energy consumption [38], especially in a multicloud environment. The energy consumption of transferring files between clouds and the energy consumption of users are due to sending and receiving files. In this paper, we focus on the energy consumption for transferring files between clouds and the energy consumption for transferring files of users. We pay attention to the energy consumption of users, because reducing the energy consumption of mobile devices (including IoT devices) is very important. The mobile device has a limitation of the energy supply; if we can reduce the energy consumption, the work time for the mobile device would be lengthened. When we support every cloud that has the same energy efficiency, then, the energy consumption for transferring between clouds is the most important aspect of energy consumption for the service. So, in the paper, we major pay attention to the two kinds of energy consumption for transferring files.

The paper is organized as follows: "Introduction" section is the introduction. "Related works" section gives the related work of the service composition. It also gives an introduction to the service composition method that considers energy consumption. "System framework for service composition in multiclouds" section introduces the framework of service composition under a multicloud environment. We give the models used for service composition in "System model of service composition in the multicloud environment" section. "Service composition method under multicloud environment" section presents the proposed service composition method based on GA. "Simulation and comparisons" section presents the simulation and comparison. "Conclusions and future work" section presents the conclusion and future work.

Related works

Service composition methods have been widely researched in recent decades. Most of the methods try to meet the QoS requirement [4]. S. Sefati et al. [6] used a hidden Markov model (HMM) and an ant colony optimization (ACO) for the service composition that targets enhancing the QoS. They used the trained HMM (hidden Markov model) to predict QoS. Based on the QoS estimation result, they used the ACO algorithm to find a suitable service composition result. To address the complexity (the number of candidate services is very large) of the service composition, R. Boucetti et al. [34] combined genetic algorithms and neural networks (NN) for QoS-aware services composition for the context of large-scale environments. They decomposed the QoS intervals into M QoS-levels. GA obtains the ideal theoretical composition with global QoS optimization, and NN is used to eliminate the IoT services, and only keeps the services having the same QoS level of the atomic services to the ideal composition given by GA.

With the development of the cloud, the service composition under multicloud environment has also received attention, and some methods have been proposed to solve the service composition problem under multicloud environments [39,40,41,42,43]. K. Kritikos et al. [41] considered the different types of requirements of the service request, and gave a service composition approach according to the requirement. B. Pang et al. [42] gave a formal concept for service composition under the multicloud environment about multiple users. They first adopted collaborative filtering to obtain the services request of the target user, then they constructed the service–provider concept, and finally, a way is given to select the best multicloud composition and give recommended results for the target user. P. Kendrick et al. [39] used agent-matchmakers and agent representatives for a multiagent-based service composition method. With the help of multiple agents, it can obtian the service composition efficiently. To solve the problem of the security of the service composition problem under the multicloud environment, F. Lahmar et al. [40] proposed a security-aware multicloud service composition approach using fuzzy formal concept analysis (fuzzy FCA) and rough theory (RS) set to guarantee security. A. Souri et al. [43] presented a hybrid formal verification approach to assess the service composition in multicloud environments targeted at reducing the number of clouds of a service request and meeting the required level of quality of service (QoS). Other service composition methods we introduce in "Simulation and comparisons" section include All-C [44,45,46], Bas-C [44,45,46], Smt-C [44,45,46], Swm-C [47], and Fast-C [48].

With more attention being given to the energy consumption of computing systems, energy-aware service composition has also been emphasized by some researchers [49, 50]. D. Zeng et al. [51] solved the energy-efficient service composition problem in a green energy-powered cyber–physical fog system, and jointly considered source rate control, load balancing, and service replica deployment. They formulated the problem as a mixed integer linear programming problem and used a heuristic to reduce the complexity of the problem. For the same reason, J. Ibrahim et al. [52] proposed an energy-aware mechanism to optimize the mobile cloud service composition by using a hybrid shuffled frog leaping algorithm and genetic algorithm. To solve the limitations in storage, computation, and energy, E. Tong et al. [53] proposed hierarchical energy-efficient service selection to address the dynamic characteristics of the Internet of Things. The method works well under the dynamic network state. S. Deng et al. [54] focused on the problem of mobile service composition in terms of energy consumption. It presented energy consumption aggregation rules for composite services with different structures. They used GA to solve the problem. Those studies always try to reduce the energy consumption of all service requests.

Different from past research, our target is to reduce the energy consumption of users and the energy consumption of transferring files between clouds. Because the network is always dynamic, so the energy consumption between users and clouds is dynamic. Especially when every cloud has the same energy efficiency, the energy consumption for transferring files is the most important aspect of energy consumption.

System framework for service composition in multiclouds

The system framework

In the system, there are multiple clouds and every cloud provides some atomic services. A service request needs to visit some clouds to obtain all atomic services in the service request.

Figure 1 is the service architecture that we adopt in the multicloud environment:

  • Each cloud center (C1 ~ C9) has multiple services, and each service has multiple instances of atomic services. For example, cloud center C4 provides two atomic services Service4 and Service5.

  • A multicloud environment consists of multiple clouds with different \(MCE=\{{C}_{1},\hspace{0.33em}{C}_{2},\hspace{0.33em}...,\hspace{0.33em}{C}_{MCEN}\}\), and the services provided by these clouds have different QoS.

  • The user (User) puts forward the information of requirements to the cloud management center (Cloud manager), and this information includes the required web services and their QoSs, even including cost and other information;

  • The service management center is responsible for service composition work according to the requirements of the cloud center. It not only completes the system targets, but also needs to meet the user’s requirements.

Fig. 1
figure 1

System model of the service composition under a multicloud

QoSs used in the paper

We consider six QoSs in the paper:

  • Cost (Price): Expenses are usually measured in monetary terms, and generally maintain a relatively stable state. Usually, the cost always is related to the processing time and the type of atomic services.

  • Availability: Availability is usually expressed as the ratio of the time it can be accessed over a while to the total time, so it can be quantified as an exact value in the interval [0, 1]. Availability is the ratio of the time the system can operate normally to the total time.

  • Response time (Time): Time refers to the time from the start of obtaining the right to use the resource to the time when the resource is released. The lower the response time of the cloud service, the higher the satisfaction of the general user, and the more likely the system will get better benefits.

  • Reliability: Reliability is a user-perceived indicator that is subjective, so it is difficult to quantify. Generally, reliability is divided into several levels.

  • Reputation: Usually obtained from customer feedback, it is subjective. Since this is related to the needs of users, there may be differences in the perception of different users. Generally, users give feedback (score) after they have used some atomic services and the system gives a reputation according to the feedback of various users. Since reputation is also a generally subjective description, it is sometimes not feasible.

  • Security (Security): Many current researchers also regard security as a basic QoS attribute. With the wide application of cloud computing, any individual, enterprise, or unit can obtain related services from the cloud through the Internet. The openness of the system makes its security of the system more important than ever.

System model of service composition in the multicloud environment

Structure of services

In this section, the QoS fitting calculation methods of several common combined structures are introduced: sequence structure (Fig. 2a), loop structure (Fig. 2b), and choice structure (Fig. 2c).

Fig. 2
figure 2

Three kinds of service composition structures

Sequence structure

The sequence structure is shown in Fig. 2a. Its execution time and price are obtained by accumulating the corresponding values of the three atomic services, its reliability and availability are obtained by multiplying the corresponding values of the three atomic services, and the reputation takes the minimum value of the three atomic services.

Loop structure

The loop structure is shown in Fig. 2b, assuming that the atomic service loops \(N\) times. The execution time and price are \(N\) times the corresponding values of the three atomic services. The reliability and availability are obtained by multiplying the corresponding values of the three atomic services. Reputation is the reputation of the atomic service.

Choice structure

The loop structure is shown in Fig. 2c, assuming that the probability of execution of the \(i\) th atomic service is \(p(i)\). The six attributes are obtained by multiplying the corresponding value and the relative probability of all atomic services. In Table 1, \({QoS}_{i}^{RT}\) is the value of the response time of the \(i\) th atmospheric service (same as other parameters).

Table 1 QoS composition methods for three structures

In fact, many complex service structures can be regarded as a combination of these three basic structures. In other words, we can obtain services with higher complexity by extending those three structures.

Energy consumption model for service composition

Since services are executed in different clouds, data are transferred between various cloud centers, that is, a large amount of data needs to be transferred (Fig. 2). While transferring data, energy consumption occurs for sending files and receiving files. Because we suppose that the energy efficiency of each virtual center is the same, we do not consider the cost of executing jobs caused by the heterogeneity of virtual centers [53, 54].

According to the relevant literature, the energy consumption of file uploading is different from that of downloading. If only a small file is uploaded, and the large files are all in a cloud center, the energy consumption of file transmission will be reduced. We assume that the user's sending power consumption is \({U}^{sp}\), and the receiving power consumption is \({U}^{rp}\). The sending power consumption and the receiving power consumption of cloud \({C}_{j}\) are \({C}_{j}^{sw}\) and \({C}_{j}^{rw}\), respectively. Suppose the service request sequence is \(R=\{{r}_{1},{r}_{2},\dots ,{r}_{l}\}\). The service is a sequence structure (if it is not a sequence structure, it can be changed to linear in chronological order), and the output and output file sizes of \({r}_{l}\) are \({r}_{l}^{in}\) and \({r}_{l}^{out}\). \({E}_{U}\left(R\right)\), \({E}_{R}\left(R\right)\), \({E}_{S}\left(R\right)\) represent user energy consumption, (between different clouds) file sending energy consumption, and (between different clouds) file receiving energy consumption, respectively. \(cksc\left({l}_{k-1},{l}_{k}\right)\) returns whether the subservice (\({l}_{k-1}\),\({l}_{k}\)) is in a cloud; if so, it returns 0; otherwise, it returns 1. Formulas (1, 2, 3 and 4) are used to calculate the energy consumption of different aspects (Fig. 3).

Fig. 3
figure 3

Energy consumption model for the multicloud environment

$${E}_{U}\left(R\right)={l}_{1}^{in}*{U}^{sp}+{l}_{k}^{in}*{U}^{rp}$$
(1)
$$E_R\left(R\right)={\textstyle\sum_2^{lend}}l_k^{in}\ast cksc\left(l_{k-1},l_k\right)\ast PWR(l_k)$$
(2)
$$E_S\left(R\right)={\textstyle\sum_1^{lend-1}}l_k^{out}\ast cksc\left(l_{k-1},l_k\right)\ast PWS(l_k)$$
(3)
$${E\left(R\right)=E}_{U}\left(R\right)+{E}_{R}\left(R\right)+{E}_{S}\left(R\right)$$
(4)

Service composition method under multicloud environment

The QoS management for service composition under a multicloud environment

When multiple clouds can provide the service to the user. How to judge which atomic service is the best that is a problem for us. We suppose all the services provided by various clouds are denoted as:

$${C}_{i}=\{<{P}_{i,sid}^{RT},{P}_{i,sid}^{CT},{P}_{i,sid}^{REL},{P}_{i,sid}^{PAV},{P}_{i,sid}^{PEP},{P}_{i,sid}^{PSE}>\}$$
(5)

\(i\) and \(sid\) are the identifiers of the cloud and the atomic service, respectively. \({P}_{i,sid}^{RT}\), \({P}_{i,sid}^{CT}\), \({PS}_{i,sid}^{REL}\), \({P}_{i,sid}^{PAV}\), \({P}_{i,sid}^{PEP}\), and \({P}_{i,sid}^{PSE}\) are the response time, cost, reliability, availability, reputation, and security of service \(sid\) in cloud \(i\), and we take the service as \({P}_{i}^{sid}=<{P}_{i,sid}^{RT},{P}_{i,sid}^{CT},{P}_{i,sid}^{REL},{P}_{i,sid}^{PAV},{P}_{i,sid}^{PEP},{P}_{i,sid}^{PSE}>\).

The service request \({R}_{j}\) can be denoted as follows:

$${R}_{j}=\{<{R}_{j,sid}^{RT},{R}_{j,sid}^{CT},{R}_{j,sid}^{REL},{R}_{j,sid}^{RAV},{R}_{j,sid}^{REP},{R}_{j,sid}^{RSE}>\}$$
(6)

\(j\) is the identifier of a service request. \({R}_{j,sid}^{RT}\), \({R}_{j,sid}^{CT}\), \({R}_{j,sid}^{REL}\), \({R}_{j,sid}^{RAV}\), \({R}_{j,sid}^{REP}\), and \({R}_{j,sid}^{RSE}\) are the response time, cost, reliability, availability, reputation, and security of the atomic service request \({R}_{j}\).

For the response time, \(\overline{RT}\) and \({\sigma }_{RT}\) are the average value and variance of the response time of the atomic service in the service requests (same to other parameters). To normalize the QoS value of the service request \({R}_{j}\) and the QoS in the cloud \({C}_{i}\), we give the definition:

$${nP}_{i,sid}^{RT}=0.5+\frac{{P}_{i,sid}^{RT}-\overline{RT}}{2\times \beta {\sigma }_{RT}}$$
(7)
$${nR}_{j,sid}^{RT}=0.5+\frac{{R}_{j,sid}^{T}-\overline{RT}}{2\times \beta {\sigma }_{RT}}$$
(8)

Same for other QoSs used in the paper:

$${nP}_{i,sid}^{CT}=0.5+\frac{{P}_{i,sid}^{CT}-\overline{CT}}{2\times \beta {\sigma }_{CT}}$$
(9)
$${nR}_{j,sid}^{CT}=0.5+\frac{{R}_{j,sid}^{CT}-\overline{CT}}{2\times \beta {\sigma }_{CT}}$$
(10)
$${nP}_{i,sid}^{REL}=0.5+\frac{{P}_{i,sid}^{REL}-\overline{REL}}{2\times \beta {\sigma }_{REL}}$$
(11)
$${nR}_{j,sid}^{REL}=0.5+\frac{{R}_{j,sid}^{REL}-\overline{REL}}{2\times \beta {\sigma }_{REL}}$$
(12)
$${nP}_{i,sid}^{AV}=0.5+\frac{{P}_{i,sid}^{AV}-\overline{AV}}{2\times \beta {\sigma }_{AV}}$$
(13)
$${nR}_{j,sid}^{AV}=0.5+\frac{{R}_{j,sid}^{AV}-AV}{2\times \beta {\sigma }_{AV}}$$
(14)
$${nP}_{i,sid}^{REP}=0.5+\frac{{P}_{i,sid}^{REP}-\overline{REP}}{2\times \beta {\sigma }_{REP}}$$
(15)
$${nR}_{i,sid}^{REP}=0.5+\frac{{R}_{i,sid}^{REP}-\overline{REP}}{2\times \beta {\sigma }_{REP}}$$
(16)
$${nP}_{i,sid}^{SE}=0.5+\frac{{P}_{i,sid}^{SE}-\overline{SE}}{2\times \beta {\sigma }_{SE}}$$
(17)
$${nR}_{i,sid}^{SE}=0.5+\frac{{R}_{i,sid}^{SE}-\overline{SE}}{2\times \beta {\sigma }_{SE}}$$
(18)

Some attributes are positive attributes (larger is better, such as stability), and others are negative attributes (smaller is better, such as price and cost). In our paper, the response time and cost are the negative attributes and others are position attributes. We give a weight to the cost:

$${W}_{CT}={}^{num({P}_{i,sid}^{CT})}\!\left/ \!{}_{{\sum }_{A}num({A}_{i}^{sid})}\right.$$
(19)

where \(num({P}_{i,sid}^{CT})\) is the number of atomic services provided by the cloud which has a lower cost than \({P}_{i,sid}^{CT}\) and \(num({P}_{i,sid}^{CT})\) is the number of atomic services that meet the cost of service request \({RCT}_{i}^{sid}\). \(A=\{PCT,PRT,PREL,PAV,PREP,PSE\}\). \({W}_{RT}\),\({W}_{REL}\),\({W}_{AV}\),\({W}_{REP}\), and \({W}_{SE}\) are the weights of the response time, reliability, availability, reputation, and security of the service request \({R}_{j}\). They have the same equations as formula (19), so we do not give the formulas here.

Here we give a score when \({P}_{i}^{sid}\) is allocated to \({R}_{j}\):

$$\begin{array}{c}{score(P}_{i}^{sid},{R}_{j})={W}_{RT}*sc({nP}_{i,sid}^{RT},{nR}_{j,sid}^{RT}) +{W}_{CT}*sc\left({nP}_{i,sid}^{CT},{nR}_{j,sid}^{CT}\right)+{W}_{REL}* \\ sc\left({nP}_{i,sid}^{REL},{nR}_{j,sid}^{REL}\right)+{W}_{AV}*sc\left({nP}_{i,sid}^{AV},{nR}_{j,sid}^{AV}\right)+ {W}_{REP}*sc\left({nP}_{i,sid}^{REP},{nR}_{j,sid}^{REP}\right)+\\ {W}_{SE}*sc({nP}_{i,sid}^{SE},{nR}_{j,sid}^{SE})\end{array}$$
(20)

Suppose \(A\) is the attribute of a service provider and \(B\) is the attribute of a service request. The function \(sc(A,B)\) gives scores from different aspects (suppose the attribute is the benefit attribute: larger is better):

$$sc\left(A,B\right)=\left\{\begin{array}{cc}\frac{1}{2}+\frac{1}{2}*1/{e}^{A-B}& if A\ge B\\ \frac{1}{2}*A/B& if A<B\end{array}\right.$$
(21)

Our scheduling target is to maximize:

$${tar}_{1}=\sum {score(P}_{i}^{sid},{R}_{j})$$
(22)

Subject to:

$${nP}_{i,sid}^{RT}\le {nR}_{j,sid}^{RT}$$
(23)
$${nP}_{i,sid}^{CT}\le {nR}_{j,sid}^{CT}$$
(24)
$${nP}_{i,sid}^{REL}\ge {nR}_{j,sid}^{REL}$$
(25)
$${nP}_{i,sid}^{AV}\ge {nR}_{j,sid}^{AV}$$
(26)
$${nP}_{i,sid}^{REP}\ge {nR}_{j,sid}^{REP}$$
(27)
$${nP}_{i,sid}^{SE}\ge {nR}_{j,sid}^{Se}$$
(28)

As the analysis in "Energy consumption model for service composition" section, we also have two other targets:

$${\mathrm{Minimization}: tar}_{2}=\sum {E}_{R}\left(R\right)+{E}_{S}\left(R\right)$$
(29)
$${tar}_{3}=\sum {E}_{U}\left(R\right)$$
(30)

\({tar}_{2}\) and \({tar}_{3}\) minimize the energy consumption of users and the energy consumption for transferring files.

In this paper, we only consider six QoSs. However, we can add any QoS to our model, regardless of whether the QoS belongs to the benefit type (such as security) or the cost type (such as execution time).

The service composition method based on GA

Our problem is a multiple-objective problem with multiple conditions. In addition, we try to use NSGA III to solve the problem.

figure a

Algorithm 1. Service composition GA

In Algorithm 1, \(NN\) is the total number of individuals, \(M\) is the maximized number of iteractions,\({R}_{cro}\) and \({R}_{mut}\) are the rates of crossover and mutation, respectively. \(NS\) is the number of atmonic services of all the service requests (\(\mathrm{\alpha }>1\)). \(\mathrm{\rm A}\) is a constant Lines 1 ~ 3 initialize the population with \(NN\) individuals. One individual is a service composition solution. Lines 4 ~ 16 are \(M\) times for our GA. The rates of crossover and mutation are \({R}_{cro}\) and \({R}_{mut}\), respectivey. Function \(rand(\mathrm{0,1})\) returns a random number in the range of (0,1). Figure 4 is the flowchart of service composition methods based on GA.

Fig. 4
figure 4

Flowchart of service composition based on GA

Individuals for scheduling solution

An individual gives the location of every service in a service request. Suppose there are \(N\) clouds. We use \(\sqrt{N+1}\) genes to denote the location of every service. 0 denotes when the service is executed on the local mobile devices, and others denote that the service is allocated to the relative Clouds.

Fitness function

The fitness function is based on the scheduling targets: \({tar}_{1}\), \({tar}_{2}\) and \({tar}_{3}\). We give weight to every target, and then the scheduling target is maximized:

$$tar={w}_{1}{*tar}_{1}-{w}_{2}{*tar}_{2}-{w}_{3}{*tar}_{3}$$
(31)

Genetic operators

The genetic operators include selection, crossover, mutations, and updating.

Selection: In the paper, we randomly select two individuals for crossover and mutation.

Crossover: Recombination (plus variation) of biological genes plays a central role in biological evolution in nature. Additionally, the crossover operator of the genetic operations palys a central role in of the genetic algorithm. The so-called crossover refers to the operation of replacing and recombining part of the structure of the two parent individuals to generate a new individual. Through crossover, the searchability of GA can be improved by leaps and bounds. We use the multipoint crossover method for crossover operation in our paper.

Mutation: The basic content of the mutation operator is to change the gene values of individuals in the population. In the simulation, we change from 1 to 0, or change from 0 to 1 for one bit.

Updating: The operator selects superior individuals from a group and eliminates inferior individuals. The selection operator is sometimes referred to as the reproduction operator. The purpose of selection is to directly inherit the optimized individual (or solution) to the next generation or to generate new individuals through pairing and crossover to the next generation. The selection operation is based on the fitness evaluation of individuals in the group. Our selection operator is based on the value of the scheduling target function (Formula (30)). We always select the individuals with bigger values in the fitness function.

GA for service composition

The basic operation process of GA for service composition is as follows: [2]

  1. (1)

    Initialization: Set the evolutionary time \(t=0\), set the maximum evolutionary time \(T\), and randomly generate \(M\) individuals as the initial population \(P(0)\).

  2. (2)

    Individual evaluation: Calculate the fitness of each individual in group \(P(\mathrm{t})\) according to the scheduling target (Formula (19)).

  3. (3)

    Selection operation: The purpose of selection is to directly inherit the optimized individuals to the next generation or to generate new individuals through pairing and crossover and then inherit them to the next generation. The selection operation is based on the fitness evaluation of the individuals in the population. We select the top \(M\) individuals in descending order of the target function of individuals.

  4. (4)

    Crossover operation: The crossover operator is applied to the group. The core function of the GA is the crossover operator. We select two individuals and cross with a point, and we obtain two new individuals. The crossover happens at a rate of \({R}_{cro}\).

  5. (5)

    Mutation operation: The mutation operator is applied to the population. That is, we randomly select some genes in the individual and change their values. After the population \(P(t)\) is selected, crossed, and mutated, the next generation population \(P(t+1)\) is obtained. The mutation happens at a rate of \({R}_{mut}\).

  6. (6)

    Judgment of termination condition: if \(t=T\), the individual with the maximum fitness obtained in the evolution process is used as the output of the optimal solution, and the calculation is terminated.

When the GA is terminated, we select the individual that has the largest value in the target function.

Simulation and comparisons

Simulation environment

In this section, we will compare our method GA-C with All-C [44,45,46], Bas-C [44,45,46], Smt-C [44,45,46], Swm-C [47], and Fast-C [48].

All-C: All clouds containing composite objects are used as input to service composition until the service composition request is completed.

Bas-C: First, we check whether any cloud meets the requirements of the service composition object, if it is, we select the cloud; otherwise, we select any two clouds, check whether it meets the requirements of the service composition object, and if so, select these two clouds until the service composition request is met.

Smt-C: Smt-C models the multicloud environment into a tree structure by cloud, service cluster, and service levels, and realizes service composition by searching for combinations with the minimum number of clouds.

Swm-C [47]: Apply the swarm algorithm to the discrete optimization problem of service composition. In a multicloud environment, consider the QoS of service requests to select clouds and related services.

Fast-C [48]: Fast-C is a heuristic method that considers multiple criteria services selection, and tries to satisfy as many QoS requirements as possible. It takes a global-aware utility cost based on expected compositional QoSs and improves the solution by iterations.

The simulation environment is as follows: we assume that the number of copies of atomic services provided by each web service type is a random integer between [100 ~ 200], and 20 to 80 service composition requests are randomly generated each time. The number of atomic services in all service requests is a random integer, and the maximum number of atomic services is 50. The test environment contains 100 clouds (an atomic service may have multiple atomic service copies in a cloud), and the atomic services contained in these clouds are also generated by random numbers (0 or 1:0 means the cloud does not provide the service, and 1 denotes the cloud provides the service).

We simulated the service composition process 5000 times, and the results in this section are the average of the 5000 execution results. The simulation environment is as follows: operating system WIN10, CPU 8 core 2.6 GHz, 8 GB of memory.

Comparisons and discussion

In this section, we will give comparisons of the six methods from different metrics: ACC (average number of combined Clouds), AVS (average number of visited services), the failure rate of service composition, the energy consumption of users and transferring files, and the average score of atomic services.

Average number of combined clouds and average number of visited services

Two parameters will be compared in this section: ACC (Fig. 5), and AVS (Fig. 6). The larger in the ACC is, the more data need to be transferred between clouds, thus increasing the time and energy consumption for transferring files. The larger the AVS is, the longer the search service time and the longer the algorithm execution time.

Fig. 5
figure 5

ACC

Fig. 6
figure 6

AVS

GA-C has the smallest ACC value among the five methods (Fig. 5), making it the smallest number of clouds involved. The descending order ​​of the five methods is ALL-C, Bas-C, Smt-C, Swm-C, and GA-C. Compared with the ACC of ALL-C, Bas-C, Smt-C, Swm-C, and Fast-C, the GA-C average decreases by 31.65%, 13.85%, 21.52%, 12.47%, and 6.39%, respectively. GA-C has the smallest ACC value because: (1) the score makes every service request obtain only the atomic service that meets its QoS requirement and (2) GA ensures obtaining the ideal scheduling solution. Although Swm-C performs better when the number of service requests is small, it does not perform as well as Bas-C and GA-C as service requests increase. Therefore, the Swm-C algorithm is suitable in the case of low complexity. Although the purpose of ALL-C is to ensure that all services are in one cloud, it leads to many fragmented atomic services. It may be that each atomic service of a service request needs to access a cloud, so the ACC value is expected to be the largest. Smt-C may also encounter the same problem, that is, it wants to serve as much as possible in one cloud, but the subsequent subservices need to be provided by multiple clouds, which also leads to a relatively large ACC. The Swm-C algorithm is suitable for the case where the search range is small, but as the number of services increasing, its performance is not good.

Figure 6 shows the AVS for the five methods with different numbers of web service requests. From Fig. 6, we find that GA-C has the smallest AVS value among the five methods, making it the least number of services accessed. The descending order of AVS values is Bas-C, Smt-C, ALL-C, Swm-C, Fast-C and GA-C. Compared with ALL-C, Bas-C, Smt-C, Swm-C, and Fast-C, GA-C reduces the AVS value by 16.25%, 30.19%, 21.98%, 16.86%, and 7.02%, respectively.

In general, GA-C performs well in the two parameters, because the GA-C ensures the three targets, which not only ensures that the number of clouds involved in the service is small, but also ensures that the number of services accessed is small. Although ALL-C has a relatively high ACC value, it also has a relatively low AVS value. The Bas-C and Smt-C methods perform almost the same on the two comparison parameters. Although Swm-C performs well when the number of server requests is small, when the number of service requests increases, the performance is not very good. Fast-C also has good performance in ACC and AVS. It has an advantage in the speed of obtaining the service composition result, at the same time, it loses some efficiency, especially when the number of service requests is large.

Comparisons considering six QoSs

"Average number of combined Clouds and average number of visited services" section does not consider QoSs. Here, we will compare those methods when the relative QoS is a random integer in Table 2. When a QoS is only half (when the QoS belongs to the benefit type) of the requirement, we consider the service composition to fail (for the QoS belonging to the cost type, it is more than 1.5 times the QoS, it is a failure).

Table 2 Values of six QoSs

We use the method of Sect. 4.3 to normalize these values. Other simulation parameters are the same as in "Average number of combined Clouds and average number of visited services" section.

From Fig. 7, when considering QoSs, our proposed method reduces the probability of combination failure. Compared with the FRs of ALL-C, Bas-C, Smt-C, Swm-C, and Fast-C, the average FR of GA-C decreases by 17.13%, 36.09%, 30.57%, 19.70%, and 7.42%, respectively.

Fig. 7
figure 7

Failure rate of different methods

Energy consumption of different methods

Suppose the file size of each subservice is a random number between [1,100]. According to the relevant literature, the sending rate is much higher than the receiving rate, so it is assumed that the receiving efficiency (energy consumption per unit size file) is a random number between [1, 50], and the sending efficiency (energy consumption per unit size file) is a random number in [50,150]. We mainly examine the total energy consumption of transfer files and their size (Total file size). Since one sends and receives in one direction, so we only consider the sending file size [56] (we do not consider the size of receiving files).

Figure 8 are the file sizes transmitted by the five methods under different service request numbers, and Fig. 9 shows the energy consumption of the files transmitted by the five methods under different service request numbers. Overall, energy consumption is proportional to the size of transferring files. On average, compared with the size of transferring files of ALL-C, Bas-C, Smt-C, Swm-C, and Fast-C, GA-C average reduces by 34.50%, 13.66%, 24.90%, 13.93%, and 7.28%, respectively; compared with energy consumption, GA-C average reduces by 35.43%, 13.75%, 25.88%, 14.72%, and 7.52%, respectively.

Fig. 8
figure 8

File size of different methods

Fig. 9
figure 9

Energy consumption

Energy consumption of different methods

Figure 10 is the energy consumption of users. As the number of service requests increases, all methods slightly improve in the energy consumption of users. This is because, as the number increases, every atom has fewer choices to obtain atomic services with lower energy consumption. For the energy consumption of users of ALL-C, Bas-C, Smt-C, Swm-C, and Fast-C, the GA-C average decreases by 120.17, 46.11, 168.48, 88.26, and 60.15 respectively.

Fig. 10
figure 10

Energy consumption of users

Average scores of different methods

Figure 11 gives the average score of different methods under different numbers of service requests. In general, all methods have a decreasing trend in the value of the average score with the enhancement of the number of service requests. This is because, with the increase in service requests, fewer atomic services are available for the other service requests, thus decreasing the scores. Our proposed method GA-C always has the highest value in the average score. Compared to the average score of ALL-C, Bas-C, Smt-C, Swm-C, and Fast-C, the GA-C average improves by 31.63%,15.55%, 8.27%, 16.94%, and 8.69%.

Fig. 11
figure 11

Average score of different methods

All-C and Bas-C both have good performance when the system has a lower load. With the enhancement of the system load, they have poor performance in all metrics. They both try to ensure good performance of current tasks, and ingnore the influence on future tasks. Smt-C losts its efficiency to search atomic services in the tree structure when the number of services and the number of QoSs is larger. The swarm algorithm in our scheduling cannot find a better solution. Fast-C may have a good speed and efficiency when the system has a lower load, and with the increase of the system load, it lost its efficiency because of its speed. Overall, our proposed algorithm considers reducing the number of access clouds and the number of search services, and has obvious advantages in reducing the probability of task failure and reducing energy consumption.

Conclusions and future work

In this paper, based on the analysis of the multicloud environment, we first standardize the QoS of the service; then we analyze the goal of service composition in the multicloud environment; and last, we use the genetic algorithm to complete the service composition problem in the multicloud environment. Simulation experiments show that our proposed service composition method can reduce the number of service composition accesses to the cloud, and reduce the energy consumption of data transmission between different clouds, including reducing user energy consumption. Energy consumption would be reduced if we would obtain a some green energy supply, such as solar, wind, etc. In future work, we will try to find a service composition method when some service providers or users have a green energy supply.