SDN-Based Routing Framework for Elephant and Mice Flows Using Unsupervised Machine Learning

: Software-deﬁned networks (SDNs) have the capabilities of controlling the efﬁcient movement of data ﬂows through a network to fulﬁll sufﬁcient ﬂow management and effective usage of network resources. Currently, most data center networks (DCNs) suffer from the exploitation of network resources by large packets (elephant ﬂow) that enter the network at any time, which affects a particular ﬂow (mice ﬂow). Therefore, it is crucial to ﬁnd a solution for identifying and ﬁnding an appropriate routing path in order to improve the network management system. This work proposes a SDN application to ﬁnd the best path based on the type of ﬂow using network performance metrics. These metrics are used to characterize and identify ﬂows as elephant and mice by utilizing unsupervised machine learning (ML) and the thresholding method. A developed routing algorithm was proposed to select the path based on the type of ﬂow. A validation test was performed by testing the proposed framework using different topologies of the DCN and comparing the performance of a SDN-Ryu controller with that of the proposed framework based on three factors: throughput, bandwidth, and data transfer rate. The results show that 70% of the time, the proposed framework has higher performance for different types of ﬂows.


Introduction
In traditional networks, control management and data forwarding are tightly coupled, where distributed devices control the whole network, and it is hard to improve the flexibility and extensibility of the network. Therefore, congestion and unbalanced loads are real problems in networking. One of the main causes of these problems is the unfair use of network resources by specific flows [1,2]. Subsequently, the need to develop a network architecture and corresponding traffic engineering (TE) technology becomes imperative to solve these problems [3].
To address this problem, the idea of software-defined networking (SDN) is introduced. Compared to traditional networks, a SDN has several advantages to support TE because of its distinguished characteristics, such as the separation between the forwarding and control plane, control centralization, and capability for network behavior programmability [4,5]. In addition, a SDN has the capability of controlling the efficient movement of data flows through the network to fulfill sufficient flow management and effective usage of network resources. A SDN enables the development of more innovative programmable network control and routing solutions based on a global view of network status and fine-grained control of network traffic and network resources [6]. The essential portion, which has a real effect on network performance, is flow routing. The main purpose of flow routing in a network is to access the required data as fast as possible, which is an obvious advantage that can be provided to the performance of a network by the routing process [7,8]. In multipath routing, the calculation of the optimal path and the substitution of link failure is the responsibility of the SDN controller. However, recent studies have shown that the time spent to select the optimal path by the SDN controller is high [9].
A data center is a network of computing and storage resources. It provides the delivery of applications and shared data. Recently, data centers have developed quickly, with their infrastructure having changed from the traditional structure of physical servers to virtual networks, which supports applications. In a DCN, most of the network traffic is mice flows with a small volume, and they hold less than 10% of the overall transmitted bytes. In contrast, elephant flows represent only 10% of the flows, but they hold 90% of the overall transmitted bytes. In general, mice flows induce transient congestion, while elephant flows cause constant congestion. Network congestion is one of the main reasons for poor performance, as not all of the flows use the network resources equally.
To address the above problem, ML approaches are introduced, such as in [10][11][12][13][14][15][16]. All these studies have proposed techniques for optimizing network performance and providing high quality of service (QoS) by prioritizing mice flows or scheduling re-routing elephant flows. Recently, some studies [17,18] have integrated ML techniques in a SDN to enhance the security system of the network, improve network flow management, and strengthen the development of network design. ML has the potential of solving a wide range of networking problems, including design, implementation, performance, and verification [19].
In this paper, unsupervised ML algorithms are utilized to characterize network traffic and identify them into mice and elephant flows based on predefined features. To minimize the dimensionality of the data while keeping their distinctive features, principal component analysis (PCA) is used. K-means is implemented for grouping the flows that have similar metrics of network performance to aid the flow routing of elephants and mice based on their features. The main contributions of this paper are to develop a SDN-based application using unsupervised ML and achieve four specific aims: (i) To develop a new SDN-based routing framework using the concept of flow identification. The framework includes two parts that cooperate with the controller, namely, traffic analysis and external application. (ii) To provide an identification mechanism to distinguish flows as mice and elephants based on K-means clustering after a phase of dimensionality reduction using principal component analysis. (iii) To develop a flow routing algorithm that selects the shortest paths for mice and the widest paths for elephants. Hence, a more balanced network results and a higher throughput is obtained. (iv) To enable more efficient calculation of route cost and provide consistency with real-time constraint. Route update is accomplished based on a recursive process.
The remainder of this paper is organized as follows: In Section 2, the literature review is presented. Afterward, the methodology is provided in Section 3. Section 4 shows the experimental results and analysis. The conclusions and directions for future works are provided in Section 5.

