Load Balancing Algorithm for Migrating Switches in Software-Defined Vehicular Networks

In Software-De ned Networks (SDN), the divergence of the control interface from the data plane provides a unique platform to develop a programmable and exible network. A single controller, due to heavy load traf c triggered by different intelligent devices can not handle due to it’s restricted capability. To manage this, it is necessary to implement multiple controllers on the control plane to achieve quality network performance and robustness. The ow of data through the multiple controllers also varies, resulting in an unequal distribution of load between different controllers. One major drawback of the multiple controllers is their constant con guration of the mapping of the switch-controller, quickly allowing unequal distribution of load between controllers. To overcome this drawback, Software-De ned Vehicular Networking (SDVN) has evolved as a con gurable and scalable network, that has quickly achieved attraction in wireless communications from research groups, businesses, and industries administration. In this paper, we have proposed a load balancing algorithm based on latency for multiple SDN controllers. It acknowledges the evolving characteristics of real-time latency vs. controller loads. By choosing the required latency and resolving multiple overloads simultaneously, our proposed algorithm solves the loadbalancing problems with multiple overloaded controllers in the SDN control plane. In addition to the migration, our algorithm has improved 25% latency as compared to the existing algorithms.


Introduction
The method adopted in conventional networks had some constarints, and for these constraints solution is SDN. SDN has a few core characteristics: 1) SDN has been approached by many academies and businesses in the past several years and had several bene ts due to the network virtualization technologies [4].
2) SDN is most notable aspect is the segregation of control and data planes. Data plane manages speci c network modules that are capable of handling and controlling the various data plane features. 3) Scenario of SDN can be observed from Fig. 1. SDN offers services to all the problems in the conventional network that requires separating the control plane for every network device [5].
Over the past several years, there is enormous increase in the amount of data centers that have switched to Software De ned Networking (SDN) to satisfy the needs of an evolving cloud-driven industry [6]. With the current study, it has been examined that the market of SDN has accounted for: $10.80 billion in 2015 is now expected to reach $135 billion in 2022 which is growing at a Compound Annual Growth Rate (CAGR) of 43% from 2015 to 2022. SDN is continuously rising at a greater speed. The entire area of SDN is composed to surge at a CAGR of 42.41% during the tenure of 2019-2024. The expanding growth in big data is greatly increased with the adoption of software-de ned data centers across all the areas that include retail, IT, telecom, etc. Software-De ned infrastructure aims at implementing the automation processes that run smoothly in organizations [7]. Instead of handling a plethora of appliances independently, SDN allows the administrator to handle their entire network as a single unit and make the required changes from a single point of access whenever required.
SDN load balancing has also brought forward the concept of multiple-controller SDN. For example, the SDN southbound interface protocol, OpenFlow v.1.3, can technically handle controller replication and load-balancing. There are three main phases of an SDN controller: master, slave, and equal [8]. A controller could alter its location at any moment but only the controller in the master state has complete access to the switch. It supports exible switch migration of many distributed controllers, therefore it is a simple and ef cient strategy for load-balancing. The control plane's tentative design uses only one controller. Though the bene ts of a central controller could alter its location at any moment, however only the controller in the master state has maximum switch visibility. SDN network control confronts some issues which challenge its nature (i.e., centralized control) due to a growing daily operations-today network demands. Therefore, in this paper, we proposed a load balancing switch migration scheme using the multiple controllers in software-de ned vehicular networks to overcome the failure of a single controller on one server which results in a highly available and scalable multi-controller in SDN. To the best of our knowledge, to simultaneously solve the problem of why, what, and how; the load balancing will be performed on a heavily loaded switch to immigrate to the least loaded controller. There are many methods proposed in the literature but our scheme gives the best results as compared to the previously implemented algorithms.

