Controller load balancing method based on hierarchical load awareness and adaptive inheritance

Through layered load awareness and adaptive genetic algorithms, dynamically adjust the mapping relationship between the switch and the controller, solving the problem of load imbalance caused by dynamic changes in the traditional methods, and achieving more efficient load balancing and stable network performance.

CN119316362AActive Publication Date: 2025-01-14QINGCHUANG WANGYU (HEFEI) TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411844566.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-01-14
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

Traditional controller load balancing methods are difficult to cope with dynamic changes in the network environment, resulting in the problem of unbalanced controller load.

Method used

Using a method based on hierarchical load perception and adaptive genetic algorithm, the SDN network model is constructed, the network topology and controller load changes are monitored in real time, and the mapping relationship between the switch and controller is dynamically adjusted to achieve load balancing.

Benefits of technology

It improves the accuracy and real-timeness of controller load balancing, improves the utilization rate of network resources, can adapt to changes in different scales and topological structures, and ensures that the network is continuously in an efficient state.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316362A_ABST
    Figure CN119316362A_ABST
Patent Text Reader

Abstract

The invention relates to the field of computer network optimization and controller load balancing, and discloses a controller load balancing method based on hierarchical load awareness and adaptive heredity, which comprises the following steps: S1, constructing an SDN network model, establishing a mapping matrix of a switch and a controller, establishing a switch flow model, and establishing a flow model of the controller; s2, establishing a load model of the controller, setting a dynamic load formula and a static load formula of the controller, and calculating the total load of the controller; s3, establishing a layered load sensing model, and determining whether to trigger load balancing or not according to a preset threshold value; s4, optimizing a mapping relation between the switch and the controller by using an adaptive genetic algorithm to realize dynamic load balancing; and S5, setting an algorithm ending condition, outputting an optimal mapping scheme, and carrying out load balancing according to the scheme.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of computer network optimization and controller load balancing, and in particular to a controller load balancing method based on hierarchical load perception and adaptive genetics. Background Art

[0002] As the scale of the network grows, a single controller cannot meet the needs of large-scale networks. The multi-controller architecture divides the network into multiple areas, each managed by a different controller. The controller load is mainly determined by the switches and traffic it manages. In actual applications, due to the uncertainty of traffic and the dynamic changes in network topology, some controllers may be overloaded while others are idle. A reasonable method is needed to efficiently distribute the controller load.

[0003] Traditional load balancing methods typically rely on static controller allocation strategies, making them difficult to adapt to network load environments and lacking the ability to perceive and adapt to dynamic network changes. Hierarchical load sensing divides the network into switch layer, controller layer, and trigger layer, and monitors changes in network topology and controller load in real time, enabling the system to achieve dynamic load adjustment between controllers. Genetic algorithms are search optimization algorithms that continuously search for the optimal migration solution by selecting, crossover, and mutating multiple possible controller load distribution schemes. In adaptive genetic algorithms, the crossover rate and mutation rate are automatically adjusted according to the actual situation of the current network, allowing the algorithm to maintain high efficiency and stability in the face of dynamic network changes. Summary of the Invention

[0004] The purpose of the present invention is to provide a controller load balancing method based on hierarchical load perception and adaptive genetic algorithm, which improves the controller load balancing performance and network resource utilization on the basis of software-defined network by relying on hierarchical network perception and adaptive genetic algorithm.

[0005] The purpose of the present invention can be achieved through the following technical solutions:

[0006] The controller load balancing method based on hierarchical load sensing and adaptive genetics includes the following steps:

[0007] S1. Build an SDN network model, establish a mapping matrix between switches and controllers, establish a switch traffic model, and establish a controller traffic model;

[0008] S2. Establish a load model for the controller, set the dynamic load formula and static load formula for the controller, and calculate the total load of the controller;

[0009] S3. Establish a hierarchical load-aware model and decide whether to trigger load balancing based on a preset threshold.

[0010] S4. Use adaptive genetic algorithm to optimize the mapping relationship between switches and controllers to achieve dynamic load balancing;

[0011] S5. Set the conditions for the algorithm to end, output the mapping plan, and perform load balancing according to the plan.

[0012] As a further technical solution, in step S1, the following steps are specifically included:

[0013] S1-1. Model the network as a weighted graph G(V,E), where V represents the set of all switches and controllers, E represents the set of links between switches and controllers, and the switch set is , m represents the number of switches, and the controller set is ,n represents the number of controllers;

[0014] S1-2, set the mapping matrix between switches and controllers, each switch Only one controller To manage, each controller manages multiple switches, and a mapping matrix M is established to represent the mapping relationship between switches and controllers;