Literature Review
The centralization concept of SDNs is to transfer the control of routing from individual elements of a network to a central point of control. In addition, the synchronization and control ability in a SDN provides all the required information about the interconnection between the hosts and the capability to make fast decisions of switching. Therefore, SDNs can guarantee a high level of performance.
The essential reasons for network performance degradation are network congestion and imbalance in network load, which may be caused by inefficient routing of elephant and mice flows. In [20], a SDN-based detection and scheduling algorithm was proposed for the detection and scheduling of elephant and mice flows based on flow-completion time (FCT), leading to the mitigation of mice flows and the throughput maintenance of elephant flows in the data center network. Similarly, the authors in [21] introduced an ESCA framework. The aim of the proposed framework is to achieve an effective loadbalanced routing for scheduling mice and elephant flows. This framework is implemented based on the proposed efficient sampling and classification methods. In [22], a SDN-based load balancing approach in a data center network is suggested. This approach starts with classifying flows as elephants and mice and ends with enforcing distinct schemes of routing for specified flow types to enable a high-capacity usage of the network. The proposed solution works initially by determining two zones for elephant and mice flows with several idle paths, which are pre-decided for elephant flows, and minimum weighted paths, which are confined to the mice zone for mice flows. In [23], a load balancing mechanism was proposed using multipath routing of elephant flows in the SDN to improve the utilization of the network.
The application of SDNs have attracted a lot of interest to solve the problem of network management in recent years. In [24], the authors applied a dynamic routing mechanism in a SDN to solve the problem of inconsistent distribution of network traffic that causes congestion in the network links. The authors in [25] introduced a system that enables the operator of the network to define templates. These templates can reroute elephant flows for a specific objective in order to address the high impact of elephant flows on the overall network traffic.
To improve network performance, elephant detection and routing techniques were proposed in [26]. The proposed techniques scan the network to find all the paths available between the source and the destination and calculate the link bandwidth of different available paths. In [27], the rerouting of elephant flows using an ant colony optimization-based technique is presented. This technique, which is called DPLBAnt, utilizes a shortest-path problem in the SDN to alleviate the high controller-switch load. In [28], the authors proposed a routing strategy that is based on deep Q-learning (DQL) to autonomously generate optimal routing paths for SDN-based data center networks. The proposed framework trains deep Q networks to meet the different demands of mice and elephant flows in the data center networks by achieving a low latency and a low packet loss rate for mice flows and a high throughput and a low packet loss rate for elephant flows. The researchers in [29] presented a model-free reinforcement learning method, which converts the path computational problem into a learning problem. In order to improve the network's average path utilization, the DeepRoute model learns strategies to manage arriving elephant and mice flows from the network environment. Similarly, [30] proposed an NNIRSS, which is a neural network (NN)-based intelligent routing scheme for SDNs. It utilizes NN to create patterns for data flow transmission and replaces the flow table with well-trained NN in the form of an NN packet. Furthermore, the authors developed a mechanism of intelligent routing based on the radial basis function of neural networks.
Overall, it is found that none of the existing approaches for flow routing in SDNs have proposed an application for identifying mice and elephant flows, enabling flow type and topology-aware routing. The objective of this paper is to propose a framework that can accomplish this by using two blocks, namely, external application and traffic analysis. Furthermore, this work proposes a mechanism for routing by using the short routes for mice flows and the widest routes for elephant flows. The cost of routing is computed recursively, which provides more efficiency and enables consistency with real-time constraints.

Proposed Methodology
In this section, the SDN-based flow routing application is presented. Figure 1 illustrates the stages of the proposed methodology. These stages are detailed hereinafter. Network 2023, 3, FOR PEER REVIEW 4 In this section, the SDN-based flow routing application is presented. Figure 1 illustrates the stages of the proposed methodology. These stages are detailed hereinafter. The proposed method starts by capturing the OpenFlow traffic statistics from the SDN switch and saving them as raw data. Then, the proposed application takes over the pre-processing of the input data to prepare them for the next step, which uses unsupervised ML.
The aim of utilizing unsupervised ML techniques is to characterize the flows based on network performance metrics. This step includes applying PCA and K-means. The PCA technique is applied to reduce dimensionality. PCA is a technique that uses a linear transformation concept. The technique starts with arranging the data based on their variance and representing the arranged data as coordinates. In the end, the coordinates with the highest variance values will be kept, while those with the lowest values will be ignored. Consequently, the dimension of the dataset will be reduced. K-means has attracted wide attention due to its simplicity and effectiveness in building robust cluster labeling. It is considered one of the efficient and fast techniques that contributes to solving practical clustering problems [31]. K-means as an unsupervised clustering method can create clusters of flow without the need for predefining the classes. After that, to identify flows as mice or elephants, the thresholds for the flow features are pre-defined.
After that, the flows are identified as mice and elephants for each cluster that results from the clustering process. The thresholds for predefined flow features are determined to achieve an automated identification process that can optimize the forwarding of these flows in the network [32].
Finally, two topologies of data center networks (DCN) are used for the SDN deployment. The main objective of this work is to select the best path for each of the elephant and mice flows. The selection of the best path for a flow is performed depending on the requirements of the flow, such as low latency for mice flows and high bandwidth for elephant flows. Therefore, the links that fulfill the conditions are determined, and the paths that contain the appropriate bandwidth and latency will be selected. To find the best path for mice and elephant flows, a developed algorithm was proposed that leverages the inverse relationship between the bandwidth and latency to calculate the cost of the link.
The rest of this section is organized as follows: In Section 3.1 the architecture of the proposed SDN-application is presented. Afterward, the implemination of the architecture is provided in Section 3.2.