Research Contributions
This paper differentiates from the existing body of literature in terms of: i. Irrespective of the conventional load balancing algorithms for vehicular networks, this paper advertises switch migration for vehicular networks in a vehicular environment. ii. We designed a load balancing approach to measure the load of controllers and switches linked to the controller and notifying the load information systematically to the super controller through transmitting messages which is the essential part of the load balancer controller.
iii. We evaluated the response time operations vs. controller load that can assess the development tendency in latency for the controller as load increases. iv. We used latency to measure controller load, and we acquire an appropriate latency threshold to better identify overload controllers to manage them in advance. v. To enhance the failure of single controller load balancing, we proposed a new switch migration algorithm to handle multiple loaded controllers. Whenever there is huge load on one controller in a single load-balancing operation for software-de ned vehicular networks, then the proposed methodology handles the load smoothly.

Paper Organization
The remaining of the paper is organized as: Section 2 presents the literature survey on SDN load balancing and laid the focus on the algorithms of load balancing. Section 3 explains the multi-controller load balancing in SDN. Section 4 discusses the details of the preliminary network setup of our proposed algorithm. Section 5 focuses on the implementation and results analysis and nally, in Section 6 conclusion of the paper is presented.

Literature Survey
Load balancing in vehicular networks needs a lot of improvement at its early stage. There are multiple proposals of research that exist in the literature survey which resolves the issues of load imbalance amongst the servers and various controllers. For instance [9], authors analyze a exible control method to determine which switch and where to relocate to a balanced control plane and recognize it as a switch migration problem (SMP). The switch migration method is being proposed by [10] which perceives the switch migration as a signature selection problem but is developed as the Earth Mover's Distance (EMD) framework to safeguard technically critical network controllers and later developed the heuristic load balancing method which is ef cient and is scalable for the immense scale networks.
The authors of [11] evaluated SDN based on an optimization load balancing algorithm that utilizes the effect of the linear increase in the load and diminish the weight of inertia to improve the execution of constrained swarm optimized which further would reduce the response time and enhance the Quality of Service (QoS) metrics. In [12] authors developed the load balancing strategy based on switches for multiple controllers. This strategy balances the load between switches and controllers as well as resolves the back and forth of the load and helps to enhance the ef ciency. Trestian et al. [13] implements the OpenFlow load balancing algorithm for the data centers network that allows the ef cient and effective use of resources at the least cost and complexity. The reliable and load balance aware multi-controller in [14] proposed this approach to initiate the multi-controllers and discuss the related QoS for the reliable load balancer and later the algorithms permit the switches to controllers to balance the load distribution among the various controllers. Nkenyereye et al. [15] framed the concepts that implement the softwarede ned vehicular networks based system which is based on the modeling and execution schemes. Later the authors presented the different architectures and their respective system models for LTE-V2X interactions.
The authors of [16] proposed the multi-controller load balancing approach for the SDN termed as Dynamic Clustering. In this whenever an overloaded cluster is detected then the Super Controller (SC) runs the partition algorithm that rearranges the Regular Controller's (RC's) into the clusters of RC's and therefore, it simpli es the operation of load balancing and divides the dependency between the SC's and RC's during the periodical load balancing. Askar [17] proposed an adaptive load balancing technique uses the OpenFlow switches that were programmed to work using the function it can be a switch, hub, or router. OpenFlow switches operate in the charge of the controller that is interconnected to the entire switches and has an overview of the complete network and its corresponding resources. The authors of [18] facilitated the controllers of the SDN optimization problem for balancing the load in a mathematical model. Later authors proposed a Dijkstra's Routing algorithm in the SDN nodes which can suggest the separated multipath routing.
Authors of [19] load balancing problem was formulated as a Mixed Integer Non-Linear Programming (MINLP) to minimize the mean reaction time between both the switch and the controller. Nevertheless, a load-balancing better solution is needed to handle the ow communication between OpenFlow switches so that the switch migration costs and controller load variance are shared. Tennakoon et al. [20] developed an approach known as Q-Learning for balancing the load in Software De ned Networks to degrade the number of users who are not satis ed in a 5G network. This solution combined Q-Learning techniques with a fairness function to improve the user experience at peak traf c conditions. The authors of [21] framed the proposed EASM (Ef ciency Aware Switch Migration) for effectively migrating the switches. In this, we have evaluated the performances of EASM algorithms that are against the baseline schemes. EASM diminishes the response time for effective migration.

