1 Introduction

NFV is an innovational network architecture to provide network services by decoupling network functions such as firewalls, intrusion detection, load balancing and routing from physical boxes so that they can run as software-based applications. Therefore, it can improve flexibility and agility of the network since it is easier to dynamically scale the VNF instances, send the functions across a distributed infrastructure and upgrade the software without interrupting the service. In addition, NFV enables VNFs to be placed on cloud/edge physical machines in the form of virtual machine (VM) or other containers such as Linux container and Docker [1] in order for parallel processing of multiple operations, load balancing between servers, decreasing the traffic congestion and locating closer to the end users [2]. VNFs are chained together in a predefined order to make particular network services. Service flow traffics should be traversed through the relevant SFCs while satisfying business requirements and system constraints. SFCs are considered as virtual networks including VNFs and virtual links between them which can be mapped on the substrate network. The link mapping and VNF placement should be performed regarding the demanded resources and can affect cost of services requested by users.

Over the past few years, user traffic and the use of virtualization technologies have been growing very fast in communication networks. The excessive needs for developing new services and deployment of the required network resources as well as maintaining, upgrading and expanding physical infrastructures emerge a remarkable operational expenditure (OPEX) and capital expenditure (CAPEX) for the network service providers. NFV is able to significantly decrease the capital and operational cost and outperform resource allocation more efficient and flexible. An efficient deployment of SFCs plays a major rule in decreasing monetary costs of the service providers. However, sometimes, there would be a tradeoff between different objectives as they may be contradictory. For example, although increasing the resource utilization in order to minimizing the number of active physical nodes can reduce deployment cost, but at the same time it may lead to an increase in latency of demanded services. It can happen since the aggregation traffic on the physical nodes and links increases and it degrades the efficiency of latency objective. On the other side, minimizing network latency can be resulted in an increase in deployment and network cost because of more resources needed for providing services [3].

Figure 1 illustrates an example of VNF placement and link embedding on a small substrate network including 10 cloud/edge physical nodes. As we can see in Table 1, there are 3 SFCs to be placed on the substrate network. The first service chain includes three VNFs which are placed on nodes 3, 4 and 9, and the virtual links connecting the VNFs are mapped on the given physical path (3–4–7-9). Similarly, the second service chain including f4 and f5 is placed on nodes 6 and 8 through intermediate node 10. For the last service chain, physical nodes 9, 8, 5 and 2 are selected to host the VNFs with the selected physical path in the sequence of nodes 9,10,8,5,2.

Fig. 1
figure 1

An example to illustrate VNF placement and link embedding in cloud/edge networks

Table 1 SFC mapping on the substrate network

In this paper, we propose a multi-objective optimization model to minimize joint deployment cost of service providers and end-to-end latency of SFCs. We formulate the problem of SFC placement using Mixed Integer Programming (MIP) model which takes into account a range of constraints such as resource capacity, acceptable latency requirements, affinity and anti-affinity. The proposed model enables service providers to accept and serve more user requests with strict latency needs while keeping overall costs low.

As finding an optimum solution for service chain placement is a NP-hard problem, exact solutions needs huge amount of time and computational resources, so they are impractical for the real-world networks. Heuristic algorithms have been proposed to improve the scalability of solution and to handle the large infrastructures. These approaches have to make a trade-off between optimality of the solution, complexity and execution time. We propose two genetic-based and bee colony-based algorithms which can be used for large networks to place service functions and routing simultaneously, as it increases the performance of virtual network embedding mechanism.

Although much research attention is given to VNF placement, as far as we know, none of the previous works investigated the optimization problem of joint deployment cost and end-to-end latency of SFCs to find a pareto optimal solution which can be used to make a tradeoff between monetary cost and network delay cost in cloud/edge service providers. In addition, for the sake of achieving an efficient and accurate solution needed for real-world networks, we propose comprehensive cost and latency models taking into consideration different effective factors as energy consumption, software license, computation resources and network usage (to define cost model), as well as queuing delay, processing and virtualization delay, and propagation delay (to define latency model).

The main contributions of this paper are summarized as follows:

  1. 1.

    We propose a multi-objective optimization model formulated as MIP, to jointly minimize the deployment cost and the end-to-end latency regarding a range of constraints such as routing, capacity, delay, location constraints.

  2. 2.

    We propose a genetic-based algorithm as well as a bee colony-based algorithm to solve the placement and routing problem to find a pareto optimal solution considering heterogenous physical nodes and various SFCs.

  3. 3.

    We evaluate our approach using both simulation and emulation (Mininet), and compare the results with a greedy algorithm as well as with the optimal solution.