SDN-Based Application Architecture
The conceptual graph shown in Figure 2 displays the proposed framework for elephant and mice flow identification and selection of the best paths to route them. The processes of the framework are based on specifying the appropriate parameters and integrating the unsupervised ML and the SDN environment. The proposed framework contains The proposed method starts by capturing the OpenFlow traffic statistics from the SDN switch and saving them as raw data. Then, the proposed application takes over the preprocessing of the input data to prepare them for the next step, which uses unsupervised ML.
The aim of utilizing unsupervised ML techniques is to characterize the flows based on network performance metrics. This step includes applying PCA and K-means. The PCA technique is applied to reduce dimensionality. PCA is a technique that uses a linear transformation concept. The technique starts with arranging the data based on their variance and representing the arranged data as coordinates. In the end, the coordinates with the highest variance values will be kept, while those with the lowest values will be ignored. Consequently, the dimension of the dataset will be reduced. K-means has attracted wide attention due to its simplicity and effectiveness in building robust cluster labeling. It is considered one of the efficient and fast techniques that contributes to solving practical clustering problems [31]. K-means as an unsupervised clustering method can create clusters of flow without the need for predefining the classes. After that, to identify flows as mice or elephants, the thresholds for the flow features are pre-defined.
After that, the flows are identified as mice and elephants for each cluster that results from the clustering process. The thresholds for predefined flow features are determined to achieve an automated identification process that can optimize the forwarding of these flows in the network [32].
Finally, two topologies of data center networks (DCN) are used for the SDN deployment. The main objective of this work is to select the best path for each of the elephant and mice flows. The selection of the best path for a flow is performed depending on the requirements of the flow, such as low latency for mice flows and high bandwidth for elephant flows. Therefore, the links that fulfill the conditions are determined, and the paths that contain the appropriate bandwidth and latency will be selected. To find the best path for mice and elephant flows, a developed algorithm was proposed that leverages the inverse relationship between the bandwidth and latency to calculate the cost of the link.
The rest of this section is organized as follows: In Section 3.1 the architecture of the proposed SDN-application is presented. Afterward, the implemination of the architecture is provided in Section 3.2.

SDN-Based Application Architecture
The conceptual graph shown in Figure 2 displays the proposed framework for elephant and mice flow identification and selection of the best paths to route them. The processes of the framework are based on specifying the appropriate parameters and integrating the unsupervised ML and the SDN environment. The proposed framework contains four blocks, which are clarified into four categories: (i) the data center network (DCN) topology, which is responsible for the deployment of the proposed DCN topologies; (ii) the SDN controller, which is the block that facilitates the communication between the blocks (i) and (iii) by using an OpenFlow protocol as a southbound interface and RESTfull API as a northbound interface; (iii) the external application, which is the block that implements the proposed flow routing mechanism; and (iv) traffic analysis, which is responsible for storing flows and their paths and visualizing the record.
four blocks, which are clarified into four categories: (i) the data center network (DCN) topology, which is responsible for the deployment of the proposed DCN topologies; (ii) the SDN controller, which is the block that facilitates the communication between the blocks (i) and (iii) by using an OpenFlow protocol as a southbound interface and RESTfull API as a northbound interface; (iii) the external application, which is the block that implements the proposed flow routing mechanism; and (iv) traffic analysis, which is responsible for storing flows and their paths and visualizing the record. In this study, the Mininet emulator [33,34] was used to implement the proposed method. The SDN was deployed utilizing the SDN-Ryu controller [35]. The SDN application was designed for flow routing optimization that depends on a statistical analysis of network performance. The characterization of the flows based on the network performance metrics was achieved by employing unsupervised ML.
Principal component analysis (PCA) is a linear technique that was used in the proposed framework to reduce the dimensionality of the dataset employed. By converting correlated features to uncorrelated features, the dataset is reduced from a high-dimensional space to a low-dimensional space. To cluster the flows based on their own features of network performance, K-means was used as a second unsupervised ML technique. Afterward, flow identification is executed as a second stage of the proposed application. This stage consists of the process that is responsible for determining the type of flows (elephant or mice) based on the thresholds of the pre-defined parameters (flow duration, packet count, and average packet size) and a sampling operation to obtain representative flows for each cluster. The procedure is applied to each cluster that has resulted from the clustering operation.
The final stage includes selection of the best path for each type of flow. By using a developed routing algorithm, the best path selection is achieved for each representative flow. The developed algorithm was built based on two algorithms, which are the shortestpath Dijkstra algorithm [36] and the widest-path Dijkstra algorithm [37]. They were chosen to find the links that fulfill the conditions related to the types of flow previously identified. In this study, the Mininet emulator [33,34] was used to implement the proposed method. The SDN was deployed utilizing the SDN-Ryu controller [35]. The SDN application was designed for flow routing optimization that depends on a statistical analysis of network performance. The characterization of the flows based on the network performance metrics was achieved by employing unsupervised ML.
Principal component analysis (PCA) is a linear technique that was used in the proposed framework to reduce the dimensionality of the dataset employed. By converting correlated features to uncorrelated features, the dataset is reduced from a high-dimensional space to a low-dimensional space. To cluster the flows based on their own features of network performance, K-means was used as a second unsupervised ML technique. Afterward, flow identification is executed as a second stage of the proposed application. This stage consists of the process that is responsible for determining the type of flows (elephant or mice) based on the thresholds of the pre-defined parameters (flow duration, packet count, and average packet size) and a sampling operation to obtain representative flows for each cluster. The procedure is applied to each cluster that has resulted from the clustering operation.
The final stage includes selection of the best path for each type of flow. By using a developed routing algorithm, the best path selection is achieved for each representative flow. The developed algorithm was built based on two algorithms, which are the shortestpath Dijkstra algorithm [36] and the widest-path Dijkstra algorithm [37]. They were chosen to find the links that fulfill the conditions related to the types of flow previously identified.
The developed Dijkstra algorithms were employed to find the paths with appropriate bandwidth and latency. The last part of the proposed design is the traffic analysis. In this part, the flows with their paths are stored and visualized.
The next section covers the implementation of the proposed framework by running a group of proposed algorithms.