Multi-Controller Load Balancing in Software-De ned Networking
In this section, we emphasized the multi-controller load balancing research in SDN. We rstly introduced the concept of a single controller and then illustrated the multi-controller load balancing.

Load Balancing in SDN
The servers in the network get loaded up with the load as the request from users are rising. Therfore, the load must be balanced to provide a better service and meet QoS requirements. If all this problem is overlooked, then it results in the link failure and server crash [8]. Compared to conventional networks, the switches only have a data plane with them while splitting all control planes from the switches and progressing them to a central system in SDN called a controller. Therefore, an enormous volume of data needs to be collected and uploaded to the cloud. The networking resources have to be distributed continuously and effectively for improved user satisfaction and better productivity when accessing the data [12]. A load balancer function is to maximize bandwidth to boost ef ciency, with low latency, using the resources effectively with no deadlocks, but not imposing extra overhead on the network. Although there are issues with reliability and scalability with a single controller. Thus, to solve this issue, getting distributed multiple controllers is an alternative for east-west interfaces that allows those controllers to interact among themselves.

Single and Multi-Controller Load Balancing
During the initiation phase of SDN architecture, the overall network is controlled by a single controller [22]. In Fig. 2, four network switches are controlled by a controller (c1), if the source host wishes to transmit a new packet to switch (s1), the switch could not perform the forwarding function as no routing information is available for the new packet. The switch (s1) instead exchanges (Packet-in) messages to the controller (c1) to enable the routing for the new packet. Upon obtaining a controller response, migrate to another network, and then transmit the packet. Eventually, the packet effectively achieves the destination host. In the ow of transferring the packet, the controller plays an essential role [13]. Because of the limited capacity of the controller, a single controller is not able to deal with the huge volume of requests transferred from the switches. Therefore, switches cannot organize the routing information of the newly received packets which unfortunately would affect the communication and network applications. Due to the constraint in the implementation of OpenFlow has suggested the idea of master and slave controllers where one switch can interact with one controller and various slave controllers [23]. In Fig. 3 multi-controllers became a new SDN paradigm that resolves the issue of a single controller. There are two Ryu SDN controllers in the topology given below and every controller handles the network. In this case, (c1) and (c2) share a certain logic in a logically uni ed way, so that both (c1) and (c2) will enable routing paths explicitly in all relevant switches when new packets arrive at (s1). That means, it can appropriately relieve a single controller's ow processing load [14]. To resolve the issue of a single point of failure, the two Ryu controllers are the backup for each other. Based on the above analysis, it is observed that multi-controller design can ef ciently improve the performance of the network of SDN and in the future, the utilization of multi controllers became modern research. Therefore, to balance the load among the switches in the various controllers, the important aspect is how the load can be balanced, on which parameters the load will be balanced, and how the load can be calculated to facilitate the minimum results in respect to latency, the volume of packet-in messages are arriving from the switches, how much memory is consumed [24], what is a load of rule installation this will give rise to the effect of load on the multi-controllers and nally it will produce the minimum migration cost and time [25].

Preliminary Network Setup for Proposed Algorithm
In this section, we proposed the algorithm for load balancing that explains the design.

System Model Designing
In this section, we present the major components of load balancing that are the essential part of our network design followed by our switch migration mechanism. Normally, when a switch encounters a packet, designed to match a non-corresponding ow table entry in an SDN network, the incoming packets must be summarized in a PACKET IN message and moved to their master controller for routing and ow table entry execution. PACKET IN message processing is commonly considered to be the most signi cant aspect of controller load. Thus, the massive distributional difference between PACKET IN messages could lead to imbalance workloads amongst multiple controllers. Within this section, we introduce the load balancing algorithm based on migrating switches in the Software-De ned Vehicular Networks technique to balance the load with various overloaded controllers, making a ne-grained based on latency for overloaded controllers.
We designed a network of SDN Graph G comprised of X controllers as shown in Fig. 4 where A = "{A 1 , A 2 , A 3 , . . . , A X }" and Y switches B = "{B 1 , B 2 , B 3 , . . . , B Y }". Such controllers serve the same purpose and split the network into N regions. The traf c ow and controller volume of work are dynamically altered in each region. Let us assume R Am ∈ B denotes the switch set is handled by the master controller A m . In this section, we have described the design of the algorithm, the rest of the section consists of problem formulation and measurement of load.