The rest of the paper is organized as follows. The related works are discussed in Section 2. In Section 3, we formulate the problem of SFC placement in order to jointly minimize the deployment cost and network latency. In Section 4, we illustrate our proposed algorithms to solve the optimization problem in details. Section 5 provides the performance evaluation of the proposed algorithms compared with the benchmark algorithms. Finally, we conclude the paper in section 6.

2 Related works

VNF placement has recently obtained much attention in the literature. The related works can be categorized regarding various aspects such as system models, objectives and proposed solutions. A number of studies have formulated the placement problem as integer programming problems, and solved them using optimization solvers; or applied heuristics or greedy approaches to place VNFs. Bari et al. [4] proposed a Mixed Integer Linear Programming (MILP) model to optimize utilization and to reduce network operational costs, and solved it using CPLEX. Authors in [5] proposed an ILP formulation to decrease the number of deployed instances. In [6, 7], the authors proposed a MILP and Mixed Integer Quadratically Constrained Program (MIQCP) for VNF placement in data centers, respectively. These approaches are effective to find the exact or near-optimal solutions, but only for small size infrastructures and are not suitable for the networks including large set of physical nodes. A polynomial complexity heuristic has been proposed for VNF placement in [8]. The placement problem is modeled as a Multi-Stage directed graph with associated costs and then, VNFs are placed leveraging a Viterbi algorithm [5]. Agrawal et al. [9] introduced .a .queuing-based .system model along with a heuristic to minimize the network latency, but they considered only CPU in their work and neglected other resources. The authors in [10,11,12] proposed QoS prediction strategies for mobile ecommerce environments, edge environments and IoT services, respectively.

In respect of objective, some other works address the VNF placement regarding load balancing, service resilience and monitoring overhead [13,14,15,16]. Authors in [17] presented an offloading decision problem as a cost-minimization problem. In [18], the authors presented an energy-aware placement for NFV environments using a game-theory approach. However, they proposed the solution for small infrastructures including only a few physical nodes. In [19], the authors proposed a data-intensive service edge deployment scheme based on Genetic Algorithm in order to minimize the response time of the services. In [20], the authors encoded the state of the service provisioning system and the resource allocation scheme, and then modeled the adjustment of allocated resources for services as Markov Decision Process (MDP) in order to improve trustworthiness in IoT environments.

One of the main objectives to solve the problem of VNF placement is reducing the deployment cost [21, 22]. Deployment cost is defined as the cost of the computing and communication resources which are needed to execute a service chain. The main issue of the problem is how to place the VNFs onto physical nodes in a way that QoS is satisfied and the cost of service provider is reduced. Xia et al. [23] study the on-demand VNF placement to minimize the cost by placing the VNFs onto fewer physical nodes. Cohen et al. [24] address the VNF placement for the purpose of minimizing the deployment cost. They showed that an optimal placement can improve network reliability, performance of the network and also operation cost. However, the precedence constraint for VNFs in the service chains is neglected in this work. The authors in [25] address the problem of VNFs mapping and scheduling. They have proposed three greedy algorithms and a Tabu search algorithm to minimize the cost and increase the revenue. As a drawback of this work, authors consider only VNFs as nodes without any link between them; they did not consider service chain placement in their work.

An online application placement for mobile edge computing (MEC) has been proposed by Wang et al. [26]. The authors modeled the placement problem using Markov Decision Processes (MDP) and tried to reduce the state space of the problem. They derived a new MDP model in which only distance between servers and users define the states and then, they proposed a greedy algorithm to place the applications. Authors in [27] introduce an edge server placement approach to minimize the energy efficiency in MEC. They have proposed a particle swarm optimization to find the optimum solution. Another research [28] proposed a service chain placement system to minimize the queuing delay on nodes and infrastructure resources. Two techniques are proposed for the placement problem: a round-robin based heuristic, and a MIP-based optimization method. The results have been compared with the general MIP. However, this work only considers physical nodes and neglect the impact of routing on service latency.

The previous works either consider cost and latency as the separate objectives or consider latency as a constraint in optimization model. However, we propose a multi-objective optimization model considering joint cost and latency for the problem of VNF placement and link embedding in cloud edge systems. The proposed model is able to provide near-optimal solution for only cost optimization, only latency optimization or a pareto optimal solution considering joint cost and latency. Therefore, service providers are able to set up a weight factor based on their needs to make a tradeoff between cost and latency. In addition, the previous works considered some important factors to model the cost and especially latency functions and neglected others which may lead to SLA violation in real networks. However, we propose a comprehensive model regarding various effective factors which makes this model more practical for real edge cloud systems.

3 System model and problem formulation