[0015] Calculation formula for element values ​​of mapping matrix M as follows:

[0016] ;

[0017] In formula (1): Represents the elements of the mapping matrix;

[0018] S1-3, computing switch Total traffic handled , computing controller Total traffic handled ;

[0019] switch Total traffic handled Calculation formula As shown below:

[0020] ;

[0021] In formula (2): Indicates a switch Number of streams processed; Indicates the size of the k-th stream;

[0022] Controller Total traffic handled The calculation formula As shown below:

[0023] ;

[0024] In formula (3): Representation Controller Managed switches The mapping relationship between them; Indicates a switch Total traffic processed.

[0025] As a further technical solution, in step S2, the following steps are specifically included:

[0026] S2-1, combined with the controller CPU usage in idle state and memory usage in idle state, set the controller Static load;

[0027] Controller Static load calculation formula As shown below:

[0028] ;

[0029] In formula (4): Representation Controller The static load, Representation Controller CPU usage in idle state; Representation Controller Memory usage in idle state; and Represents the weight coefficients of CPU and memory respectively and ;

[0030] S2-2, switch At a fixed time, the flow Report to the controller to which it is connected , combined with the controller Traffic generated by managed switches is set by the controller Dynamic load;

[0031] Controller Dynamic load calculation formula As shown below:

[0032] ;

[0033] In formula (5): Representation Controller Dynamic load; Indicates the proportional coefficient for converting flow into load; Representation Controller The total amount of traffic processed;

[0034] S2-3, Controller The total load is set as the sum of static load and dynamic load; the calculation formula As shown below: ;

[0035] In formula (6): Representation Controller The total load; Representation Controller Static load; Representation Controller dynamic load.

[0036] As a further technical solution, in step S3: specifically including the following steps:

[0037] S3-1. The load sensing tasks in the network are divided into three layers: the switch layer, the controller layer, and the trigger layer. The switch layer is responsible for collecting its own traffic information and reporting it to the connected controller. The controller layer processes its own static and dynamic loads and calculates the total load.

[0038] S3-2, the trigger layer collects the total load of all controllers , calculate the average load , calculate the load imbalance based on the average load , imbalance Reflects the average value of all controller load deviations, imbalance The smaller the load, the more balanced the load between controllers. The larger the value, the more unbalanced the load is and the more adjustments are needed.

[0039] Load Average The calculation formula As shown below:

[0040] ;

[0041] In formula (7): n is the number of controllers;

[0042] Imbalance The calculation formula As shown below:

[0043] ;

[0044] In formula (8): Representation Controller The absolute value of the deviation between the load and the average load;

[0045] S3-3, using the dynamic threshold method to determine whether load balancing is needed, and dynamically adjust the threshold based on real-time network status and historical data , when the calculated imbalance When the load balancing mechanism is triggered, the adaptive genetic algorithm is used to optimize the mapping relationship between the switch and the controller to achieve load balancing. When the load balancing status is good, no load balancing is required;

[0046] Dynamic Threshold The calculation formula As shown below:

[0047] ;

[0048] In formula (9): Indicates imbalance the historical average of represents the standard deviation; k represents the adjustment coefficient;

[0049] Imbalance The historical average The calculation formula As shown below:

[0050] ;

[0051] In formula (10): N represents the number of sampling times; Indicates the load imbalance at the i-th sampling time;

[0052] Imbalance Standard deviation The calculation formula As shown below:

[0053] ;

[0054] In formula (11): N represents the number of sampling times; Indicates the load imbalance at the i-th sampling time.

[0055] As a further technical solution, in step S4, the following steps are specifically included:

[0056] S4-1. Set the size of the initial population P to a multiple of the number of switches m, set the number of genes contained in each chromosome to the number of switches m in the network, and for each gene in the chromosome (i 1, 2, 3, ..., m}), randomly assign a controller (j 1, 2, 3, ..., n}) number j;

[0057] Formula for calculating population size P As shown below:

[0058] ;

[0059] In formula (12), k is the proportional coefficient; m represents the number of switches in the network;

[0060] S4-2. Calculate the load imbalance of each chromosome X based on the average load , calculation requires the migration cost function of the current actual mapping scheme and the chromosome X mapping scheme , combined with load imbalance and the migration cost function Calculating the fitness function ;

[0061] Calculation formula of load imbalance function as follows:

[0062] ;

[0063] In formula (13), Represents each controller in the chromosome X scheme Total load; represents the average load of the controller in chromosome X;

[0064] Migration cost function of the current actual mapping scheme and the chromosome X mapping scheme Calculation formula As shown below:

[0065] ;

