Service Function Chain Placement for Joint Cost and Latency Optimization

Network Function Virtualization (NFV) is an emerging technology to consolidate network functions onto high volume storages, servers and switches located anywhere in the network. Virtual Network Functions (VNFs) are chained together to provide a specific network service, called Service Function Chains (SFCs). Regarding to Quality of Service (QoS) requirements and network features and states, SFCs are served through performing two tasks: VNF placement and link embedding on the substrate networks. Reducing deployment cost is a desired objective for all service providers in cloud/edge environments to increase their profit form demanded services. However, increasing resource utilization in order to decrease deployment cost may lead to increase the service latency and consequently increase SLA violation and decrease user satisfaction. To this end, we formulate a multi-objective optimization model to joint VNF placement and link embedding in order to reduce deployment cost and service latency with respect to a variety of constraints. We, then solve the optimization problem using two heuristic-based algorithms that perform close to optimum for large scale cloud/edge environments. Since the optimization model involves conflicting objectives, we also investigate pareto optimal solution so that it optimizes multiple objectives as much as possible. The efficiency of proposed algorithms is evaluated using both simulation and emulation. The evaluation results show that the proposed optimization approach succeed in minimizing both cost and latency while the results are as accurate as optimal solution obtained by Gurobi (5%).


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 f 4 and f 5 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. 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. 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. 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. 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.  Fig. 1 An example to illustrate VNF placement and link embedding in cloud/edge networks 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 costminimization 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 multiobjective 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.

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.
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 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 v sf indicates whether VNF f ∈ F from service chains s can be mapped on physical node v ∈ V (X v sf = 1) or not (X v sf = 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.

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Þ Table 2 Descriptions of Binary variables Variable Description Equal to 1,if virtual link l is mapped to physical link e, otherwise 0 y euv lpq Equal to 1,if virtual link l between VNF p and VNF q is mapped to physical link e between physical node u and physical node v, otherwise 0 Equal to 1 if service chain s is mapped to path , otherwise 0 w uv spq Equal to 1 if service chain s traverses from VNF p on node u to VNF q on node v, otherwise 0 Z pq s Equal to 1 if VNF q is the successor of VNF p in service chain s Equal to 1 if VNF f from service chain s is mapped to physical node v from path , otherwise 0 A pq Equal to 1 if there is affinity between VNF p and VNF q, otherwise 0 AA pq Equal to 1 if there is anti-affinity between VNF p and VNF q, otherwise 0 z v Binary variable is equal to 1 if physical node v hosts at least one VNF f.

ð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. z v is a binary variable that indicates if a physical node is active. To be active (z v = 1), a physical node v must host at least one VNF from any service chain, otherwise z v = 0. On the other hand, X v sf 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 v sf =1, then consequently z v =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]. p min v , p max v denote minimum and maximum power consumption of server v ∈ V, respectively. Cap v cpu indicates the available processing capacity in server v, d v cf is amount of CPU demanded by a VNF f ∈F,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 e sl is equal to 1 if virtual link l ∈ L from service chain s is mapped on physical link e ∈ E, otherwise y e sl ¼ 0: Combining Eq. (2)(3)(4), the overall cost model for all service chains is shown in Eq. (5).
ð5Þ 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: 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.

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: 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 subject to constraints (13-26).

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

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. (13-15) guarantee the CPU, memory and storage utilization constraints, repectiverly.
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.

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).
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).
The constraint defined in Eq. (20) ensures that all VNFs of each service chain should be placed and processed in a predefined order. It is worth to mention that if X u sp =1 and X v sq =1 and Z pq s =1, then we can summarize w uv spq =1, otherwise it equals to 0. 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 e sl ¼ 1 and consequently y e uv l pq .
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.
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.

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

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-toend latency is already formulated in the prior sections.
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 nearoptimal solutions for the problem of SFC placement.

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:

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: Where i=1, 2, …, P; j = 1, 2, …, N; x ij 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).

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).
Where R 1 and R 2 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: Where F(f i ) 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.

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.

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.

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:

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.

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).

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).

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.

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: 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 nonoptimized greedy approach.

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.

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. 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. 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 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.

Pareto quality of solution
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.

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.
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.

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.

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-toend 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.