In this section, the service function chain placement in a cloud/edge network is formulated as an optimization problem. The goal of optimization model is mapping the service chains onto physical nodes so that cost and latency are minimized satisfying placement constraints. Tables 2 and 3 show the variables used in this paper.

Table 2 Descriptions of Binary variables
Table 3 Descriptions of variables

We consider an edge/cloud network which consists three tiers: end users, edge servers and a cloud. The substrate network is defined as an undirected physical graph, denoted by G = (V, E) where V is a set of N heterogeneous edge-cloud physical nodes denoted by V = {v1, v2, …, vN} and E is a set of K physical links between nodes denoted by E = {e1, e2, …, eK}.Each physical node v ∈ V is characterized by three types of resources as processing, memory and disk, and can host one or several network functions.

The set of all service chains in the system is indicated as S. Let s ∈ S denotes a service chain consists of a list of VNFs with strict precedence connection, and is modeled as a directed graph denoted by SC = (F, L) where F is the set of virtual functions and L is the set of virtual links. Each virtual function f ∈ F is described by its processing, memory and disk demand, and each virtual link l ∈ L is characterized by its bandwidth demand. We consider different virtual topologies consist of VNFs and virtual links in response to any type of requested service chains. Each VNF f belongs to only one service chain s and can be placed on only one physical node v ∈ V which meets the defined constraints. Similarly, each l ∈ L can be mapped to only one physical path P that satisfies the constraints. Finally, let binary variable \({X}_{sf}^v\) indicates whether VNF f ∈ F from service chains s can be mapped on physical node v ∈ V (\({X}_{sf}^v\) = 1) or not (\({X}_{sf}^v\) = 0).

Considering the above-mentioned issues, we present an optimization model for VNF placement and link embedding problem which aims to 1) minimize deployment cost of service chains, 2) minimize end-to-end service latency, 3) minimize joint cost and latency. In the latter case, we aim to obtain a pareto optimality between cost and delay in the mentioned problem.

3.1 Minimizing the overall cost

Eq. (1) denotes overall monetary cost incurred in the system for all service chains. Overall cost is formulated based on three cost components as: cost of basic resources named , cost of physical nodes called , and communication cost named .Since we consider physical nodes are heterogeneous in this work, placement of each VNF on a particular node may incur a different computational cost. As shown in Eq. (2), the cost of basic resources for each service chains ϵ S is formulated as the processing, memory and storage costs of the physical nodes where the service chain’s functions are mapped on.

(1)
(2)

Cost of physical nodes for all service chains is formulated in Eq. (3) which encompasses software license cost per site and per instance, and cost of power consumption. Software license cost per site [29] denoted by Υ ($/node) is calculated for all physical nodes hosting at least one VNF f ϵ F. zv is a binary variable that indicates if a physical node is active. To be active (zv= 1), a physical node v must host at least one VNF from any service chain, otherwise zv= 0. On the other hand, \({X}_{sf}^v\)is a binary variable that is equal to 1 if a VNF f from service chain s is allocated to the physical node v, otherwise it equals to 0. Therefore, we can summarize that if \({X}_{sf}^v\)=1, then consequently zv=1.

A major challenge in SFC placement is to control the number of active nodes in the system, since turning on all physical nodes increases the cost of electricity and has a negative effect on environment due to an increase in carbon footprint. Idle servers consume about 60% of peak power in data centers [30]. Hence, a smaller number of switched-on nodes are desired to minimize the overall cost of the system.

The cost of power consumption is calculated for all active servers in the system [31]. \({\mathtt{p}}_v^{min}\), \({\mathtt{p}}_v^{max}\) denote minimum and maximum power consumption of server v ∈ V, respectively. \({Cap}_{cpu}^v\) indicates the available processing capacity in server v, \({d}_{cf}^v\) is amount of CPU demanded by a VNF fF,and φ is a constant to convert the power to a monetary term. The last but not least, software license cost per instance denoted by , is a cost incurred to the system due to create a new VNF instance for different types of VNF .

(3)

The communication cost is the third component of overall cost defined in Eq. (4). It is formulated as the sum of bandwidth costs incurred by physical paths where virtual links are mapped on. The binary variable \({y}_{sl}^e\) is equal to 1 if virtual link l ∈ L from service chain s is mapped on physical link e ∈ E, otherwise \({y}_{sl}^e=0.\)

(4)

Combining Eq. (24), the overall cost model for all service chains is shown in Eq. (5).

(5)

3.2 Minimizing end-to-end latency