Architecture Implementation
The details of the algorithm for routing a flow are illustrated in Algorithm 1. This algorithm seeks to identify the best path in order to route each flow, which is the major procedure of the proposed framework. The procedure starts with extracting all the information of each input packet, such as source IP, destinationIP, inport, and outport. For each packet of the input flow, the existence of the source in the macTable is checked. Then, it is added to the macTable if it is not there. Thereafter, the destination is checked if it is in the macTable or not. In the case that a destination does not exist in the macTable, a broadcast message will be sent. Otherwise, a topology discovery will be executed using a Link Layer Discovery Protocol (LLDP). Next, Algorithm 2 FAS (Find all Available paths between two Switches) will be implicitly called by Algorithm 3 FAPBS (Find all Available Paths Between each pair of Switches) to find all available paths between each pair of switches. adjacency: adjacency matrix represents the network as a graph 2.
availableBandwidth:2D array contains available bandwidth between each two switches 3.
Paths: set of available paths between source and destination 4.
for each node1 in adjacency do 6.
for each node2 in adjacency do 7.
if node1 does not match node2 then 8.
paths{ node1TOnode2 } ← p 10. end if 11. end for 12. end for 13. Paths ← updateCost(paths, availableBandwidth) The aim of the K-means clustering and identification processes is to obtain representative flows for each mice and elephant type. Each representative flow is characterized by their network performance metrics. The flow identification process starts with extracting three parameters for each flow in each cluster. These parameters are flow duration, packet count, and average packet size. In the case of having a packet count higher than 15, a flow duration higher than 5 s, and an average packet size higher or equal to 10 KB, the flow is predicted as an elephant. Otherwise, the predicted flow is mice. This process is implemented by calling Algorithm 4. At the end of this process, three variables are obtained. clusterID represents the ID of the predicted cluster, flowType is a string indicating a mice or elephant flow, and the acceptable delay of the flow is represented as a float number called acceptableLatency.

1.
PPR: set of rules for predefined parameters 2.
FT: a string indicates mice or elephant flow 4.
CF: set of current flows 5.
RF: set of representative flows 6.
AL: a float number represents the acceptable delay of cf ∈ CF 7.
AL ← Ø 10. for each cid ∈CID do 11. for each cf ∈ CF do 12 After the flow identification process has ended, selecting the best path for each representative flow, installing the determined path, and updating the cost of the path recursively are the main steps of the routing process, which will be executed by calling Algorithms 5 and 6. source: source switch 2.
FT: a string indicates mice or elephant flow 5.
paths: set of paths between each two switches 6.
N: integer, determine number of paths to be selected 7.
availableBandwidth: 2D array contains available bandwidth between each two switches 4.
updatedPaths: updated version of input paths contains each path associated with the cost of that path 5. updatedPaths ←Ø 6.
for each key in Paths.keys() do 7.
for each path in Paths{key} do 9.
cost ← 0 10. for each node1, node2 in path{:-1}, path{1:} do 11. cost ← cost + availableBandwidth{node1}{node2} 12. end for 13. updatedPaths{key}.append({path,cost}) 14. end for 15. end for The first step of the routing process is checking the type of flow. If it is a mice flow, the available paths, which have been found by calling the FAPBS and FAS algorithms, are sorted with respect to length, and the shortest path will be selected as the best. Otherwise, it is an elephant flow, and the best N paths will be chosen based on the 1/bandwidth, as shown in Section 4.1.6. As a result, for each type of flow, we have the best path based on acceptable delay and available bandwidth for a particular source and destination. Then, the best path is installed for each of the elephant and mice flows (Algorithm 5). This is performed by sending a message containing the information of the selected path to the SDN controller in order to determine the required switches. Finally, an updated version of the input paths contains each path associated with the cost of the path. The process of updating is based on the paths, which is the output of the FAPBS algorithm and available bandwidth as a 2D array containing available bandwidth between every two switches. This is summarized in Algorithm 6.

Results and Analysis of Experiment
This section provides the experimental design and results. The experimental design is provided in Section 4.1, and the experimental results are provided in Section 4.2.

Experimental Design
Two DCN topologies were used to test the proposed framework. Figure 3 illustrates the first topology (No. 1), which consists of two servers, seven switches, and six hosts. The second topology (No. 2) includes two servers, sixteen switches, which are distributed on five layers, and three hosts, as shown in Figure 4.
bandwidth as a 2D array containing available bandwidth between every two switches. This is summarized in Algorithm 6.

Results and Analysis of Experiment
This section provides the experimental design and results. The experimental design is provided in Section 4.1, and the experimental results are provided in Section 4.2.