[0066] In formula (14), In the chromosome X scheme, the switch The number of the connected controller; Indicates that in the current actual mapping, the switch The number of the connected controller; If Not equal to 1 when , 0 when they are equal; Indicates a switch Traffic volume;

[0067] Calculation formula of fitness function as follows:

[0068] ;

[0069] In formula (15), Represents the fitness value of chromosome X; 、 Represents the weight coefficient, which controls the influence of load balancing effect and migration cost in the fitness function; represents the load imbalance of the chromosome X scheme; represents the migration cost of scheme X; Represents a normal number to prevent the denominator from being 0;

[0070] S4-3. According to the individual's fitness value, set the probability of the individual being selected , according to the probability of an individual being selected , construct the cumulative probability , select excellent individuals from the current population as parents, participate in crossover and mutation operations, generate a random number in the interval [0,1] for the parent individuals to be selected, and search for the one that satisfies the cumulative probability distribution Individual i takes the selected chromosome i as the parent chromosome and repeats the selection process until all parent chromosomes are selected;

[0071] The probability of an individual being selected Calculation formula as follows:

[0072] ;

[0073] In formula (16), represents the fitness value of individual i; P represents the population size;

[0074] Cumulative probability The calculation formula as follows:

[0075] ;

[0076] In formula (17), represents the cumulative probability of individual i;

[0077] S4-4. At different stages of evolution, dynamically adjust the crossover rate. When the average load of the population is unbalanced, Large, and the load imbalance of the optimal individual When it is small, it means that there are excellent individuals in the population, and the crossover rate needs to be reduced to protect excellent genes. and When close, it indicates that the diversity of the population is insufficient and the crossover rate needs to be increased. , enhance diversity, dynamically adjust the mutation rate, and the optimal fitness value of the current population Close to the average fitness value of the current population When , it means that the population diversity is reduced and the individual differences are small. At this time, the mutation rate is increased. , introducing new genes, when Larger, Small, appropriately reduce the mutation rate , protect excellent genes;

[0078] Crossover rate calculation formula as follows:

[0079] ;

[0080] In formula (18), represents the basic crossover rate, which is set to a constant; It represents the cross rate adjustment coefficient, which determines the maximum change range of the cross rate; Indicates the average load imbalance of the current population; Indicates the minimum load imbalance of the current population;

[0081] Mutation rate calculation formula as follows:

[0082] ;

[0083] In formula (19), Represents the basic mutation rate, which is initially set to a constant; Represents the mutation rate adjustment coefficient, which determines the maximum change range of the mutation rate; Indicates the maximum fitness value of the current population; Indicates the average fitness value of the current population;

[0084] S4-5, Reference Crossover Rate , perform multi-point crossover on the parent chromosomes, randomly pair the selected parent chromosomes, and generate a random number h between [0,1] for each pair of parent chromosomes. If , then perform a crossover operation on this pair of parent chromosomes, determine the number of crossover points N, randomly select N different positions on the parent chromosome as crossover points, divide the parent chromosome into multiple segments according to the crossover points, exchange the corresponding gene segments, and generate two offspring individuals. If , no crossover is performed;

[0085] S4-6, reference mutation rate , mutate the chromosome, for each gene on each chromosome X , generate a random number r in the interval [0,1], if , then mutate, randomly select a new controller number, and change the gene If the value of , no mutation occurs and the gene remains unchanged.

[0086] As a further technical solution, in step S5, the following steps are specifically included:

[0087] S5-1. Set the parameters required for the algorithm to end, including the maximum number of iterations , continuous unimproved algebra , Improved Threshold , fitness target value ;

[0088] S5-2, add the newly generated offspring to the population to form the next generation, retain the current optimal individual directly to the next generation, continuously calculate the fitness values ​​of individuals in the population, select the parent individual, perform crossover and mutation operations, and continuously iterate and update the population until the algorithm converges;

[0089] S5-3, determine the convergence condition of the algorithm, if the number of iterations , then the algorithm ends if , then calculate the improvement F, if , indicating that the algorithm is in the recent If the fitness of the generation does not improve significantly, the algorithm is stopped. If the optimal fitness value of the current population is , then stop the algorithm and select the individual with the highest fitness value from the current population As the optimal mapping solution, adjust the connection relationship between the switch and the controller according to the optimal solution, and migrate the switches that need to be migrated according to the solution;

[0090] Amount of improvement The calculation formula of F as follows:

[0091] ;

[0092] In formula (20), Represents the optimal fitness value in the tth generation; Indicates in The optimal fitness value in the interval from generation 1 to generation t.

[0093] Beneficial effects of the present invention:

[0094] (1) The controller load is divided into static load and dynamic load, and the load status of different controllers is dynamically displayed to achieve real-time perception of network status load. The switch reports traffic information regularly, and the controller grasps the changes in network traffic in time, making the system load balancing adjustment more accurate.

[0095] (2) Through the hierarchical architecture of the switch layer, controller layer, and trigger layer, the switch layer reports traffic information, the controller layer calculates its own load, and when the trigger layer detects that the load imbalance exceeds the threshold, it triggers the load balancing mechanism to maintain the stability of network performance. This method uses real-time network perception to respond to load changes in real time and adjust the mapping relationship between the switch and the load in a timely manner, thereby improving the accuracy and real-time performance of load balancing.

[0096] (3) The adaptive genetic algorithm improves the optimization ability of the load balancing algorithm. The genetic algorithm has a strong global search capability and can effectively find the global optimal solution. The crossover rate and mutation rate are dynamically adjusted according to the fitness of the population, which improves the accuracy of the algorithm. The fitness function is designed by comprehensively considering load imbalance and migration cost, and the migration frequency and cost of the controller and switch are minimized as much as possible. Through iterative evolution and dynamic evaluation of fitness, the algorithm continuously optimizes the mapping relationship between the controller and the switch to ensure that the load balancing effect is optimal.

[0097] (4) Adapting to networks of different sizes, this method can flexibly adjust the load distribution of the controller according to different scenarios. When the network topology changes, it can quickly adapt to the new situation and re-balance the load to ensure that the network remains in an efficient state. BRIEF DESCRIPTION OF THE DRAWINGS

[0098] The present invention will be further described below with reference to the accompanying drawings.

[0099] Figure 1 Flowchart for the implementation of the present invention;

[0100] Figure 2 It is a system structure diagram of the present invention;

[0101] Figure 3 This is the implementation flow chart of the adaptive genetic algorithm;

[0102] Figure 4 This is the convergence judgment flow chart of the adaptive genetic algorithm. DETAILED DESCRIPTION

[0103] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.

[0104] See also Figures 1-4As shown, the present invention is a controller load balancing method based on hierarchical load sensing and adaptive genetics, which is performed as follows:

[0105] S1. Build an SDN network model, establish a mapping matrix between switches and controllers, establish a switch traffic model, and establish a controller traffic model;

[0106] S1-1. Model the network as a weighted graph G(V,E), where V represents the set of all switches and controllers, E represents the set of links between switches and controllers, and the switch set is , m represents the number of switches, and the controller set is ,n represents the number of controllers;

[0107] S1-2, set the mapping matrix between switches and controllers, each switch Only one controller To manage, each controller manages multiple switches, and a mapping matrix M is established to represent the mapping relationship between switches and controllers;

[0108] Calculation formula for element values ​​of mapping matrix M as follows:

[0109] ;

[0110] In formula (1): Represents the elements of the mapping matrix;

[0111] S1-3, computing switch Total traffic handled , computing controller Total traffic handled ;

[0112] switch Total traffic handled Calculation formula As shown below:

[0113] ;

[0114] In formula (2): Indicates a switch Number of streams processed; Indicates the size of the k-th stream;

[0115] Controller Total traffic handled The calculation formula As shown below:

[0116] ;

[0117] In formula (3): Representation Controller Managed switches The mapping relationship between them; Indicates a switch Total traffic processed.

[0118] In this embodiment, the number of switches is m, the number of controllers is n, and if the number of switches is m, By the controller To manage, the elements in the matrix M Set to 1, otherwise set to 0, for each switch , ensuring that there is only one controller To manage the switch The flow calculation is to calculate the total flow by summing the sizes of all flows. The flow rate is calculated by summing all the The traffic of the switch is calculated by the controller The total flow rate.

[0119] S2. Establish a load model for the controller, set the dynamic load formula and static load formula for the controller, and calculate the total load of the controller;

[0120] S2-1, combined with the controller CPU usage in idle state and memory usage in idle state, set the controller Static load;

[0121] Controller Static load calculation formula As shown below:

[0122] ;

[0123] In formula (4): Representation Controller The static load, Representation Controller CPU usage in idle state; Representation Controller Memory usage in idle state; and Represents the weight coefficients of CPU and memory respectively and ;

[0124] S2-2, switch At a fixed time, the flow Report to the controller to which it is connected , combined with the controller Traffic generated by managed switches is set by the controller Dynamic load;

[0125] Controller Dynamic load calculation formula As shown below:

[0126] ;

[0127] In formula (5): Representation Controller Dynamic load; Indicates the proportional coefficient for converting flow into load; Representation Controller The total amount of traffic processed;

[0128] S2-3, Controller The total load is set as the sum of static load and dynamic load, and the calculation formula is As shown below; ;