VNFs, in each service chain, need to communicate with each other and forward packets according to the virtual links between them. These virtual links are mapped on the physical paths comprised of one or several physical links. Depending on the topology in a cloud/edge system, these physical connections may have different hops and different hop distance which can incur various amount of delay while processing a service chain. In the other hands, gathering VNFs on a limited number of nodes can increase traffic congestion in the network and increase latency of service chains. Based on the expected QoS and Service Level Agreement (SLA) between users and service providers, each service chain may have a deadline to be executed. Moreover, latency-critical services like remote surgery require stringent latency requirements in NFV infrastructures.

In this section, we propose a model which aims to minimize the end-to-end latency of service chains in the system. As we can see in Eq. (6), the latency model is formulated as propagation delay , processing and virtualization delay , and queuing delay Neglecting each of the delay functions may result in violation of the end-to-end latency requirements.

(6)

The propagation delay is calculated by dividing the distance by the propagation speed, which is a fixed value for each physical link. The propagation delay is calculated for all physical links allocated to the virtual links as follows:

(7)

The processing delay refers to the time of executing VNFs in physical nodes, and can be calculated by dividing the total processing demands by the node’s processing capacity. The virtualization delay of a service chain depends on the number and load of VNFs placed on a physical node. Eq. (8) formulates the processing and virtualization delay for all physical nodes that are hosting VNFs of a service chain. We model both processing and queuing delays based on M/M/1 queuing models.

(8)

The queuing delay experienced by a service chain depends on the link utilization and can be calculated by dividing the total traffic demand by the link capacity of all nodes that are hosting VNFs consisting of intermediate nodes.

(9)

Combining Eq. (79), the end-to-end latency model for all service chains is formulated in Eq. (10).

(10)

3.3 Joint cost and latency optimization

Both deployment cost of service chains and end-to-end latency are important objectives in SFC placement. However, they are conflicting objectives; that is, minimizing one could increase the other. The reason is that minimizing the number of active physical nodes increases the network traffic and link congestion and consequently may increase the queuing, processing and virtualization delay. On the other hand, increasing number of physical nodes increases overall costs and even propagation delay (in the case of using an inefficient placement), however, decreases the queuing, processing and virtualization delay. Hence, a proper VNF placement and link embedding is necessary to proper deployment of service chain in edge cloud systems.

Eq. (11) combines cost and latency models using a weight factor α∈ [0, 1] as follows:

(11)

We can adjust α to obtain any needed cost/latency tradeoff, since service providers may have various types of desires and requirements. To achieve more optimal placement according to cost objective, α should be set to a larger number so that α = 1 only consider cost optimization and neglect the impact of latency. On the other hand, the smaller α emphasizes the latency minimization so that α = 0 optimizes the system only based on latency.

The problem of SFC placement to joint deployment cost and end-to-end latency minimization is formulated as follows:

minimize

(12)

subject to constraints (13–26).

3.4 Explanation of the optimization problem constraints

The constraints considered for the optimization problem are illustrated in following parts.

3.4.1 Resource constraints

The processing, memory and storage demands of VNFs mapped on the physcial nodes should not exceed the remained CPU, memory and storage capacity of the relevant nodes to avoid resource overutilization. Therefore, Eq. (1315) guarantee the CPU, memory and storage utilization constraints, repectiverly.

$$\sum \limits_{v\in V}\sum \limits_{f\in F}\left({d}_{cf}^v{X}_{sf}^v\right)<{Cap}_{cpu}^v,\forall s\in S$$
(13)
$$\sum \limits_{v\in V}\sum \limits_{f\in F}\left({d}_{mf}^v{X}_{sf}^v\right)<{Cap}_{mem}^v,\forall s\in S$$
(14)
$$\sum \limits_{v\in V}\sum \limits_{f\in F}\left({d}_{st f}^v{X}_{sf}^v\right)<{Cap}_{st}^v,\forall s\in S$$
(15)

Likewise, for every service chain, the bandwidth allocated to a virtual link l ∈ L mapped on a physical link e ∈ E should not exceed the bandwidth capacity of the link for all links in the physical path. Eq. (16) ensures the link’s bandwidth usage constraint.

$$\sum \limits_{e\in E}\sum \limits_{l\in L}\left({d}_{bw l}^e.{y}_l^e\right)<{cap}_{bw}^e$$
(16)

3.4.2 Placement constraints

The Eq. (17) enforces that all VNFs of a specific service chain must be placed on the available physical nodes working together based on a pre-defined order. Nevertheless, each VNF instance of a given service chain can be placed and instantiated on only one physical node which is guaranteed by the constraint defined in Eq. (18).

$$\sum \limits_{v\in V}\sum \limits_{f\in F}{X}_{sf}^v=\mid F\mid \kern0.75em ,\forall s\in S$$
(17)
$$\sum \limits_{v\in V}{X}_{sf}^v=1\kern1.5em ,\forall f\in F,\forall s\in S$$
(18)

