A load balancing method
By calculating bandwidth balance indicators and coefficients to screen load balancing methods, and using historical data to optimize load adjustment, the problem of load imbalance in the existing technology is solved, the accuracy and efficiency of load balancing are improved, and data processing efficiency is ensured.
Patent Information
- Application Number
- CN202410906829.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-07-08
AI Technical Summary
Existing load balancing methods cannot accurately adjust server load when traffic changes, resulting in load imbalance and affecting data processing efficiency.
By calculating bandwidth balance indicators and bandwidth balance coefficients, we select suitable load balancing methods, such as improved ant colony algorithm or PECT algorithm, to perform load adjustment, and combine historical data as initial data to optimize load balancing analysis.
It improves the accuracy and efficiency of load balancing, avoids excessive load analysis, ensures the load balancing effect, reduces unnecessary load analysis, and improves data processing efficiency.
Smart Images

Figure CN118449955B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing. More specifically, the present invention relates to a load balancing method. Background Art
[0002] The collaborative processing of multiple servers is prone to load imbalance. When the load of multiple servers is unbalanced, some servers will be idle while some servers will be blocked. This situation will greatly affect the data processing efficiency. In order to improve the data processing efficiency, the load of each server needs to be balanced.
[0003] The existing public paper "Research on SDN Load Balancing Based on Ant Colony Optimization Algorithm" demonstrates a load balancing method. This method divides the total traffic data of all servers into two types: large flow and small flow. When it is a large flow type, the improved ant colony algorithm, referred to as the load balancing process, is used. When it is a small flow type, the equal cost multi-path routing algorithm (Equal Cost Multi-path), referred to as the ECMP algorithm, is used for balancing. The improved ant colony algorithm has a better balancing effect than the ECMP algorithm.
[0004] The selected load balancing method is determined by simply dividing the traffic into large and small flows. This method does not consider the specific load balancing situation. It only believes that when the traffic is large, the possibility of data congestion is high. In the case of large flows, a more accurate improved ant colony algorithm is used for load balancing. At the same time, it is believed that when the traffic is small, the possibility of data congestion is small. In the case of small flows, a relatively simple ECMP algorithm is used for load balancing. However, when the traffic is large, there will be a phenomenon that the load is relatively balanced and the data flow is relatively smooth. When the traffic is small, there will be load imbalance and some servers will have data congestion. Therefore, when the load balancing method is selected by the large and small flows, it is easy to produce excessive load balancing analysis when the traffic is large and the load is balanced; when the traffic is small and the load is unbalanced, the load balancing analysis cannot be performed well, resulting in data congestion. Therefore, the load balancing method is selected directly by the large and small flows, and its balancing effect is poor. Summary of the invention
[0005] In order to solve the problem of poor load balancing effect, the present invention proposes a load balancing method, which includes the following steps:
[0006] Obtain the traffic data of each server at each time and the total traffic data of all servers at each time;
[0007] Calculate the bandwidth balance index, which is negatively correlated with the bandwidth balance coefficient and the variance of the traffic data of all servers at the current moment; the bandwidth balance coefficient satisfies the relationship , Indicates the maximum value of the total traffic data prediction of all servers at a preset number of moments after the current moment. Indicates the total traffic data of all servers at the current moment. represents the maximum traffic value that all servers can carry, exp() represents an exponential function with a natural constant as the base, Indicates the bandwidth balance coefficient at the current moment;
[0008] Filter the load balancing methods based on the bandwidth balancing metric to control load balancing adjustments.
[0009] The effect is that the current traffic data and the difference between the current traffic data and the traffic data in the future are introduced when calculating the bandwidth balance index, which can more accurately describe the load balance situation at the current moment and provide a basis for accurately selecting the load balancing method.
[0010] Preferably, the bandwidth balance index satisfies the relationship:
[0011]
[0012] in, Represents the variance of traffic data of all servers at the current moment, Indicates the bandwidth balance index at the current moment.
[0013] Preferably, the load balancing method is screened according to the bandwidth balancing index to control the load balancing adjustment, including:
[0014] The bandwidth balance index at the current moment is compared with the preset balance index threshold. If the bandwidth balance index at the current moment is less than the preset balance index threshold, the improved ant colony algorithm is used to adjust the load balance at the current moment; if the bandwidth balance index at the current moment is greater than or equal to the preset balance index threshold, the PECT algorithm is used to adjust the load balance at the current moment.
[0015] The effect is that a more suitable load balancing method is selected according to the load balancing situation, which can not only ensure the load balancing requirements, but also reduce unnecessary load balancing analysis and improve load balancing efficiency.
[0016] Preferably, the use of the improved ant colony algorithm to adjust the load balance at the current moment includes:
[0017] The flow data of all servers at each moment constitute a flow data sequence at each moment; in chronological order, the flow data sequence at the current moment is matched with the flow data sequences at previous moments in turn, and a matching cutoff coefficient is calculated, wherein the matching cutoff coefficient is negatively correlated with the bandwidth balance index at the corresponding moment of the most recent matching analysis, and is positively correlated with the maximum matching value in all sub-matches; in response to the matching cutoff coefficient being less than a preset cutoff coefficient and the number of matches being less than a preset number of matches, matching is continued; in response to the matching cutoff coefficient being greater than or equal to the preset cutoff coefficient or the number of matches being greater than or equal to the preset number of matches, the flow data sequence at the corresponding moment of the maximum matching value in all sub-matches is used as initialization data; based on the initialization data, an ant colony algorithm is used to solve a target flow data sequence, and the flow of each server is adjusted according to the flow value in the target flow data sequence.
[0018] The effect is that by drawing on historical load balancing analysis results to set the initial data at the current moment, it helps to solve the optimal balance data at the current moment more quickly and improves load balancing efficiency.
[0019] Preferably, the matching cutoff coefficient satisfies the relationship:
[0020]
[0021] in, It represents the bandwidth balance index at the corresponding time of the sth matching analysis. Indicates the maximum matching value in the sth matching analysis and all previous matching analyses. Represents the matching cutoff coefficient in the sth matching analysis.
[0022] The effect is that by matching cutoff analysis, over-matching can be prevented, which would lead to low efficiency of equilibrium analysis. At the same time, historical data that is more in line with the current moment can be obtained, thus providing a higher reference value for the initial data setting at the current moment.
[0023] Preferably, adjusting the traffic of each server according to the traffic value in the target traffic data sequence includes:
[0024] The flow data of the target flow data sequence is used as a standard to adjust the flow of the corresponding server.
[0025] Preferably, the matching value is the cosine similarity between the flow data sequence at the current moment and the flow data sequence at each previous moment.
[0026] The effect is that the matching effect is described by cosine similarity, which makes the operation simpler and the calculation more efficient.
[0027] Preferably, the method for obtaining the predicted value of the total flow data includes:
[0028] Based on the total traffic data of all servers at the current moment and all previous moments, a prediction algorithm is used to perform a prediction analysis to obtain the predicted total traffic value of all servers at a preset number of moments in the future.
[0029] The present invention has the following beneficial effects: accurately grasping the load balancing situation through load balancing analysis, and then selecting a more appropriate load balancing method according to the load balancing situation, so as to ensure the load balancing effect while preventing excessive load balancing analysis, thereby ensuring the load balancing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0031] Figure 1 The present invention is a flow chart of the steps of a load balancing method. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0033] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0034] See also Figure 1 , which shows a flow chart of a load balancing method provided by an embodiment of the present invention, the method comprising the following steps:
[0035] S1. Obtain the traffic data of each server at each time and the total traffic data of all servers at each time.
[0036] It should be noted that the traffic data of each server can reflect the load situation on each server, so load balancing can be achieved by adjusting the traffic of each server.
[0037] Specifically, the flow data of each server at each time and the total flow data of all servers at each time are collected.
[0038] S2. Calculate a bandwidth balance index, where the bandwidth balance index is negatively correlated with the bandwidth balance coefficient and the variance of the traffic data of all servers at the current moment.
[0039] It should be noted that in order to more accurately select a load balancing method, it is necessary to analyze the load balancing situation at each moment. In this embodiment, the broadband balance index is used to reflect the load balancing situation.
[0040] It should be further explained that when load balancing is performed, the traffic differences between servers are relatively small, and there is no traffic mutation phenomenon on the servers. Therefore, the load balancing situation can be analyzed based on this.
[0041] Preferably, as an example, the bandwidth balance indicator satisfies the relationship:
[0042] ;
[0043] in, Indicates the variance of the traffic data of all servers at the current moment. The larger the value, the greater the difference in traffic data between servers at the current moment, and thus the worse the load balancing of the servers. It indicates the bandwidth balance index at the current moment. The larger the value is, the worse the load balance of the server is at the current moment. C indicates the bandwidth balance coefficient at the current moment.
[0044] Preferably, as an example, the bandwidth balance coefficient satisfies the relationship:
[0045] ;
[0046] in, Indicates the maximum value of the total traffic data prediction of all servers at a preset number of moments after the current moment. Indicates the total traffic data of all servers at the current moment. The larger the value, the greater the possibility of data congestion on the server, and the greater the need for load balancing analysis. Therefore, the load balancing value needs to be reduced to ensure that subsequent load balancing analysis can be performed on it. Indicates the maximum traffic value that all servers can carry. This value is determined by the performance of the server and can be obtained through experimental testing. Used for Normalize it, It reflects the difference between the total traffic data of all servers at the future time and the total traffic data at the current time. The larger the value, the greater the traffic change. When the load is balanced, the traffic generally does not have a large mutation. When a mutation occurs, it means that the server is unbalanced. exp() represents an exponential function with a natural constant as the base. Indicates the bandwidth balance coefficient at the current moment.
[0047] Optionally, as an example, a method for obtaining predicted values of total traffic data of all servers at a preset number of moments after the current moment includes:
[0048] Based on the total traffic data of all servers at the current moment and all previous moments, a prediction algorithm is used to perform prediction analysis to obtain the total traffic prediction value of all servers at a preset number of moments in the future. The prediction algorithm used in this embodiment is the wavelet transform-arima model. Other embodiments may use other prediction algorithms, which are not specifically limited in this embodiment. This embodiment is described by taking the preset number of 3 as an example. Other embodiments may take other values, which are not specifically limited in this embodiment.
[0049] S3. Filter the load balancing method according to the bandwidth balancing index to control the load balancing adjustment.
[0050] It should be noted that in order to achieve more accurate load balancing adjustment, when the load balancing is poor, it means that more attention should be paid to the load balancing quality, and a load balancing method with better balancing effect should be selected. When the load balancing is good, it means that there is no need to pay too much attention to the load balancing quality, but more attention should be paid to the load balancing efficiency, so a balancing method with better balancing efficiency should be selected.
[0051] Optionally, as an example, a load balancing method is selected according to a bandwidth balancing index to control load balancing adjustment, including: comparing the bandwidth balancing index at the current moment with a preset balancing index threshold, and if the bandwidth balancing index at the current moment is less than the preset balancing index threshold, using an improved ant colony algorithm to adjust the load balancing at the current moment; if the bandwidth balancing index at the current moment is greater than or equal to the preset balancing index threshold, using a PECT algorithm to adjust the load balancing at the current moment. This embodiment is described by taking the preset balancing index threshold of 0.1 as an example, and other embodiments may take other values, which are not specifically limited in this embodiment.
[0052] It should be noted that using the PECT algorithm to perform load balancing adjustment at the current moment is an existing technology and will not be described in detail here.
[0053] It should be further explained that when using the ant colony algorithm to solve the optimal solution, the quality of the initial data setting will affect its calculation efficiency; in order to improve the efficiency of load balancing, it is necessary to set an initial data that is closer to the optimal solution for the ant colony algorithm, so as to ensure that it can solve the optimal value faster. The optimal value will be solved at each moment. If the current moment's balanced analysis scenario is similar to the balanced analysis scenario, the optimal value calculated in the past can be used to help set the initial data at the current moment.
[0054] Optionally, as an example, using an improved ant colony algorithm to adjust the load balance at the current moment includes:
[0055] The traffic data of all servers at each moment constitute a traffic data sequence at each moment, and the traffic data sequence of any moment before the current moment is randomly selected as the initialization data. Based on the initialization data, the ant colony algorithm is used to solve the target traffic data sequence, and the traffic of the corresponding server is adjusted based on the traffic data in the target traffic data sequence.
[0056] Preferably, as an example, using an improved ant colony algorithm to adjust the load balance at the current moment includes:
[0057] The flow data sequence at the current moment is matched with the flow data sequences at previous moments in sequence, and the matching cutoff coefficient is calculated. The matching cutoff coefficient is negatively correlated with the bandwidth balance index at the corresponding moment of the most recent matching analysis, and is positively correlated with the maximum matching value in all sub-matches. In response to the matching cutoff coefficient being less than the preset cutoff coefficient and the number of matches being less than the preset number of matches, the matching is continued. In response to the matching cutoff coefficient being greater than or equal to the preset cutoff coefficient or the number of matches being greater than or equal to the preset number of matches, the flow data sequence at the corresponding moment of the maximum matching value in all sub-matches is used as initialization data; based on the initialization data, the target flow data sequence is solved using the ant colony algorithm; and the flow of the corresponding server is adjusted based on the flow data in the target flow data sequence. This embodiment is described by taking the preset cutoff coefficient as 0.42 and the preset number of matches as 50 as an example. Other embodiments may take other values, and this embodiment does not impose specific restrictions.
[0058] In particular, if the number of moments before the current moment is less than the preset number of matches, the matching cutoff coefficient is greater than or equal to the preset cutoff coefficient or the number of matches is greater than or equal to the moment data before the current moment as the matching stop condition; when there is no other moment before the current moment, the traffic data sequence at the current moment is used as the initial data.
[0059] It should be noted that when the target traffic data sequence is solved by using the ant colony algorithm based on the initialization data, the solution method in the public paper "Research on SDN Load Balancing Based on Ant Colony Optimization Algorithm" can be used for reference. This technology is a prior art and will not be repeated here.
[0060] Preferably, as an example, the matching cutoff coefficient satisfies the relationship:
[0061]
[0062] in, It represents the bandwidth balance index at the corresponding time of the s-th matching analysis. Since time passes as the matching analysis proceeds, the corresponding time of the s-th matching analysis is the time after the corresponding time when the broadband balance index is calculated in step S2. For example, the corresponding time when the broadband balance index is calculated in step S2 is 11 o'clock, and the corresponding time of the s-th matching analysis is 11:15. The larger the value, the worse the load imbalance becomes over time, so the matching analysis needs to be completed as soon as possible to adjust the load balance. It indicates the maximum value of the matching value in the sth matching analysis and all previous matching analyses. The larger the value, the larger the matching value. This indicates that the load imbalance at the current moment is similar to the historical imbalance. The optimal flow data calculated in the history can be used to initialize the current moment, thereby helping to iterate the optimal flow data faster at the current moment and improve the analysis efficiency. Represents the matching cutoff coefficient in the sth matching analysis.
[0063] Among them, the above embodiments involve matching values, and the method for determining the matching values needs to be explained below. The matching value is the cosine similarity between the flow data sequence at the current moment and the flow data sequence at each previous moment.
[0064] At this point, this embodiment is completed.
[0065] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A load balancing method, characterized in that: include: Obtain the traffic data of each server at each time and the total traffic data of all servers at each time; Calculate the bandwidth balance index, which is negatively correlated with the bandwidth balance coefficient and the variance of the traffic data of all servers at the current moment; the bandwidth balance coefficient satisfies the relationship , Indicates the maximum value of the total traffic data prediction of all servers at a preset number of moments after the current moment. Indicates the total traffic data of all servers at the current moment. represents the maximum traffic value that all servers can carry, exp() represents an exponential function with a natural constant as the base, Indicates the bandwidth balance coefficient at the current moment; Filter the load balancing methods based on the bandwidth balancing metric to control load balancing adjustments.
2. A load balancing method according to claim 1, characterized in that: The bandwidth balance index satisfies the relationship: in, Represents the variance of traffic data of all servers at the current moment, Indicates the bandwidth balance index at the current moment.
3. A load balancing method according to claim 1, characterized in that: The method of screening the load balancing method according to the bandwidth balancing index to control the load balancing adjustment includes: The bandwidth balance index at the current moment is compared with the preset balance index threshold. If the bandwidth balance index at the current moment is less than the preset balance index threshold, the improved ant colony algorithm is used to adjust the load balance at the current moment; if the bandwidth balance index at the current moment is greater than or equal to the preset balance index threshold, the PECT algorithm is used to adjust the load balance at the current moment.
4. A load balancing method according to claim 3, characterized in that: The method of using the improved ant colony algorithm to adjust the load balance at the current moment includes: The flow data of all servers at each moment constitute a flow data sequence at each moment; in chronological order, the flow data sequence at the current moment is matched with the flow data sequences at each previous moment in turn, and a matching cutoff coefficient is calculated, wherein the matching cutoff coefficient is negatively correlated with the bandwidth balance index at the corresponding moment of the most recent matching analysis, and is positively correlated with the maximum matching value in all sub-matches; in response to the matching cutoff coefficient being less than a preset cutoff coefficient and the number of matches being less than a preset number of matches, matching is continued; in response to the matching cutoff coefficient being greater than or equal to the preset cutoff coefficient or the number of matches being greater than or equal to the preset number of matches, the flow data sequence at the corresponding moment of the maximum matching value in all sub-matches is used as initialization data; based on the initialization data, an ant colony algorithm is used to solve a target flow data sequence, and the flow of each server is adjusted according to the flow value in the target flow data sequence.
5. A load balancing method according to claim 4, characterized in that: The matching cutoff coefficient satisfies the relationship: in, It represents the bandwidth balance index at the corresponding time of the sth matching analysis. Indicates the maximum matching value in the sth matching analysis and all previous matching analyses. Represents the matching cutoff coefficient in the sth matching analysis.
6. A load balancing method according to claim 4, characterized in that: The step of adjusting the traffic of each server according to the traffic value in the target traffic data sequence includes: The flow of the corresponding server is adjusted based on the flow data in the target flow data sequence.
7. A load balancing method according to claim 4, characterized in that: The matching value is the cosine similarity between the flow data sequence at the current moment and the flow data sequence at each previous moment.
8. A load balancing method according to claim 4, characterized in that: The method for obtaining the predicted value of the total flow data includes: Based on the total traffic data of all servers at the current moment and all previous moments, a prediction algorithm is used to perform a prediction analysis to obtain the predicted total traffic value of all servers at a preset number of moments in the future.