Experimental Design
Two DCN topologies were used to test the proposed framework. Figure 3 illustrates the first topology (No. 1), which consists of two servers, seven switches, and six hosts. The second topology (No. 2) includes two servers, sixteen switches, which are distributed on five layers, and three hosts, as shown in Figure 4.  The experiment was carried out by a group of steps as described below.

Monitoring and Gathering Data
Traffic monitoring is vital for improving the comprehensive performance of a network and traffic flow optimization, which is the aim of this study. The SDN technology introduces an innovative concept by making the network infrastructure scalable, usable, programmable, and centralized controllable. Furthermore, the SDN presents a dynamic monitoring scheme for network traffic. The Mininet emulation paradigm was used for setting up and installing a SDN environment in this study. The emulation environment includes a Ryu controller, OpenFlow switches, and hosts. Two scenarios for the DCN topologies were emulated, as presented in Figures 3 and 4, for implementing the proposed method. The used topologies are configured for handling the TCP and UDP packets. These flows are generated using a virtual machine created by the VMware workstation in a Linux environment. The OpenFlow Wireshark and tcpdump tools are used with the Mininet emulator to understand the behavior of the proposed DCN topologies for analyz- The experiment was carried out by a group of steps as described below.

Monitoring and Gathering Data
Traffic monitoring is vital for improving the comprehensive performance of a network and traffic flow optimization, which is the aim of this study. The SDN technology introduces an innovative concept by making the network infrastructure scalable, usable, programmable, and centralized controllable. Furthermore, the SDN presents a dynamic monitoring scheme for network traffic. The Mininet emulation paradigm was used for setting up and installing a SDN environment in this study. The emulation environment includes a Ryu controller, OpenFlow switches, and hosts. Two scenarios for the DCN topologies were emulated, as presented in Figures 3 and 4, for implementing the proposed Network 2023, 3 227 method. The used topologies are configured for handling the TCP and UDP packets. These flows are generated using a virtual machine created by the VMware workstation in a Linux environment. The OpenFlow Wireshark and tcpdump tools are used with the Mininet emulator to understand the behavior of the proposed DCN topologies for analyzing the performance of the network.
In order to perform a flow background load on the network, the experiment started with generating UDP packets with different sizes and rates during 300 s of simulation, as shown in Table 1. Following that, many TCP connections were initialized with different time flow between two hosts. The behavior of the first DCN topology using the throughput parameter is demonstrated in Figure 5. Wireshark was run in the background to capture the OpenFlow packets, which are a TCP packet type. Then, the tcpdump tool was utilized for the loopback interface. The collected data were stored as pcap files for the two proposed DCN topologies. To undertake a comprehensive analysis, the tcptrace tool was employed to produce all complete flows characterized based on the performance parameters and to store them in a CSV files.

Pre-Processing
This step is essential to obtain consistent, integrated, and processable data using the machine learning techniques. The preprocessing starts with data cleaning and data transformation, and it ends with data reduction [38], as illustrated in Figure 6. The data cleaning process is used to clean the dataset by eliminating irrelevant and useless records and parameters. Afterward, data transformation is performed to convert all features. The step ends with data reduction, where PCA is utilized with 13 components. The results prove the validity of the findings of the preprocessing in [38] by achieving a balance between completeness and simplicity and an accuracy of the clustering process. Wireshark was run in the background to capture the OpenFlow packets, which are a TCP packet type. Then, the tcpdump tool was utilized for the loopback interface. The collected data were stored as pcap files for the two proposed DCN topologies. To undertake a comprehensive analysis, the tcptrace tool was employed to produce all complete flows characterized based on the performance parameters and to store them in a CSV files.

Pre-Processing
This step is essential to obtain consistent, integrated, and processable data using the machine learning techniques. The preprocessing starts with data cleaning and data transformation, and it ends with data reduction [38], as illustrated in Figure 6. The data cleaning process is used to clean the dataset by eliminating irrelevant and useless records and parameters. Afterward, data transformation is performed to convert all features. The step ends with data reduction, where PCA is utilized with 13 components. The results prove the validity of the findings of the preprocessing in [38] by achieving a balance between completeness and simplicity and an accuracy of the clustering process. formation, and it ends with data reduction [38], as illustrated in Figure 6. The data cleaning process is used to clean the dataset by eliminating irrelevant and useless records and parameters. Afterward, data transformation is performed to convert all features. The step ends with data reduction, where PCA is utilized with 13 components. The results prove the validity of the findings of the preprocessing in [38] by achieving a balance between completeness and simplicity and an accuracy of the clustering process.

Flow Characterization and Cluster Analysis
The first aim of this project is to develop a flow characterizing mechanism based on the metrics of network performance. Unsupervised machine learning techniques were proposed to achieve this goal. K-means as unsupervised clustering can create clusters of flow without the need for predefining the classes. This algorithm isutilized to understand

Flow Characterization and Cluster Analysis
The first aim of this project is to develop a flow characterizing mechanism based on the metrics of network performance. Unsupervised machine learning techniques were proposed to achieve this goal. K-means as unsupervised clustering can create clusters of flow without the need for predefining the classes. This algorithm isutilized to understand the differentiation of flows with respect to their network performance features. It is applied to construct three clusters, where the minimum number of clusters was investigated in this experiment. The quality of clustering is measured by using the accuracy metric. This metric is determined by two factors: inter-cluster distance and intra-cluster distance [38]. As a result, unique samples of flow are recognized for each cluster.