Similarly, for every service chain, all the virtual links between each pair of VNFs must be embedded on physical links, as shown in Eq. (19).

$$\sum \limits_{e\in E}\sum \limits_{l\in L}{y}_{sl}^e=\left|L\right|,\forall s\in S$$
(19)

The constraint defined in Eq. (20) ensures that all VNFs of each service chain should be placed and processed in a pre-defined order. It is worth to mention that if \({X}_{sp}^u\)=1 and \({X}_{sq}^v\)=1 and \({Z}_s^{pq}\)=1, then we can summarize \({w}_{spq}^{uv}\)=1, otherwise it equals to 0.

$$\sum \limits_{u,v\in V}{w}_{spq}^{uv}={Z}_s^{pq},\forall p,q\in F,s\in S$$
(20)

Another constraint defined in constraint (21) guarantees that for a service chain which is mapped to a physical path, all its VNFs must be mapped to the nodes belonging to that given path.

(21)

In the case that source and destination of a service demand are the same node, the constraint formulated in Eq. (22) ensures that no physical link will be assigned. Given a service chain s, if a virtual link l between virtual nodes p and q, is allocated on physical link e between physical nodes u and v, then \({y}_{sl}^e=1\) and consequently \({y}_{l_{pq}}^{e_{uv}}\).

$$\sum \limits_{e_{uv}\in E}{y}_{l_{pq}}^{e_{uv}}\le 2-{X}_p^v-{X}_q^v,\forall p,q\in F,\forall u,v\in V,\forall l\in L$$
(22)

The constraint defined in Eq. (23) ensures that if there is affinity rule between two VNFs, they will be assigned to a same physical node.

$${X}_{sp}^v{X}_{sq}^v\ge {A}_{pq},\forall s\in S,\forall v\in V,\forall p,q\in F$$
(23)

Unlike the prior constraint, the constraint defined in Eq. (24) ensures that if there is an anti-affinity rule between two VNFs, they will not be assigned to a same physical node.

$${X}_{sp}^v{X}_{sq}^vA{A}_{pq}=0,\forall s\in S,\forall v\in V,\forall p,q\in F$$
(24)

3.4.3 Flow constraint

Eq. (25) enforces flow conservation constraint, which means the incoming flow must be equal to the outgoing flow for all nodes.

$$\sum \limits_{e_{uv}\in E}{y}_{l_{pq}}^{e_{uv}}-\sum \limits_{e_{vu}\in E}{y}_{l_{pq}}^{e_{vu}}={X}_p^v-{X}_q^v,\forall p,q\in F,\forall u,v\in V,\forall l\in L$$
(25)

3.4.4 Latency constraint

Eq. (26) ensures that the end-to-end latency experienced by each service chain flow must not exceed the maximum latency tolerance for the given service chain. Although one of two objective functions in our optimization model is minimizing end-to-end latency, still we need this constraint to guarantee that regardless of the amount of weight factor α, all service demands will be served within the expected time considered in SLA between service providers and users. The end-to-end latency is already formulated in the prior sections.

$$\kern0.5em {D}_{end}^s\le {D}_{Max},\forall s\in S$$
(26)

4 Heuristic-based SFC placement algorithm

The best method to find the optimal placement of service chains is investigating all the physical nodes and links available in the substrate network. However, because this method requires huge amount of time and computational resources in large-scale networks, we propose two heuristic-based algorithms to find a near-optimal solutions for the problem of SFC placement.

4.1 Bee Colony-based heuristic algorithm

Artificial Bee colony mimics the behavior of honey bee colonies, and is an efficient metaheuristic to solve the NP-hard combinational problems [32]. We solve our proposed optimization problem using an improved bee colony algorithm (BCHA). The proposed algorithm includes three types of bees: employed, onlookers and scout bees. The number of food sources is equal to the number of employed bees in a hive (population). Each location of food sources indicates a potential solution for the optimization problem, and the nectar amount represents the fitness value of each solution. The propose algorithm is shown in Algorithm 1. BCHA includes the following phases:

4.1.1 Initialization

As the first phase, BCHA generates the initial population. The size of population is equal to the total number of food sources (solutions) denoted by P which is defined as the half of the colony size denoted by cSize (P = cSize/2). Every solution consists of N nectars (places). Using the following equation, the solutions of the initial population are generated:

$${x}_{ij}= lb+R.\left( ub- lb\right)$$
(27)
figure u