Measurement of Load and Acquiring Latency
An actual outcome for recurrent statistics is introduced into our scheme calculating the latency at the same time interval, Z. Let us say B y and Z x to indicate the yth switch and xth time, respectively. Assume z arrive indicates the PACKET IN message arrival time and z reply indicates the time till we receive the reply from the controller in the form of PACKET OUT message to the corresponding switch. Therefore, it is easy to receive the latency to the PACKET IN request as de ned in Eq. (1).
In the meantime, the volume of messages requested is recorded from B y in Z x (indicated as (gB y Z x )) which is used to represent the workload received by B y in Z x (indicated as Load ByZx ). Thus, the total load of the switches in R Am is de ned as the volume of requests messages received Load AmZx of controller Am in the xth time and is represented as in Eq. (2): We signify the latency as z By response to the entire PACKET IN requests forwarded from B y in Z x . Consequently, A m in Z x can easily access the overall latency of all messages recognized. After receiving these data, we could even acquire the average latency directly to a single PACKET IN message with an interval of time Z in Eq. (3):

Threshold Based on Latency
To identify the overloaded controller and load imbalance occurrences, and to identify the necessary migration time, a threshold value is needed. The threshold value isn't static in the present section, since attempts have been made to balance the entire load of the control plane as precisely as possible among all the controllers. If the threshold value is less than the controller's load then it is likely to unbalance the controller due to the massive traf c which leads to the high cost of migration and faulty stability of the network. Therefore, choosing the threshold value is important for the precise load imbalance judgment.
For this, we need to calculate the controller's load based on latency. The experiment testbed was implemented using a Linux Ubuntu server system. The experiments ran on an Ubuntu Server 18.04 (64-bit) LTS with an Intel i7 core 8th generation and 16 GB of memory. The hypervisor was used in VirtualBox 5.2, Mininet, Ryu, and tested load balancing algorithms. Python 2.7 is used to write the main logic in Ryu as well as the topology used in Mininet. Communication between the controller and switches occurred on port 6653 and utilized the OpenFlow 1.3 protocol. Each experiment runs for 1000 s or 10 min.

Controller's Load Detection
The sudden and unceasing rise in latency is used to identify the best load-balancing time. In this, what we have to do is begin to compare the latency of all controllers with the required threshold to gure out which controller is easy to access and tends to be in a huge load state. To get the overloaded controllers, set the latency of all the controllers present in a given time. The two sets Source Controllers and Destination Controllers are used to ef ciently choose overloaded controllers, and lower load shifting pair complexity. Source and Destination controllers are designated as SRC_C and DST_C respectively. Therefore, we examine the controller's latency and determine which controllers should be chosen as SRC_C and which should be chosen as DST_C.
• If z AmZx > threshold value; A m is added to SRC_C.
• If z AmZx <= threshold value; A m is added to DST_C. We obtain the interval of time Z x , we evaluate the set SRC_C and DST_C to acquire the latency time of all the controllers. In this section, we conclude the load balancing algorithm by facilitating the ow of detection of load balancing as mentioned in Algorithm 1 in Tab. 1, and the owchart for the algorithm proposed is shown below in Fig. 5.  if z AmZx > threshold value 6.
A m is added to SRC_C 7. else 8.
A m is added to DST_C 9. endif 10. endfor 11. return SRC_C and DST_C End