[0129] In formula (6): Representation Controller The total load; Representation Controller Static load; Representation Controller dynamic load.

[0130] In this embodiment, the static load of the controller adopts the CPU and memory usage in the idle state. In the idle state, the system will have basic resources occupied. Every 5 seconds, the flow Report to the controller.

[0131] S3. Establish a hierarchical load-aware model and decide whether to trigger load balancing based on a preset threshold.

[0132] S3-1. The load sensing tasks in the network are divided into three layers: the switch layer, the controller layer, and the trigger layer. The switch layer is responsible for collecting its own traffic information and reporting it to the connected controller. The controller layer processes its own static and dynamic loads and calculates the total load.

[0133] S3-2, the trigger layer collects the total load of all controllers , calculate the average load , calculate the load imbalance based on the average load , imbalance Reflects the average value of all controller load deviations, imbalance The smaller the load, the more balanced the load between controllers. The larger the value, the more unbalanced the load is and the more adjustments are needed.

[0134] Load Average The calculation formula As shown below:

[0135] ;

[0136] In formula (7): n is the number of controllers;

[0137] Imbalance The calculation formula As shown below:

[0138] ;

[0139] In formula (8): Representation Controller The absolute value of the deviation between the load and the average load;

[0140] S3-3, using the dynamic threshold method to determine whether load balancing is needed, and dynamically adjust the threshold based on real-time network status and historical data , when the calculated imbalance When the load balancing mechanism is triggered, the adaptive genetic algorithm is used to optimize the mapping relationship between the switch and the controller to achieve load balancing. When the load balancing status is good, no load balancing is required;

[0141] Dynamic Threshold The calculation formula As shown below:

[0142] ;

[0143] In formula (9): Indicates imbalance the historical average of represents the standard deviation; k represents the adjustment coefficient;

[0144] Imbalance The historical average The calculation formula As shown below:

[0145] ;

[0146] In formula (10): N represents the number of sampling times; Indicates the load imbalance at the i-th sampling time;

[0147] Imbalance Standard deviation The calculation formula As shown below:

[0148] ;

[0149] In formula (11): N represents the number of sampling times; Indicates the load imbalance at the i-th sampling time.

[0150] In this embodiment, since the switch reports traffic at fixed time intervals, a new average load is calculated after each report. and new imbalances As the system runs, the system accumulates multiple imbalances, and the imbalance can be calculated The historical average and imbalance Standard deviation , and then the threshold Dynamic changes with network status.

[0151] S4. Use adaptive genetic algorithm to optimize the mapping relationship between switches and controllers to achieve dynamic load balancing;

[0152] S4-1. Set the size of the initial population P to a multiple of the number of switches m, set the number of genes contained in each chromosome to the number of switches m in the network, and for each gene in the chromosome , randomly assign a controller Number j;

[0153] Formula for calculating population size P As shown below:

[0154] ;

[0155] In formula (12), k is the proportional coefficient; m represents the number of switches in the network;

[0156] S4-2. Calculate the load imbalance of each chromosome X based on the average load , calculation requires the migration cost function of the current actual mapping scheme and the chromosome X mapping scheme , combined with load imbalance and the migration cost function Calculating the fitness function ;

[0157] Calculation formula of load imbalance function as follows:

[0158] ;

[0159] In formula (13), Represents each controller in the chromosome X scheme Total load; represents the average load of the controller in chromosome X;

[0160] Migration cost function of the current actual mapping scheme and the chromosome X mapping scheme Calculation formula As shown below:

[0161] ;

[0162] In formula (14), In the chromosome X scheme, the switch The number of the connected controller; Indicates that in the current actual mapping, the switch The number of the connected controller; If Not equal to 1 when , 0 when they are equal; Indicates a switch Traffic volume;

[0163] Calculation formula of fitness function as follows:

[0164] ;

[0165] In formula (15), Represents the fitness value of chromosome X; 、 Represents the weight coefficient, which controls the influence of load balancing effect and migration cost in the fitness function; represents the load imbalance of the chromosome X scheme; represents the migration cost of scheme X, indicating the cost required to migrate from the current mapping to scheme X; Represents a normal number to prevent the denominator from being 0;

[0166] S4-3. According to the individual's fitness value, set the probability of the individual being selected , according to the probability of an individual being selected , construct the cumulative probability , select excellent individuals from the current population as parents, participate in crossover and mutation operations, generate a random number in the interval [0,1] for the parent individuals to be selected, and search for the one that satisfies the cumulative probability distribution Individual i takes the selected chromosome i as the parent chromosome and repeats the selection process until all parent chromosomes are selected;

[0167] The probability of an individual being selected Calculation formula as follows:

[0168] ;

[0169] In formula (16), represents the fitness value of individual i; P represents the population size;

[0170] Cumulative probability The calculation formula as follows:

[0171] ;

[0172] In formula (17), represents the cumulative probability of individual i;

[0173] S4-4. At different stages of evolution, dynamically adjust the crossover rate. When the average load of the population is unbalanced, Large, and the load imbalance of the optimal individual When it is small, it means that there are excellent individuals in the population, and the crossover rate needs to be reduced to protect excellent genes. and When close, it indicates that the diversity of the population is insufficient and the crossover rate needs to be increased. , enhance diversity, dynamically adjust the mutation rate, and the optimal fitness value of the current population Close to the average fitness value of the current population When , it means that the population diversity is reduced and the individual differences are small. At this time, the mutation rate is increased. , introducing new genes, when Larger, Small, appropriately reduce the mutation rate , protect excellent genes;

[0174] Crossover rate calculation formula as follows:

[0175] ;

[0176] In formula (18), represents the basic crossover rate, which is set to a constant; It represents the cross rate adjustment coefficient, which determines the maximum change range of the cross rate; Indicates the average load imbalance of the current population; Indicates the minimum load imbalance of the current population;

[0177] Mutation rate calculation formula as follows:

[0178] ;

[0179] In formula (19), Represents the basic mutation rate, which is initially set to a constant; Represents the mutation rate adjustment coefficient, which determines the maximum change range of the mutation rate; Indicates the maximum fitness value of the current population; Indicates the average fitness value of the current population;

[0180] S4-5, Reference Crossover Rate , perform multi-point crossover on the parent chromosomes, randomly pair the selected parent chromosomes, and generate a random number h between [0,1] for each pair of parent chromosomes. If , then perform a crossover operation on this pair of parent chromosomes, determine the number of crossover points N, randomly select N different positions on the parent chromosome as crossover points, divide the parent chromosome into multiple segments according to the crossover points, exchange the corresponding gene segments, and generate two offspring individuals. If , no crossover is performed;

[0181] S4-6, reference mutation rate , mutate the chromosome, for each gene on each chromosome X , generate a random number r in the interval [0,1], if , then mutate, randomly select a new controller number, and change the gene If the value of , no mutation occurs and the gene remains unchanged.

[0182] In this embodiment, Figure 3 As shown in the figure, an adaptive genetic algorithm is used to optimize the mapping relationship between switches and controllers. The generated initial population includes the current actual mapping scheme and chromosomes generated by random assignment, ensuring the diversity of the population. The fitness function is responsible for optimizing the load effect and minimizing the cost of switch migration. According to the fitness value, excellent parent chromosomes are selected for crossover and mutation, increasing the diversity of the population and finding the optimal migration plan.

[0183] S5. Set the conditions for the algorithm to end, output the mapping plan, and perform load balancing according to the plan;

[0184] S5-1. Set the parameters required for the algorithm to end, including the maximum number of iterations , continuous unimproved algebra , Improved Threshold , fitness target value ;

[0185] S5-2, add the newly generated offspring to the population to form the next generation, retain the current optimal individual directly to the next generation, continuously calculate the fitness values ​​of individuals in the population, select the parent individual, perform crossover and mutation operations, and continuously iterate and update the population until the algorithm converges;

[0186] S5-3, determine the convergence condition of the algorithm, if the number of iterations t , then the algorithm ends, if t , then calculate the improvement F, if , indicating that the algorithm is in the recent If the fitness of the generation does not improve significantly, the algorithm is stopped. If the optimal fitness value of the current population is , then stop the algorithm and select the individual with the highest fitness value from the current population As the optimal mapping solution, adjust the connection relationship between the switch and the controller according to the optimal solution, and migrate the switches that need to be migrated according to the solution;

[0187] Amount of improvement The calculation formula of F as follows:

[0188] ;

[0189] In formula (20), Represents the optimal fitness value in the tth generation; Indicates in The optimal fitness value in the interval from generation 1 to generation t.

[0190] In this embodiment, Figure 4 As shown in the figure, the algorithm is judged whether to stop by detecting the maximum number of iterations, stable algebra, and whether the target fitness is reached. It is ensured that the algorithm stops when the optimization target or the maximum number of iterations is reached, thereby improving efficiency and avoiding over-computation.

[0191] The above is a detailed description of an embodiment of the present invention. However, the content described is only a preferred embodiment of the present invention and should not be considered to limit the scope of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the patent coverage of the present invention.

Claims