Where i=1, 2, …, P; j = 1, 2, …, N; xij represents each nectar in the solution, lb denotes the lower bound (in our work it equals to zero), R is a random number within interval [0,1] and ub is the upper bound (in our work it equals to the maximum number of physical nodes minus 1).

4.1.2 Send employed bees

In this phase, for each food source we send an employed bee to probe a new food source which has a better amount of nectar. In the other word, each solution in the population will be replaced by a new solution that obtains a better fitness value using Eq. (28).

$${y}_{ij}={x}_{ij}+{R}_1.\left({x}_{ij}-{x}_{kj}\right)+{R}_2.\left({x}_{ij}-{e}_d\right)$$
(28)

Where R1 and R2 are two different random numbers over interval [0,1], and k is a random integer in range [0, P-1] and different from i, and e refers to the elite solution. Elite is a solution with highest distance value (dv) [32] and can be calculated as follows:

$${dv}_i=F\left({f}_{i+1}\right)-F\left({f}_{i-1}\right)$$
(29)

Where F(fi) refers the fitness value of the solution i. We prefer a solution with higher dv since it reveals that the solution is located in a less crowded region. Therefore, it helps the algorithm to explore a wider area and increases the diversity of the solution. The algorithm defines a counter for each solution to keep the number of times that a given solution is not optimized in each stage. In the case that the new solution is not obtain a better fitness rather than the current solution, the counter will be incremented. If the counter of each solution exceeds a limit, the relevant bee is considered as a scout bee. It is worth mentioning that, unlike the original roulette wheel method that gives more probability to the selection of solutions with higher fitness values, the roulette wheel in our proposed methods gives more probability to those with lower fitness values. This is because, in line with the minimization nature of our problem statement, we have deigned our fitness values so that better solutions receive less fitness values. Fitness values are mapped to a real number in the range [1, 10], as shown in line 32 in Algorithm 1.

4.1.3 Send onlooker bees

In the previous phase, all employed bees tried to optimize their food sources. Then, in this phase, employed bees come to hive to advertise their food sources. Each onlooker bee should decide and select a food source to be utilized. In other words, BCHA assigns a probability to every solution in population by which the solutions with lower fitness values get higher selection probability since our target is minimizing cost and latency in this work. For all the places in the population, the algorithm selects a solution using roulette wheel selection technique and tries to optimize it using Eq. (28), the same as in the previous phase.

Once again, in the case that the new solution cannot be further improved, the relevant counter will be incremented and if the pre-defined limit is violated, the solution will be considered as a scout bee.

4.1.4 Send scout bees

In this phase, the scout bees (abounded solutions) are found and replaced with a new solution which is generated using Eq. (27). In each iteration only one scout bee will be replaced. The abandoned solutions should be removed because they have been trapped in a local optimum. Then, the relevant counter for new solutions turn to zero again. Then, the algorithm will be repeated until the convergence condition is reached.

4.2 GA-based heuristic algorithm

As an evolutionary algorithm, genetic algorithm imitates the natural evolution so that the solution proceeds towards a more optimal solution after each generation. We propose a modified GA-based algorithm (GAHA) designed to solve the SFC placement problem. The proposed algorithm is shown in Algorithm 2. GAHA includes several phases as follows:

4.2.1 Encoding scheme

In the proposed algorithm, each potential placement solution is defined as a chromosome (individual). Every individual consists of a number of genes represented by an integer [1, N] interval, where N is the number of physical nodes, and each gene corresponds to a VNF mapped to a physical node. Individuals are initiated randomly and must satisfy the constraints of the optimization model.

4.2.2 GA operators

Genetic algorithm aims to merge the individuals to create offspring using crossover operator and then mutate them using mutation operator. Each offspring inherits its genes from two parents selected for crossover. First, all the individuals in the population are sorted in an increasing order in terms of their fitness values. The fitness function is defined based on the objective function formulated in Eq. (12), and uses normalized cost and latency values. Next, a number of individuals from the top of the list with lowest fitness values are selected as elites based on the elitism rate, and they will be directly added to the new population. Given the crossover rate, the offspring are created from the parents which are selected using the roulette wheel selection technique.

The proposed algorithm is a self-healing algorithm; that is, after generating each offspring all the constraints will be checked and must be satisfied, otherwise for the same parents, crossover operator will generate another offspring which satisfies the constraints. To avoid getting stuck in an infinite loop and consequently increasing computational time, we set a condition using a constant (β). It determines maximum number of times that algorithm tries to generate a chromosome satisfying the constraint, otherwise, one of the parents will be selected to add to the new population. Crossover operation will be repeated until all offspring individuals have been generated and added to the new population.