Switches Migration
When there are multiple overloaded controllers, we suggest the technique based on migrating the switches in a single controller load balancing to boost the performance of the load balancing algorithm. It can do the shifting of a load of the multiple controllers too, reducing load-balancing time considerably. Balancing network traf c among controllers, is the key factor to consider for a congestion-free network, and to have that, migration protocol is one where switch migration occurs if an imbalance network resides [26]. It is the main SDN controller function that aims to provide an improved system environment. To improve network ef ciency and prevent the crashing Figure 5: Flowchart of proposed model of controllers, packets must be evenly distributed amongst controllers. By moving the transition from the master controller to the slave controller, load balancing is accomplished [27]. When trying to migrate a switch, two principal concepts must be kept in mind: a. It should not be overloaded if the slave controller is called to become a new master controller. b. After migration, the controller must have a balanced load.
To determine how and where to move the switches, we need to see whether the controller is overloaded and test the viability of each linked switch. If yes, switch to the lightly loaded controllers to remove the gap among the controller and the switch, then continue with the process of packet transmission.
Algorithm 2 in Tab. 2 states that the migration of switches is evaluated as a set of migration actions followed by an (A u , B e , A v ). Lastly, the shifting of load and migration of switches is accomplished and we have decided the migrations for the overloaded multiple controllers. By these steps of implementation, our proposed algorithm is optimizing the process of packets' transmission.

Implementations and Performance Evaluation
We have discussed the load balancing algorithm based on migrating switches in Software-De ned Vehicular Networks. We present an analysis that can ef ciently manage the allocation of loads between multiple controllers. This demonstrates what controller will encounter when there is increased delay which is responsible for bottleneck in performance. The detection of load balancing of all the controller's average latency to compare it with the threshold value. If the load is not balanced, the algorithm will migrate the switches to the under-loaded controllers (DST_C) to make it balanced.
We are implementing Ryu as a controller for the SDN. Throughout simulations the average setting time, T has been estimated to be 10 s. A brief period would then vastly enhance monitoring and overhead computation and can lead to regular migration. Several other important network state information may be missing in a long-time-interval because the default ow time in the Ryu controller is 10 s. In this paper, we are emulating the real-time application on the internet with the Zookeeper having OpenFlow switches (OVS) and 15 hosts shown in Fig. 6 and Tab. 3, all the switches/hosts are connected to the controllers but the whole network will be managed by the master controller. The performance of the topology can be evaluated by the traf c load on the planes. It enhances the availability and scalability while transmitting the packets through the planes. Therefore, we choose a lightweight emulator for analysis of the tool, mininet, and edit 7 OVS to inject the packet in ows to the respective controllers. There are three controllers required to set up the 7 hosts/OVS: Controller 1 to Controller 3. We have bifurcated all the 7 OVS into 3 controllers to balance the load of the different controllers. In this section, we compared the four techniques with our proposed technique: Distributed Hoping Algorithm (DHA), switch migration-based decision-making (SMDM), online controller load balancing (OCLB), traf c pattern based load balancing algorithm (TPLB), and the proposed algorithm. The distribution of load technique is applied by enhancing the requested messages through the packet in for 20 s. Various strategies can be applied balance the load and to get the stable state before 150 s. Assume the ratio indicating the distribution of load as given in the Eq.   The latency threshold selection will help us to identify and work with overloaded controllers which also helps the proposed approach to outperform the other load balancing strategies. In the ongoing messages requested by the switches, our strategy migrated the switches on time to the least loaded controllers, A2 and A3. In A2 and A3 load, the balancing phenomenon begins after every 20 s. Therefore, we have diminished the load of the controller (A1) in Fig. 7. In Fig. 8 the ve load balancing strategies were compared and our strategy-V proved to have the lesser number of switches migrated after balancing the load.

Conclusion
Throughout this study we examined the issues of overloaded multiple controllers. Firstly, we presented some recent studies on latency features vs. load controller. The required latency threshold has to compromise between the load balancing effect and the cost of migration. Finding an ef cient migration strategy for load balancing in SDN controllers is the prime purpose. We proposed highly scalable Load Balancing Algorithm based on migrating switches and thus achieved the optimized results. Our strategy facilitated better load balancing for controllers and migrated the load of overloaded switches to the other controllers in a short amount of time. Therefore, the proposed algorithm achieves the load balancing of multiple controllers in SDN ef ciently and fastly. In the future, we plan to study the migration cost and distance between controllers and switches in the multiple overloaded controllers.