1. A controller load balancing method based on hierarchical load sensing and adaptive genetics, characterized by: The steps include: S1. Build an SDN network model, establish a mapping matrix between switches and controllers, establish a switch traffic model, and establish a controller traffic model; S2. Establish a load model of the controller, set the dynamic load formula and static load formula of the controller, and calculate the total load of the controller; S3: Establish a hierarchical load perception model and decide whether to trigger load balancing based on a preset threshold; S4, using adaptive genetic algorithm to optimize the mapping relationship between switches and controllers to achieve dynamic load balancing; S5. Set the conditions for the algorithm to end, output the mapping plan, and perform load balancing according to the plan.

2. The controller load balancing method based on hierarchical load sensing and adaptive genetics according to claim 1 is characterized by: In step S1, the following steps are specifically included: S1-1. Model the network as a weighted graph G(V,E), where V represents the set of all switches and controllers, E represents the set of links between switches and controllers, and the switch set is , m represents the number of switches, and the controller set is ,n represents the number of controllers; S1-2, set the mapping matrix between switches and controllers, each switch Only one controller To manage, each controller manages multiple switches, and a mapping matrix M is established to represent the mapping relationship between the switches and the controllers; The calculation formula for the element value of the mapping matrix M is as follows: ; In formula (1): Represents the elements of the mapping matrix; S1-3, computing switch Total traffic handled , calculation controller Total traffic handled ; switch Total traffic handled Calculation formula As shown below: ; In formula (2): Indicates a switch Number of streams processed; Indicates the size of the kth stream; Controller Total traffic handled The calculation formula As shown below: ; In formula (3): Representation Controller Managed switches The mapping relationship between them; Indicates a switch The total amount of traffic processed.

3. The controller load balancing method based on hierarchical load sensing and adaptive genetics according to claim 2 is characterized in that: In step S2, the following steps are specifically included: S2-1, combined with controller CPU usage in idle state and memory usage in idle state, set the controller Static load; Controller The static load calculation formula As shown below: ; In formula (4): Representation Controller The static load, Representation Controller CPU usage in idle state; Representation Controller Memory usage in idle state; and Represent the weight coefficients of CPU and memory respectively and ; S2-2, switch At a fixed time, the flow Report to the controller connected to it , combined with the controller Traffic generated by managed switches is set by the controller Dynamic load; Controller Dynamic load calculation formula As shown below: ; In formula (5): Representation Controller Dynamic load; It represents the proportionality factor for converting flow into load; Representation Controller The total amount of traffic processed; S2-3, Controller The total load is set as the sum of the static load and the dynamic load, and the calculation formula is As shown below; ; In formula (6): Representation Controller The total load; Representation Controller Static load; Representation Controller of dynamic load.

4. The controller load balancing method based on hierarchical load sensing and adaptive genetics according to claim 3 is characterized in that: In step S3, the following steps are specifically included: S3-1, the load sensing tasks in the network are divided into three levels: switch layer, controller layer, and trigger layer. The switch layer is responsible for collecting its own traffic information and reporting it to the connected controller. The controller layer processes its own static load and dynamic load and calculates the total load; S3-2, the trigger layer collects the total load of all controllers , calculate the average load , calculate the load imbalance based on the average load , imbalance Reflects the average value of all controller load deviations, imbalance The smaller the load, the more balanced the load between controllers. The larger it is, the more unbalanced the load is, and adjustments are needed; Load Average The calculation formula As shown below: ; In formula (7): n is the number of controllers; Imbalance The calculation formula As shown below: ; In formula (8): Representation Controller The absolute value of the deviation of the load from the average load; S3-3. Use the dynamic threshold method to determine whether load balancing is needed and dynamically adjust the threshold based on real-time network status and historical data. , when the calculated imbalance When the load balancing mechanism is triggered, an adaptive genetic algorithm is used to optimize the mapping relationship between the switch and the controller to achieve load balancing. When the load balancing status is good, no load balancing is required; Dynamic Threshold The calculation formula As shown below: ; In formula (9): Indicates the degree of imbalance The historical average of represents the standard deviation; k represents the adjustment coefficient; Imbalance The historical average The calculation formula As shown below: ; In formula (10): N represents the number of sampling times; Indicates the load imbalance at the i-th sampling time; Imbalance Standard Deviation The calculation formula As shown below: ; In formula (11): N represents the number of sampling times; Indicates the load imbalance at the i-th sampling time.