Having the new population, mutation as the second GA operator aims to mutate each individual from top of the list. This operator picks one gene randomly and replace it with another gene. New individuals will be checked for feasibility, otherwise the mutation will be repeated until (β) times. If the individual still is not valid, the prior individual (before mutation) will be considered. Now, the fittest individual will be selected as the solution for that given generation. The GA algorithm continues to generate new populations until converging to the final solution (when the last k generations obtain the same results).

figure v

5 Performance evaluation

In this section, we evaluate the efficiency of our optimization model solved by the proposed algorithms through both simulation and Mininet [33]. We start by explaining the experimental settings, continue by presenting the simulation results, and then we demonstrate the measurement results obtained from Mininet. We, also, compare the performance of our work with the optimal solution derived from Gurobi solver [34], and a greedy algorithm named modified first-fit decreasing (FFD).

5.1 Simulation setup

In our work, we used the Geant network topology including 22 nodes and 36 links extracted from SndLib [35]. SndLib’s topologies are widely used in literature as substrate networks to simulate the placement algorithms (e.g., see [36, 37]).

In the simulation, each service chain assumes as a virtual network that includes source-destination pairs of virtual nodes (VNs) connected with virtual links (VLs). The set of service chains are taken as input by the optimization program. The proposed metaheuristic algorithms try to find the optimal placement for both VNs and VLs at the same stage with respect to the optimization model. First, for each service chain, they select proper physical nodes to be assigned to VNs, and then relevant VLs are embedded to the physical paths between selected pairs of physical nodes using a shortest path algorithm (Dijkstra algorithm), in each iteration of the algorithm. Each physical node can be potentially selected as a source, destination or intermediate node of one or several VLs. The simulation is run on a single machine with an Intel core i5 CPU@1.8 GHz, and 8 GB of RAM.

We run each algorithm 10 times and the best value is shown in the measurements. Table 4 shows the input values for the servers, SFCs and VNFs used in the experiments.

Table 4 Input values

5.2 Results and analysis

In this sub-section, in order to evaluate the efficiency of the proposed optimization model and algorithms, we compare our works and following approaches and baselines:

  • BCHA: The proposed bee colony-based algorithm aims to solve the optimization problem in a way that joint cost and latency are minimized.

  • GAHA: The proposed GA-based algorithm considers both cost and latency minimization as well.

  • Optimal: This baseline indicates the exact solution obtained by Gurobi. We aim to compare the accuracy of our solutions rather than optimal solution. It is worth mentioning that the time complexity of optimal solution is exponential in sizable problem, due to innate complexity of SFC placement.

  • FFD: This algorithm, first, sorts all physical nodes in decreasing order regarding their resource capacities, and then allocates maximum number of VNFs to the nodes from top of the list with respect to the capacity, affinity and anti-affinity constraints. We aim to evaluate the efficiency of our optimization solutions compared with a non-optimized greedy approach.

5.2.1 Cost quality of solution

As the first metric, we evaluate the performance of the proposed algorithms with optimal solution FFD algorithm in terms of monetary cost. As we can see in Fig. 2, both proposed algorithms significantly decrease the monetary cost compared with FFD. This amount is around 20% for BCHA. BCHA even obtains the lower amount rather than GAHA, however, the gap between the optimal solution and BCHA is as small as 5%, while execution time is significantly less. It shows that the proposed heuristic based placement algorithms are quite successful in reducing monetary cost.

Fig. 2
figure 2

The proposed algorithms vs optimal solution and FFD in terms of deployment cost

5.2.2 Latency quality of solution

The latency obtained by the proposed algorithms, optimal solution and FFD are compared in Fig. 3. As we can see, BCHA obtains a better result compared to GAHA although the difference is not remarkable, only about 6%. BCHA achieves an end-to-end latency which is about only 4% higher than optimality, but around 57% less than FFD.

Fig. 3
figure 3

The proposed algorithms vs optimal solution and FFD in terms of latency

Therefore, we can sum up both algorithms improve monetary cost and latency significantly compared with FFD algorithm, and their obtained results are very close to optimal solution which shows the efficiency of the proposed placement algorithms. BCHA reduces both cost and latency more than GAHA although the differences are not very remarkable.

5.2.3 Pareto quality of solution

Figure 4 shows the deployment cost for both BCHA and GAHA for different α values between 0 to 1. As we can see, in general, both algorithms obtained close results in all values, but BCHA is still better in all cases not more than 7% happened in α = 0.1. The amount of cost decreases by increasing the amount of α. That is because α is a weight factor which emphasizes on cost optimality rather than latency, so having the higher values of α, optimization model tries to find better cost placement solution and we expect to have lower amount of cost. Therefore, α = 1 obtains the lowest amount of monetary cost and α = 1 obtains the worst cost optimality. From α = 0 to α = 0.5, cost decreases sharply, but it decreases from α = 0.5 to α = 1 with a gentle slope.