Identifying Flow
One of the serious problems that affects the quality of service for mice flows is a slowdown transfer caused by elephant flows through a network, which leads to a degradation of network performance. The identification mechanism was proposed to distinguish the flows as elephants and mice by leveraging some of the parameters clarified in Section 4.1.3. Each elephant or mice flow is defined based on the threshold values marked on predecided features using the thresholding method [32]. The final step in this phase includes representative flow extraction for the elephant and mice flows in each cluster that has resulted from the clustering process. It is interesting in this step that, in some clusters, one or two representative flows can be extracted for elephant or mice flows.

Best Path Selection
Normally, a large number of servers and switches are included in DCNs. In a wide DCN, each node has multiple flows. Therefore, accessing the data with reliability and in a simple way is extremely hard in this type of network. To solve this problem, different topologies are used to improve the utilization of bandwidth and reduce network congestion. In this part of the work, two types of DCNs based on the SDN are deployed, as explained in Figures 3 and 4. In the DCN, the performance of the network is a critical aspect; hence, high throughput and sensitivity to packet loss are required. Elephant and mice flows are known as the main types of traffic in a DCN. Therefore, the need to manage the traffic of these types of flow still exists as discussed in the literature review section.
Many algorithms can provide routing for elephants and/or mice flows. For example, equal-cost multipath routing (ECMP) [39] can be utilized for routing mice but not elephant flows [40]. In this project, the primary aim is to select the best path for each elephant and mice flow. The best path for a flow is the path that achieves the requirements of the flow, such as low latency for mice flows and high bandwidth for elephant flows. A developed Dijkstra algorithm was proposed to find the route based on the type of flow (elephant or mice flows) by employing Algorithms 2, 3, and 5, as shown in Section 3.2. Using a developed Dijkstra algorithm, the links that fulfill the conditions are determined, and the paths that contain the appropriate bandwidth and latency are selected.
The Dijkstra algorithm was applied to find the shortest path for mice flows, whereas for elephant flows, the Widest-Dijkstra algorithm was used to find multiple paths to route them and record all the available shortest paths. Because it has an appropriate complexity for real-time problems and it gives deterministic results, the Dijkstra algorithm was chosen in this part of the work.

Updating Cost of Link
Determining a route for a particular flow through a SDN efficiently is still challenging. The SDN controller must obtain a lot of information in order to accomplish this. The information includes getting a comprehensive vision of the network (i.e., network topology discovery and getting link state information), computing the optimum paths for the flows considering the information of the flows and the network, and reconfiguring the routing table based on the new forwarding rules in the infrastructure plane. Common routing algorithms depend on three concepts to compute the cost of a link. These concepts are static link cost (Hop-to-Hop count, distance, and link capacity), dynamic link cost (available link capacity, and link utilization), and dynamic link cost while minimizing the interference (available link capacity, link utilization, and flow count on a link) [41]. The approach presented in this part explains the computing and updating of the cost of a link in the SDN framework. The cost of a link is calculated based on the inverse relationship between the bandwidth and the latency of the link, where latency is equal to the reciprocal value of bandwidth. The cost of the link is updated recursively. The cost of the link is calculated based on the updateCost algorithm in Section 3.2. An example and figures are explained for this aspect below.
Suppose that a host (Host) wants to send a set of packets to a server (Server) and there are two different routes between the Host and the Server, as shown in Figure 7, the steps below will be followed to calculate the link cost of both routes: 1.
The getAvailablePaths (Host, Server) algorithm will find these two paths (R1, R2) between Host and Server 4.

Results and Evaluation
This experiment was implemented with a CSV file for each DCN topology. Each file contains 1 million flows and 129 features regarding network performance metrics. These features can be found in Appendix A. The 129 features were chosen based on their efficiency in the clustering model [42]. For each TCP flow, we have all the network perfor-