5. The controller load balancing method based on hierarchical load sensing and adaptive genetics according to claim 4 is characterized in that: In step S4, the following steps are specifically included: S4-1. Set the size of the initial population P to a multiple of the number of switches m, set the number of genes contained in each chromosome to the number of switches m in the network, and for each gene in the chromosome , randomly assign a controller No. j; The formula for calculating the population size P is As shown below: ; In formula (12), k is the proportionality coefficient; m represents the number of switches in the network; S4-2. Calculate the load imbalance of each chromosome X based on the average load , the calculation requires the migration cost function of the current actual mapping scheme and the chromosome X mapping scheme , combined with load imbalance and the migration cost function Calculate the fitness function ; Calculation formula of load imbalance function as follows: ; In formula (13), Represents each controller in the chromosome X scheme Total load; represents the average load of the controller in chromosome X; Migration cost function of the current actual mapping scheme and the chromosome X mapping scheme The calculation formula As shown below: ; In formula (14), In the chromosome X scheme, the switch The number of the connected controller; Indicates that in the current actual mapping, the switch The number of the connected controller; If Not equal to 1 when , 0 when they are equal; Indicates a switch Traffic volume; Fitness function calculation formula as follows: ; In formula (15), Represents the fitness value of chromosome X; , Represents the weight coefficient, which controls the influence of load balancing effect and migration cost in the fitness function; represents the load imbalance of the chromosome X scheme; It represents the migration cost of scheme X, indicating the cost required to migrate from the current mapping to scheme X; Represents a normal number to prevent the denominator from being 0; S4-3. According to the fitness value of the individual, set the probability of the individual being selected , according to the probability of an individual being selected , construct the cumulative probability , select excellent individuals from the current population as parents, participate in crossover and mutation operations, and generate a Random numbers in the interval, find the ones that satisfy the cumulative probability distribution For individual i, the selected chromosome i is used as the parent chromosome, and the selection process is repeated until all parent chromosomes are selected; The probability of an individual being selected Calculation formula as follows: ; In formula (16), represents the fitness value of individual i; P represents the population size; Cumulative probability The calculation formula as follows: ; In formula (17), represents the cumulative probability of individual i; S4-4, dynamically adjust the crossover rate at different evolutionary stages; Crossover rate calculation formula as follows: ; In formula (18), represents the basic crossover rate, which is set to a constant; It represents the crossover rate adjustment coefficient, which determines the maximum change range of the crossover rate; Indicates the average load imbalance of the current population; Indicates the minimum load imbalance of the current population; Mutation rate calculation formula as follows: ; In formula (19), Represents the basic mutation rate, which is initially set to a constant; Represents the mutation rate adjustment coefficient, which determines the maximum change range of the mutation rate; Indicates the maximum fitness value of the current population; Represents the average fitness value of the current population; S4-5, Reference Crossover Rate , perform multi-point crossover on the parent chromosomes, randomly pair the selected parent chromosomes, and generate a A random number h between , then perform a crossover operation on this pair of parent chromosomes, determine the number of crossover points N, randomly select N different positions on the parent chromosome as crossover points, divide the parent chromosome into multiple fragments according to the crossover points, exchange the corresponding gene fragments, and generate two offspring individuals. If , no crossover is performed; S4-6, Reference mutation rate , mutate the chromosome, for each gene on each chromosome X , generating a A random number r in the interval, if , then mutation is performed, a new controller number is randomly selected, and the gene If the value of , no mutation occurs and the gene remains unchanged.

6. The controller load balancing method based on hierarchical load sensing and adaptive genetics according to claim 5 is characterized in that: In step S5, the following steps are specifically included: S5-1. Set the parameters required for the algorithm to end, including the maximum number of iterations , continuous unimproved algebra , Improved threshold , fitness target value ; S5-2, add the newly generated offspring to the population to form the next generation, retain the current optimal individual directly to the next generation, continuously calculate the fitness values ​​of individuals in the population, select the parent individuals, perform crossover and mutation operations, and continuously iterate and update the population until the algorithm converges; S5-3, determine the convergence condition of the algorithm, if the number of iterations , then the algorithm ends if , then calculate the improvement F, if , indicating that the algorithm is in the recent If the fitness of the current generation does not improve significantly, the algorithm stops. , then stop the algorithm and select the individual with the highest fitness value from the current population As the optimal mapping solution, according to the optimal solution, the connection relationship between the switch and the controller is adjusted, and the switch that needs to be migrated is migrated according to the solution; Improvement The calculation formula of F as follows: ; In formula (20), Represents the optimal fitness value in the tth generation; Indicated in The optimal fitness value in the interval from generation to generation t.

Citation Information

Patent Citations

  • Energy-efficient and load-balanced clustering routing protocol for wireless sensor networks using chaotic genetic algorithm

    CN111970743A

  • Optical cable transmission network load optimization configuration method

    CN118041599A

  • Method for optimizing the load balance in the cluster and framework thereof

    US20220091874A1

  • SDN enhanced path allocation device and method employing bin-packing technique

    WO2020181761A1