Figure 5 shows the results obtained by BCHA and GAHA in terms of latency considering different values of α. Unlike what we said in previous metric, higher values of α will bring lower amount of latency; that is, α = 0 results in lowest latency amount while α = 1 achieves the highest end-to-end latency.

Fig. 4
figure 4

BCHA vs GAHA for different α values in terms of deployment cost

Fig. 5
figure 5

BCHA vs GAHA for different α values in terms of latency

Again, we can see the amount of latency obtained by both algorithms are very close to each other in different values of α, not more than 5%, although BCHA is still more successful in reducing latency. Unlike the cost, from α = 0.5 to α = 1, latency increases sharply, and from α = 0 to α = 0.5 it increases with a gentle slope; however, the latency curve is increasing sharper than decreasing in the cost curve in general.

We can observe the pareto optimal results for both latency and cost optimization in Fig. 6. We use normalized cost and latency values, to see BCHA pareto results for different α values. As we can see, by increasing α we can have more optimal placement in terms of cost, however less optimal solution in latency. On the other side, by decreasing α we can outperform latency although the deployment cost increases. However, based on the results, α = 0.3 provides the best placement in which joint cost and latency are minimized. Therefore, we can sum up that α = 0.3 achieves a balanced optimality between both objectives, although α can be selected based on the requirements of services and desires of service providers.

Fig. 6
figure 6

Pareto optimal results obtained by BCHA for different values of α for both cost and latency

5.2.4 Accuracy of solution

In this subsection, our goal is to determine whether the results obtained via simulations can qualitatively match the results measured in Mininet. In this experiment, we use Dijkstra algorithm to find the shortest path between physical nodes that host the VNFs for each service chain, as in the simulations. We developed a Ryu controller in Mininet which is able to place and proceed the SFCs on physical nodes, then we obtained the end-to-end latency for SFCs based on the placement solutions determined via simulation. In Fig. 7 we evaluate the latency results obtained by simulation compared with Mininet for BCHA.

Fig. 7
figure 7

Latency results obtained by BCHA using simulation vs Mininet

As it can be observed, for different values of VNFs, the latency achieved by emulation using Mininet is very close to the simulation results not more than 6% in all cases. It proves the validity of simulation results in terms of end-to-end latency of service chains.

5.2.5 Impact of service chains complexity

In this subsection, we investigate the impact of service chain complexity on the cost and latency of the system. The complexity of an application is determined by the length of service chain or the number of VNFs in the service chain. Table 5 shows the cost and latency results obtained by BCHA approach for the service chains formed by the fixed number of VNFs as: 4,5,6 and 7 VNFs. From Table 5, we can find that both cost and latency of SFCs deployment increase when the application become complex. The reason is clear because the more VNFs to be deployed, the more instances, resources, power and physical nodes should be used, and consequently the monetary cost will be increased. At the same time, increasing in the number of virtual links connecting VNFs will increment end-to-end latency as well.

Table 5 Cost and latency obtained by BCHA approach using different number of VNFs

6 Conclusion

In summary, we investigated the problem of SFCs placement in edge/cloud environments. Service providers tend to minimize the deployment cost of service chains. However, it may increase the end-to-end latency of services which increases SLA violation and decreases user satisfaction. In this paper, we proposed a multi-objective and comprehensive optimization model to joint minimizing deployment cost and end-to-end latency considering a variety of parameters. We, then, proposed two heuristic-based placement algorithms using genetic algorithm (GAHA) and bee colony algorithm (BCHA).

We evaluated the efficiency of our approach using both simulation and emulation (Mininet). The proposed algorithms are compared to optimal solution obtained by Gurobi as well as the FFD placement algorithm. The results showed that BCHA outperforms monetary cost rather than GAHA by 4% and FFD by 20% while its results are close to optimal solution (5%). In terms of latency, BCHA reduces the end-to-end latency compared to GAHA by 6% and FFD by 57% while is about only 4% higher than optimality. Therefore, we can sum up the proposed algorithms are quite efficient in joint cost and latency optimization. In addition, we proposed the pareto optimal solutions for both cost and latency objectives for different values of α which can be used to make a balance between conflicting objectives based on the desired goals. Finally, we emulated our work using Mininet to validate the latency results obtained through simulation. We observed that the Mininet results are only about 6% higher than the result obtained through simulation. As a future work, we plan to take into account the network traffic as another important objective in the optimization model along with VNF sharing policy in the SFCs placement.