Results and Evaluation
This experiment was implemented with a CSV file for each DCN topology. Each file contains 1 million flows and 129 features regarding network performance metrics. These features can be found in Appendix A. The 129 features were chosen based on their efficiency in the clustering model [42]. For each TCP flow, we have all the network performance parameters, such as packet loss, round trip time (RTT), and throughput. To reduce the dimensions of the dataset, the PCA technique was applied. A total of 13 PCA components were input into the clustering process. It is the best number of components to achieve a balance between completeness and simplicity [38]. The outputs of the clustering and identification steps are three clusters. Each cluster consists of a group of elephants and mice flows, which have distinct characteristics. In each cluster, the representative flow are selected for each type of flow. To find the best path for each elephant and mice flow, a developed Dijkstra algorithm was utilized. The flow types and description for the experiments are provided in Table 2.  Figure 8 depicts the routing process of each type of flow (elephant or mice) for all three clusters. To accomplish a high efficiency and obtain a higher throughput, a flow of the elephant type is sent by more than one path. At the same time, some available paths are kept to serve higher-priority flows, such as real-time traffic. The top left corner of the figure presents the best path that has been selected by the proposed algorithm (Widest-Dijkstra algorithm) for all elephant flows in cluster 1. Using the same technique, the best path for the elephant flows in clusters 2 and 3 are chosen. On the other hand, the bottom right corner of the figure shows the best path for the mice flows in the three clusters. This path has been selected based on Algorithm 5 and the Dijkstra algorithm. The figures clarify the used links with a green dotted line, whereas an unused link is represented by a red dashed line.   Figure 8 depicts the routing process of each type of flow (elephant or mice) for all three clusters. To accomplish a high efficiency and obtain a higher throughput, a flow of the elephant type is sent by more than one path. At the same time, some available paths are kept to serve higher-priority flows, such as real-time traffic. The top left corner of the figure presents the best path that has been selected by the proposed algorithm (Widest-Dijkstra algorithm) for all elephant flows in cluster 1. Using the same technique, the best path for the elephant flows in clusters 2 and 3 are chosen. On the other hand, the bottom right corner of the figure shows the best path for the mice flows in the three clusters. This path has been selected based on Algorithm 5 and the Dijkstra algorithm. The figures clarify the used links with a green dotted line, whereas an unused link is represented by a red dashed line. The evaluation results show the effectiveness of the proposed flow routing optimization method against the SDN-Ryu controller. Employing a developed Dijkstra algorithm to optimize flow routing results in improved network performance in relation to data center network resources. Furthermore, the evaluation aims to present the benefit of routing-based traffic management over network performance, regardless of the routing of The evaluation results show the effectiveness of the proposed flow routing optimization method against the SDN-Ryu controller. Employing a developed Dijkstra algorithm to optimize flow routing results in improved network performance in relation to data center network resources. Furthermore, the evaluation aims to present the benefit of routing-based traffic management over network performance, regardless of the routing of a particular type of flow that is being optimized by the developed routing algorithm, using the SDN framework.
The evaluation of the proposed system conducted for both topologies is provided in Figures 3 and 4. The first test includes a comparison between the SDN-Ryu controller and the proposed system based on their performance using the DCN topology in Figure 3. The comparison is accomplished based on the throughput and bandwidth parameters. As shown below in Figure 9, the proposed application provides a higher throughput than the Ryu controller. This is achieved for all flows. For example, at flow number 10, the throughput of the proposed application improves by a ratio of 61.5% compared to the throughput of the Ryu controller.
Network 2023, 3, FOR PEER REVIEW Ryu controller. This is achieved for all flows. For example, at flow number 10, the throu put of the proposed application improves by a ratio of 61.5% compared to the through of the Ryu controller. In addition, it is observed that a higher number of parallel flows leads to a declin the throughput for both the proposed application and the Ryu controller. However performance of the proposed method is still better than the Ryu controller. The comp son of throughput was performed for the two types of flows. Figure 10 presents the throughput for elephant flows for the proposed approach the Ryu controller. The findings show that the throughput provided by the proposed plication outperforms that of the Ryu controller. For instance, for flow number 16, result changes because the routing process is based on the type of flow and the ID of cluster. Therefore, the type of representative flow for each cluster is determined precis which is not applied in the Ryu controller. Consequently, the route for the representa flow is selected in a particular cluster and then applied to all the elephant flows in cluster. For flow number 22, the throughput of our application is about 88.2% superio that of the Ryu controller for elephant flows, when the throughput measurement is cuted for intervals of 0-40 s and has a bandwidth of 100 MB. In addition, it is observed that a higher number of parallel flows leads to a decline in the throughput for both the proposed application and the Ryu controller. However, the performance of the proposed method is still better than the Ryu controller. The comparison of throughput was performed for the two types of flows. Figure 10 presents the throughput for elephant flows for the proposed approach and the Ryu controller. The findings show that the throughput provided by the proposed application outperforms that of the Ryu controller. For instance, for flow number 16, the result changes because the routing process is based on the type of flow and the ID of the cluster. Therefore, the type of representative flow for each cluster is determined precisely, which is not applied in the Ryu controller. Consequently, the route for the representative flow is selected in a particular cluster and then applied to all the elephant flows in that cluster. For flow number 22, the throughput of our application is about 88.2% superior to that of the Ryu controller for elephant flows, when the throughput measurement is executed for intervals of 0-40 s and has a bandwidth of 100 MB.
cluster. Therefore, the type of representative flow for each cluster is determined preci which is not applied in the Ryu controller. Consequently, the route for the represent flow is selected in a particular cluster and then applied to all the elephant flows in cluster. For flow number 22, the throughput of our application is about 88.2% superi that of the Ryu controller for elephant flows, when the throughput measurement is cuted for intervals of 0-40 s and has a bandwidth of 100 MB.  On the other side, the throughput of mice flows is presented in Figure 11. It shows that both the proposed application and the Ryu controller provide the same throughput. It is interpreted by the fact that both of these methods use the shortest path for routing the mice flows. The measurement of mice throughput is run for interval 0-60 s with a bandwidth 100 KB.

Network 2023, 3, FOR PEER REVIEW
On the other side, the throughput of mice flows is presented in Figure 11. It s that both the proposed application and the Ryu controller provide the same throug It is interpreted by the fact that both of these methods use the shortest path for routin mice flows. The measurement of mice throughput is run for interval 0-60 s with a b width 100 KB. For the second parameter, which is bandwidth usage, Figure 12 shows that the formance of the proposed application is higher in most of the flows compared to the controller. The reasons behind that are (i) the use of a clustering process and (ii) the u a developed Dijkstra algorithm. The low performance of the proposed method in flow and 22 is because of the need to serve higher-priority flows. For the second parameter, which is bandwidth usage, Figure 12 shows that the performance of the proposed application is higher in most of the flows compared to the Ryu controller. The reasons behind that are (i) the use of a clustering process and (ii) the use of a developed Dijkstra algorithm. The low performance of the proposed method in flows 14 and 22 is because of the need to serve higher-priority flows.
For the second parameter, which is bandwidth usage, Figure 12 shows that the p formance of the proposed application is higher in most of the flows compared to the R controller. The reasons behind that are (i) the use of a clustering process and (ii) the us a developed Dijkstra algorithm. The low performance of the proposed method in flow and 22 is because of the need to serve higher-priority flows. The evaluation of the proposed mechanism for the second topology was acco plished by running two experiments to compare the performance of the Ryu contro and our proposed method. The comparison was based on the same parameters for first topology. Figures 13 and 14 depict the throughput and bandwidth usage measu ment provided by the proposed mechanism and the Ryu controller in the two exp ments. It is clear from the charts of experiment 1 that the performance of the propo The evaluation of the proposed mechanism for the second topology was accomplished by running two experiments to compare the performance of the Ryu controller and our proposed method. The comparison was based on the same parameters for the first topology. Figures 13 and 14 depict the throughput and bandwidth usage measurement provided by the proposed mechanism and the Ryu controller in the two experiments. It is clear from the charts of experiment 1 that the performance of the proposed method is better than that of the Ryu controller for the majority of flows for both parameters. However, as the number of flows increases, the performance of the proposed method is equal to or slightly less than that of the controller. In experiment 2, as shown in the charts of the aforementioned figures, the throughput and bandwidth provided by the proposed mechanism are improved compared to those by the Ryu controller. Consequently, the performance of the proposed mechanism is enhanced for 70% of the flows. Nevertheless, compared to the performance of the Ryu controller, the performance of the proposed application declines for the remaining 30% of the flows. The reason behind this reduction in performance is the need to serve higher-priority flows.
Network 2023, 3, FOR PEER REVIEW 17 method is better than that of the Ryu controller for the majority of flows for both parameters. However, as the number of flows increases, the performance of the proposed method is equal to or slightly less than that of the controller. In experiment 2, as shown in the charts of the aforementioned figures, the throughput and bandwidth provided by the proposed mechanism are improved compared to those by the Ryu controller. Consequently, the performance of the proposed mechanism is enhanced for 70% of the flows. Nevertheless, compared to the performance of the Ryu controller, the performance of the proposed application declines for the remaining 30% of the flows. The reason behind this reduction in performance is the need to serve higher-priority flows.    In general, it is observed that the performance of the two methods improves as the number of flows increases in both experiments.
The third parameter that was used to compare the performance of the proposed approach and the RYU controller is the data transfer rate. This parameter was added to support the evaluation of the proposed method. Figure 15 shows that the proposed method is more effective in transferring data than the Ryu controller for most of the flows in both experiments. Based on the measurement of the rate of data transfer, the proposed method In general, it is observed that the performance of the two methods improves as the number of flows increases in both experiments.
The third parameter that was used to compare the performance of the proposed approach and the RYU controller is the data transfer rate. This parameter was added to support the evaluation of the proposed method. Figure 15 shows that the proposed method is more effective in transferring data than the Ryu controller for most of the flows in both experiments. Based on the measurement of the rate of data transfer, the proposed method in the second experiment has the same behavior as the previous parameters for the majority of flows, where the performance becomes better than it is in the first experiment, although it may be slightly less than the performance of the controller sometimes.
Network 2023, 3, FOR PEER REVIEW 18 in the second experiment has the same behavior as the previous parameters for the majority of flows, where the performance becomes better than it is in the first experiment, although it may be slightly less than the performance of the controller sometimes. As a result, the proposed approach is more efficient than the Ryu controller and proves its ability to find the best route according to the flow type.

Conclusions and Future Works
This article presents an SDN-based routing framework based on the concepts of flow characterization and flow identification. We found that the network traffic, which is described by their performance metrics, can be routed based on their type according to these metrics. As a result, each flow is routed in terms of its type and the ID of its cluster. Therefore, routing a clustered traffic as elephants and mice can help improve the network management system and contribute to solving the problem of unfair use of network resources by particular flows. The unified proposed architectural solution provides an efficient calculation of route cost and consistency with real-time constraints in the SDN environment. The results show that 70% of the flows can be routed precisely. Therefore, the dynamic provisions of network resources among different flow types are achieved. For future works, the proposed application sets the ground for designing an automated SDN appli- As a result, the proposed approach is more efficient than the Ryu controller and proves its ability to find the best route according to the flow type.

Conclusions and Future Works
This article presents an SDN-based routing framework based on the concepts of flow characterization and flow identification. We found that the network traffic, which is described by their performance metrics, can be routed based on their type according to these metrics. As a result, each flow is routed in terms of its type and the ID of its cluster. Therefore, routing a clustered traffic as elephants and mice can help improve the network management system and contribute to solving the problem of unfair use of network resources by particular flows. The unified proposed architectural solution provides an efficient calculation of route cost and consistency with real-time constraints in the SDN environment. The results show that 70% of the flows can be routed precisely. Therefore, the dynamic provisions of network resources among different flow types are achieved. For future works, the proposed application sets the ground for designing an automated SDN application, which can be employed for all kinds of flows and network topologies to improve bandwidth utilization and reduce congestion across networks.