Load balancing method and device based on dynamic weight, equipment and storage medium
By dynamically adjusting the weights by predicting the future load situation of the service node, the problem that existing load balancing methods are difficult to cope with changes and emergencies is solved, and more efficient and stable load balancing is achieved.
Patent Information
- Application Number
- CN202411671172.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-21
AI Technical Summary
Existing load balancing methods are difficult to dynamically adjust routing strategies, cannot effectively deal with changes and emergencies during the system operation, and weight settings are easily affected by subjective factors.
By obtaining the historical node information of each service node, calling the node information prediction model to calculate the node information prediction value at the next moment, calling the weight calculation model to calculate the node information weight based on these predicted values, and normalizing the process. Finally, the weighted summing process is used to select the appropriate service node.
It realizes efficient and accurate load balancing in a complex and changeable computing environment, improves system resource utilization and stability, and avoids the influence of subjective factors.
Smart Images

Figure CN119668840A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of load balancing technology, and in particular to a load balancing method, apparatus, device, and storage medium based on dynamic weights. Background Technology
[0002] Load balancing technology can improve system response speed and resource utilization by rationally allocating computing, storage, and network resources. With the rapid development of cloud computing, big data technology, and distributed systems, load balancing technology plays an increasingly important role in improving system performance and reliability. Existing load balancing methods are mainly divided into static load balancing methods and dynamic load balancing methods.
[0003] Static load balancing distributes requests to various service nodes based on fixed rules, such as round-robin or selecting the node with the lowest load. However, because it cannot adjust routing strategies according to actual load conditions, it struggles to adapt to changes and anomalies during system operation. Dynamic load balancing methods select service nodes based on real-time monitoring of their status, such as by collecting key network metrics in real time and evaluating the performance of each node using pre-defined weights. However, these weights are manually set, making them susceptible to subjective influences, and once set, they remain unchanged, hindering the ability to handle unexpected situations. Summary of the Invention
[0004] The purpose of this invention is to provide a load balancing method, apparatus, device, and storage medium based on dynamic weights, which can achieve an efficient and accurate load balancing scheme in complex and ever-changing computing environments, so as to make reasonable and full use of computing resources.
[0005] To achieve the above objectives, embodiments of the present invention provide a load balancing method based on dynamic weights, comprising:
[0006] Upon receiving a request from a client, the system retrieves historical node information for each service node. This node information includes CPU utilization, memory utilization, network speed, and operation processing time.
[0007] Based on the historical node information, the node information prediction model is invoked to calculate the predicted value of the node information at the next moment; wherein, the node information prediction model includes a CPU utilization prediction model, a memory utilization prediction model, a network speed prediction model, and an operation processing time prediction model.
[0008] Based on the predicted values of the node information, the weight calculation model is invoked to calculate the weight of the node information.
[0009] The node information weights of each service node are normalized to obtain the current node information weights;
[0010] The predicted values of node information are weighted and summed using the current node information weights to obtain the comprehensive performance prediction value for each service node.
[0011] The service node with the highest overall performance prediction value is selected as the target service node, and the client's request is forwarded to the target service node.
[0012] As an improvement to the above scheme, the historical node information is stored in a hash table array. Each hash table in the hash table array is used to store the historical node information of one of the service nodes. Furthermore, the key of each hash table is a timestamp, and the value is the node information collected at the current timestamp.
[0013] As an improvement to the above scheme, the network speed prediction model includes a first network speed prediction model and a second network speed prediction model. The first network speed prediction model is a least squares model with a lower bound, and the second network speed prediction model is an LSTM network. Therefore, the step of calculating the predicted node information value for the next time step based on the historical node information by calling the node information prediction model includes:
[0014] When the current quantity of the network speed dataset exceeds the preset model training threshold, the historical network speed is input into the second network speed prediction model to obtain the network speed prediction value.
[0015] When the current quantity of the network speed dataset is not greater than the model training threshold, the historical network speed is input into the first network speed prediction model to obtain the network speed prediction value.
[0016] As an improvement to the above scheme, the weight calculation model includes a first weight calculation model and / or a second weight calculation model, wherein the first weight model is calculated using the following formula:
[0017]
[0018] Where W(x) represents the node information weight; w min This represents the lower bound of the node information weight; w max x1 represents the upper limit of the node information weight; x2 represents the first discriminant value of the node information prediction value; a represents the initial weight; x represents the node information prediction value.
[0019] As an improvement to the above scheme, the second weight calculation model is calculated using the following formula:
[0020] W(i)=a(1-X(i))
[0021]
[0022] Where W(i) represents the node information weight of the i-th service node; a represents the initial weight; X(i) represents the proportion of the predicted node information value of the i-th service node; x i This represents the predicted node information value for the i-th service node; n represents the total number of service nodes.
[0023] As an improvement to the above scheme, the weight calculation model includes a CPU utilization weight calculation model, a memory utilization weight calculation model, a network speed weight calculation model, and an operation processing time weight calculation model, and:
[0024] The CPU utilization weight calculation model and the memory utilization weight calculation model adopt the first weight calculation model, and the operation processing time weight calculation model adopts the second weight calculation model. The initial weight ratio of CPU utilization, memory utilization, network speed and operation processing time is 2:2:1:1.
[0025] As an improvement to the above scheme, after obtaining the historical node information of each service node and before calling the node information prediction model to calculate the predicted node information value for the next moment, the following is also included:
[0026] Determine whether the quantity of the historical node information meets the preset prediction conditions;
[0027] If the number of historical node information does not meet the prediction conditions, a round-robin method is used to select a target service node, and the client's request is forwarded to the target service node.
[0028] To achieve the above objectives, embodiments of the present invention also provide a load balancing device based on dynamic weights, comprising:
[0029] The node information acquisition module is used to obtain historical node information of each service node after receiving a request from the client; the node information includes CPU utilization, memory utilization, network speed and operation processing time.
[0030] The node information prediction module is used to calculate the predicted node information value for the next moment based on the historical node information by calling the node information prediction model; wherein, the node information prediction model includes a CPU utilization prediction model, a memory utilization prediction model, a network speed prediction model, and an operation processing time prediction model.
[0031] The weight calculation module is used to calculate the weight of the node information based on the predicted value of the node information by calling the weight calculation model;
[0032] The normalization module is used to normalize the node information weights of each service node to obtain the current node information weights.
[0033] The performance prediction module is used to perform weighted summation on the predicted values of the node information using the current node information weights to obtain the comprehensive performance prediction value of each service node.
[0034] The request forwarding module is used to select the service node with the highest comprehensive performance prediction value as the target service node, and forward the client's request to the target service node.
[0035] To achieve the above objectives, embodiments of the present invention also provide a load balancing device based on dynamic weights, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the load balancing method based on dynamic weights as described in any of the above embodiments.
[0036] To achieve the above objectives, embodiments of the present invention also provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the load balancing method based on dynamic weights as described in any of the above embodiments.
[0037] Compared with existing technologies, the load balancing method, apparatus, device, and storage medium based on dynamic weights provided in this invention, upon receiving a client request, acquires historical node information of each service node; wherein, the node information includes CPU utilization, memory utilization, network speed, and operation processing time; based on the historical node information, a node information prediction model is invoked to calculate the predicted node information value for the next moment; wherein, the node information prediction model includes a CPU utilization prediction model, a memory utilization prediction model, a network speed prediction model, and an operation processing time prediction model; based on the predicted node information value, a weight calculation model is invoked to calculate the node information weight; the node information weight of each service node is normalized to obtain the current node information weight; the predicted node information value is weighted and summed using the current node information weight to obtain the comprehensive performance prediction value of each service node; the service node with the highest comprehensive performance prediction value is selected as the target service node, and the client request is forwarded to the target service node. This invention provides an embodiment where different models are used to calculate predicted values for different node information, thereby improving the accuracy of the predicted values. Furthermore, this invention provides an embodiment where the weights of each node information are dynamically adjusted based on the predicted values and weight calculation models, thereby improving the accuracy of the overall performance predicted values and selecting more suitable service nodes to improve the system's resource utilization and stability. Attached Figure Description
[0038] Figure 1 This is a flowchart of a load balancing method based on dynamic weights provided in an embodiment of the present invention;
[0039] Figure 2 This is a flowchart of the API gateway provided in an embodiment of the present invention;
[0040] Figure 3 This is a flowchart of the API gateway provided in another embodiment of the present invention;
[0041] Figure 4 This is a schematic diagram of a hash table array provided in an embodiment of the present invention;
[0042] Figure 5 This is a schematic diagram of a CPU utilization prediction model and a memory utilization prediction model provided in an embodiment of the present invention;
[0043] Figure 6 This is a schematic diagram of an operation processing time prediction model provided in an embodiment of the present invention;
[0044] Figure 7 This is a schematic diagram of a load balancing device based on dynamic weights according to an embodiment of the present invention;
[0045] Figure 8 This is a schematic diagram of the structure of a load balancing device based on dynamic weights according to an embodiment of the present invention. Detailed Implementation
[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0047] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "multiple" means two or more.
[0048] Besides the methods mentioned in the background section, existing static load balancing methods include Round Robin, Least Connections, Static Weighting, and Source IP Hashing. Round Robin is one of the simplest load balancing methods, distributing requests to each service node in a fixed order. This method is simple and balanced, but it doesn't consider the differences in current load and processing capacity among service nodes. Least Connections achieves load balancing by distributing requests to the service node with the fewest current connections. For example, if service node A currently has 10 connections and service node B has 5 connections, new requests will be assigned to service node B. This method attempts to make the load more even among service nodes, but it doesn't consider the actual processing capacity and resource usage of the service nodes. Static weighting assigns a fixed weight value to each node and distributes load according to the weight ratio. For example, if service nodes A and B have weights of 2 and 1 respectively, then A will receive 2 / 3 of the requests, and B will receive 1 / 3. Although this method can set weights based on the processing capacity of the service nodes, once the weights are set, they generally do not change, thus failing to dynamically adapt to load changes. Source address hashing calculates a hash based on the source IP (Internet Protocol) address of the request and distributes the request to a specific service node. This ensures that requests from the same IP address are always assigned to the same service node, achieving session persistence. This method is advantageous for applications requiring session stickiness, but the load balancing effect depends on the distribution of source IP addresses. If the request volume of certain IP addresses is particularly high, it can lead to overload of the corresponding service nodes.
[0049] The main drawbacks of static load balancing methods include a lack of real-time performance, uneven resource utilization, and difficulty in handling node failures. Specifically, because static load balancing methods do not dynamically adjust load distribution strategies, they struggle to adapt to real-time load changes. When the load on some service nodes suddenly increases, static load balancing methods will still distribute requests according to preset rules, potentially causing high-load service nodes to continue receiving requests while other service nodes remain idle, resulting in resource waste and even system performance degradation. Furthermore, when a service node fails, static load balancing methods will still distribute requests to the failed service node according to preset rules, leading to request failures.
[0050] Furthermore, dynamic load balancing methods include methods for dynamic weighted service routing based on the analytic hierarchy process (AHP), load balancing algorithm optimization based on factor thresholds, and load balancing methods based on linear regression algorithms.
[0051] Specifically, the dynamic weighted service routing method based on the analytic hierarchy process (AHP) mainly includes: extending the API (Application Programming Interface) gateway's grouped weighted routing implementer; defining the service self-inspection information collection interface; real-time collection of key indicator information of service and server load, including service availability, CPU (Central Processing Unit) utilization, memory utilization, network utilization, and IO (Input / Output) read / write utilization; establishing a hierarchical structure model using the AHP, calculating the comprehensive score of each API service through pairwise comparison matrices, and ranking the API services; and forwarding requests to the gateway according to the comprehensive score. However, this method requires subjective setting of the comparison matrix to evaluate the importance of each key indicator. If the setting is not reasonable enough, it may produce incorrect load distribution results. For example, when setting up a comparison matrix, if a decision-maker places too much emphasis on network bandwidth utilization, believing that its importance far outweighs other indicators, they might assign a much higher weight to network bandwidth utilization than other indicators, such as setting its weight to 10 while other indicators only have a weight of 1 or 2. However, in some scenarios (such as power dispatching), network bandwidth utilization is not the most critical factor; rather, service response time or server load has a greater impact on system performance. Therefore, such subjective settings may cause routing strategies to deviate from actual needs, thereby reducing the performance and stability of the dispatching system. Furthermore, this method does not consider the state change trends of service nodes when setting weights, but only their current state. However, the state change trends of service nodes have a significant impact on the formulation and adjustment of load balancing strategies. This is because the changing trends of these indicators can show whether their importance is increasing or decreasing. If such changes cannot be captured in time, the weights cannot be adjusted to adapt to new demands and changes, which may lead to unreasonable load distribution and affect the performance and stability of the system. For example, in a power dispatching system, suppose the CPU utilization trend of service node A is 50%, 60%, and 70%, while that of service node B is 90%, 80%, and 75%. If this method is followed, service node A should be selected. However, the changing trends show that service node B will be in a better state than service node A in the next request. This shows that understanding the performance change trends of service nodes has a significant impact on selecting appropriate routing strategies. Therefore, this method still has shortcomings.
[0052] Furthermore, the load balancing algorithm optimization method based on factor thresholds collects the CPU, memory, disk I / O, and network bandwidth utilization of servers in real time and compares them with preset thresholds. Servers exceeding the thresholds have their weights set to 0, and task allocation is stopped. Then, the processing capacity and real-time load rate of the remaining servers are calculated to determine their weights, and tasks are allocated according to the weight ratios to ensure balanced and efficient system operation. However, this method cannot respond and handle sudden load surges in a timely manner, which may lead to system performance bottlenecks and routing problems affecting scheduling services. For example, assuming the CPU utilization threshold is set to 80%, when a large amount of data suddenly floods in, the CPU utilization of all service nodes will exceed 80%, resulting in excessive load.
[0053] Furthermore, the load balancing method based on linear regression includes: using a data acquisition module to periodically collect server load data; using a data acquisition module to organize and store the data; using a weight prediction module to predict the load weight of each server using a linear regression algorithm; and using a policy forwarding module to forward service requests to the appropriate server according to the weights to ensure load balancing. However, this method oversimplifies the relationships between variables because the linear regression algorithm assumes a linear relationship between the variables and performs a simple linear combination of the influence between variables. However, in the load balancing problem, there may be complex interactions and nonlinear relationships between various load indicators, and this method cannot accurately capture these relationships.
[0054] In view of the aforementioned problems with existing load balancing methods, this invention proposes a load balancing method based on dynamic weights, aiming to improve the ability to respond to emergencies and improve resource utilization. It is worth noting that the load balancing method based on dynamic weights provided in this invention can be applied to power dispatching systems, as well as other scenarios, and is not limited thereto.
[0055] See Figure 1 This is a flowchart of a load balancing method based on dynamic weights according to an embodiment of the present invention, including steps S1 to S6:
[0056] S1. Upon receiving a request from the client, obtain historical node information for each service node; the node information includes CPU utilization, memory utilization, network speed, and operation processing time.
[0057] S2. Based on the historical node information, call the node information prediction model to calculate the predicted value of the node information at the next moment; wherein, the node information prediction model includes a CPU utilization prediction model, a memory utilization prediction model, a network speed prediction model, and an operation processing time prediction model.
[0058] S3. Based on the predicted values of the node information, call the weight calculation model to calculate the weight of the node information;
[0059] S4. Normalize the node information weights of each service node to obtain the current node information weights;
[0060] S5. The predicted values of the node information are weighted and summed using the current node information weights to obtain the comprehensive performance prediction value of each service node.
[0061] S6. Select the service node with the highest comprehensive performance prediction value as the target service node, and forward the client's request to the target service node.
[0062] It is worth noting that the load balancing method based on dynamic weights described in this embodiment of the invention can be implemented by an API gateway. See also Figure 2 This is a flowchart of the API gateway provided in an embodiment of the present invention. Figure 2 As can be seen, the API gateway receives requests sent by clients, then executes a load balancing method based on dynamic weights to determine the target service node and forwards the request to the target service node.
[0063] See Figure 3 This is a flowchart of the API gateway provided in another embodiment of the present invention. Figure 3 As can be seen, the API gateway performs a heartbeat check on each service node every preset interval (e.g., 30 seconds) to collect and store the current node information of the service nodes. The node information includes CPU utilization, memory utilization, network speed, and operation processing time, and the node information can be stored in a hash table array. Furthermore, when the API gateway receives a request from a client, it can directly execute steps S1 to S6 of this embodiment of the invention, or it can determine whether to execute steps S1 to S6 based on the historical node information in the hash table array. For example, when the number of historical node information in the hash table array is small (e.g., the number of node information arrays in the hash table is less than 10), the node information prediction value calculated based on the historical node information may not be accurate enough. In this case, steps S2 to S6 can be omitted, and existing load balancing methods such as round-robin can be used to select the target service node for routing. If the number of historical node information in the hash table array is large enough (e.g., the number of node information arrays in the hash table is not less than 10), then steps S1 to S6 are executed.
[0064] Further, in step S2, based on historical node information, the node information prediction model is invoked to calculate the predicted node information value for the next moment. This can be understood as calculating the predicted node information value for each service node separately. Specifically, this includes: calculating the predicted CPU utilization value based on the historical CPU utilization of the service node; calculating the predicted memory utilization value based on the historical memory utilization of the service node; calculating the predicted network speed value based on the historical network speed of the service node; and calculating the predicted operation processing time value based on the historical operation processing time of the service node. For example, when calculating the predicted node information value, the current time can be added by 0.5 seconds as the "next moment," and input into the node information prediction model to obtain the four predicted node information values for each service node.
[0065] Further, in step S3, the weight calculation model may include a CPU utilization weight calculation model, a memory utilization weight calculation model, a network speed weight calculation model, and an operation processing time weight calculation model, which are used to calculate the CPU utilization weight, memory utilization weight, network speed weight, and operation processing time weight, respectively. Compared with the prior art of manually setting weights, the present invention calculates node information weights based on node information prediction values, which can avoid the influence of subjective factors, thus making the calculated node information weights more reasonable. Moreover, compared with the prior art using "fixed" weights, the present invention adjusts the node information weights in real time according to the node information prediction values (that is, the weights in the present invention are "dynamic weights"), thereby enabling more flexible responses to various emergencies and ensuring stable system operation.
[0066] Furthermore, in order to avoid excessive differences in the overall performance prediction values of different service nodes due to excessively large values of certain node information weights, in step S4, the node information weights of each service node are normalized to obtain four current node information weights, including the current CPU utilization weight, the current memory utilization weight, the current network speed weight, and the current operation processing time weight.
[0067] Further, in step S5, the predicted values of node information are weighted and summed based on the current node information weight of each service node to obtain the comprehensive performance prediction value of each service node; in step S6, the API gateway selects the service node (target service node) with the highest comprehensive performance prediction value for routing, that is, forwards the client's request to the target service node.
[0068] Compared with existing technologies, the embodiments of the present invention dynamically adjust the weights of node information based on the predicted values of node information, thereby enabling more flexible responses to various emergencies and ensuring stable system operation. Furthermore, compared with manually setting weights, the embodiments of the present invention can avoid the influence of subjective factors and improve the rationality of node information weights. In addition, the embodiments of the present invention construct corresponding node information models for different node information for node information prediction, thereby taking into account the data characteristics of different node information and improving the accuracy of node information prediction values. Finally, compared with load balancing based on historical data or current data, the embodiments of the present invention calculate node information weights and evaluate the comprehensive performance of each service node based on the predicted values of node information, thereby obtaining more accurate and reasonable performance evaluation results and improving the rationality of the load distribution scheme.
[0069] As one optional implementation, the historical node information is stored in a hash table array. Each hash table in the hash table array is used to store the historical node information of one of the service nodes. The key of each hash table is a timestamp, and the value is the node information collected at the current timestamp.
[0070] See Figure 4 This is a schematic diagram of a hash table array provided in an embodiment of the present invention. Figure 4 As can be seen, the hash table array includes n hash tables (that is, the capacity of the hash table array is n), where n is the number of service nodes. The key of each hash table is a timestamp, and the value is an array of capacity 4, which is used to store the CPU utilization (%), memory utilization (%), network speed (ms, millisecond), and operation processing time (MB / s, Million bytes per second) collected at the current timestamp.
[0071] Further, see Figure 3 After selecting the target service node in step S6, the API gateway also needs to obtain the response result of the target service node and the current node information of each service node. Then, it queries whether the number of node information in each hash table is greater than the preset capacity threshold. If the preset capacity threshold is not reached, the new node information is added to the hash table array. If the capacity threshold is reached, the hash table array is updated, that is, the oldest node information is deleted and the new node information is added to the hash table array to save memory. The capacity threshold can be 10. Then, the data in the hash table of each service node can be encapsulated into a 5x10 array, as shown in equation (1):
[0072]
[0073] Among them, T iRepresents the i-th timestamp; C i M represents the CPU utilization rate for the i-th timestamp; i N represents the memory utilization rate for the i-th timestamp; i P represents the network speed collected at the i-th timestamp; i This represents the processing time for the i-th timestamp.
[0074] As one optional implementation, after obtaining the historical node information of each service node and before calling the node information prediction model to calculate the predicted node information value for the next moment, the method further includes:
[0075] Determine whether the quantity of the historical node information meets the preset prediction conditions;
[0076] If the number of historical node information does not meet the prediction conditions, a round-robin method is used to select a target service node, and the client's request is forwarded to the target service node.
[0077] For example, the prediction condition could be that the number of node information is greater than or equal to 10, that is, each hash table includes at least 10 arrays of node information.
[0078] Understandably, when the number of node information arrays in the hash table is less than 10, it is considered that the number of current historical node information is small. At this time, the node information prediction value calculated based on the historical node information may not be accurate enough. Therefore, steps S2 to S6 are not executed, and a round-robin method is used to select the target service node for routing. When the number of node information arrays in the hash table is greater than or equal to 10, it is considered that the number of current historical node information is sufficient. Then, steps S2 to S6 are executed to obtain a more accurate comprehensive performance prediction result of the service node and a more reasonable routing scheme.
[0079] It is understandable that before step S2, it is necessary to construct CPU utilization prediction models, memory utilization prediction models, network speed prediction models, and operation processing time prediction models. Compared with the prior art, the embodiments of the present invention pre-construct corresponding node information prediction models based on the data characteristics of different node information, which is beneficial to improving the accuracy of node information prediction values.
[0080] It is worth noting that CPU utilization is usually strongly correlated with recent data, so recently collected historical CPU utilization can be used as a reference for prediction. Furthermore, although the hash table stores the historical CPU utilization data from the last 10 collections (for ease of explanation, it is assumed that the hash table mentioned in subsequent embodiments has a capacity of 10, meaning each hash table stores 10 sets of node information arrays), the correlation between earlier historical CPU utilization and the predicted value is weak, and selecting only the most recent historical CPU utilization may lead to significant errors in some cases. Therefore, this embodiment of the invention selects the 6th, 8th, and 10th historical CPU utilization data as reference points for fitting to maximize the smoothness of the function; and a quadratic function is chosen as the fitting model because it is relatively simple and fits trend data with time as the independent variable well, satisfying the real-time requirements of load balancing while avoiding the underfitting problems of linear functions and the overfitting problems of higher-order functions. Meanwhile, considering the potential for incorrect prediction of extreme points due to quadratic functions, this embodiment of the invention sets upper and lower limits for the function to ensure a certain degree of fault tolerance in the CPU utilization prediction model. The upper limit is 95%, and the lower limit is half of the three historical minimum CPU utilization values. For example, the CPU utilization prediction model is shown in equations (2) to (4):
[0081]
[0082] Among them, C pre Ans represents the predicted CPU utilization value. C This represents the initial predicted value of CPU utilization; low C Indicates the lower limit of CPU utilization; T pre Indicates the prediction time; A represents the quadratic coefficient; B represents the linear coefficient; C represents the constant coefficient; C6 represents the CPU utilization rate collected at the 6th timestamp; C8 represents the CPU utilization rate collected at the 8th timestamp; C 10 This indicates the CPU utilization rate collected at the 10th timestamp; min represents the MIN function.
[0083] Among them, A, B, and C in equation (2) satisfy the conditions shown in equation (5):
[0084]
[0085] Furthermore, the memory utilization prediction model is similar to the CPU utilization prediction model, including the selection of fitting reference points and fitting functions, as well as the setting of upper and lower limits, etc., which will not be elaborated here.
[0086] See Figure 5This is a schematic diagram of the CPU utilization prediction model and memory utilization prediction model provided in the embodiments of the present invention, where C represents CPU utilization, M represents memory utilization, T represents timestamp, and C pre M represents the predicted CPU utilization value. pre This represents the predicted memory utilization value. Figure 5 It can be seen that both the CPU utilization prediction model and the memory utilization prediction model are quadratic function models with upper and lower limits.
[0087] Furthermore, the processing time is generally related to server performance. For a single service node, the time it takes to process a request typically doesn't vary much, so a linear function can be directly used for fitting. To reduce errors, this embodiment of the invention selects the least squares method to determine the parameter values of the linear function. See also Figure 6 This is a schematic diagram of an operation processing time prediction model provided in an embodiment of the present invention, where P represents the operation processing time and T represents the timestamp. Figure 5 It can be seen that the operation processing time prediction model provided in this embodiment of the invention uses the least squares method to fit the historical operation processing time. Meanwhile, to ensure fault tolerance, this embodiment of the invention sets the lower limit of the predicted operation processing time value to half of the minimum historical operation processing time. For example, the operation processing time prediction model is shown in equations (6) to (8):
[0088]
[0089] ans P =w P T pre +b P (7)
[0090]
[0091] Among them, P pre Ans represents the predicted operation processing time. P Indicates the initial predicted value of the operation processing time; low P Indicates the lower limit of the operation processing time; w P b represents the slope of the operation processing time prediction model; P T represents the intercept of the operation processing time prediction model; pre Indicates the prediction time; min represents the MIN function; (P1,...,P9,P 10 P1 represents the set of historical operation processing times; P2 represents the operation processing time collected at the 1st timestamp; P3 represents the operation processing time collected at the 9th timestamp; P4 represents the operation processing time collected at the 9th timestamp; P5 represents the operation processing time collected at the 9th timestamp; P6 represents the operation processing time collected at the 9th timestamp; P7 represents the operation processing time collected at the 9th timestamp; P8 represents the operation processing time collected at the 9th times 10 This indicates the processing time for the 10th timestamp.
[0092] Wherein, w in equation (7) P b P The conditions shown in equation (9) must be met:
[0093]
[0094] Among them, T i P represents the i-th timestamp; i This represents the processing time for the i-th timestamp.
[0095] It is understandable that in equation (9), w is respectively... P and b P Finding the partial derivatives and setting them to zero creates a system of equations. Solving this system yields the value of w. P and b P .
[0096] As one optional implementation, the network speed prediction model includes a first network speed prediction model and a second network speed prediction model, wherein the first network speed prediction model is a least squares model with a lower bound, and the second network speed prediction model is an LSTM network. Then, the step of calculating the predicted node information value for the next time step based on the historical node information by calling the node information prediction model includes:
[0097] When the current quantity of the network speed dataset exceeds the preset model training threshold, the historical network speed is input into the second network speed prediction model to obtain the network speed prediction value.
[0098] When the current quantity of the network speed dataset is not greater than the model training threshold, the historical network speed is input into the first network speed prediction model to obtain the network speed prediction value.
[0099] It is worth noting that internet speed generally follows a daily cycle, meaning that the internet speed usually does not change much within the same time period. Therefore, when historical internet speed data is insufficient, a least squares model with a lower limit (the first internet speed prediction model) is chosen to predict internet speed. The lower limit value of the internet speed is half of the minimum historical internet speed. For example, the first internet speed prediction model is shown in equations (10) to (12):
[0100]
[0101] ans N =w N T pre +b N (11)
[0102]
[0103] Where, N preAns represents the predicted network speed. N Indicates the initial predicted network speed; low N Indicates the lower limit of network speed; w N b represents the slope of the network speed prediction model; N T represents the intercept of the network speed prediction model; pre Indicates the prediction time; min represents the MIN function; (N1,...,N9,N) 10 N) represents the set of historical network speeds; N1 represents the network speed collected at the 1st timestamp; N9 represents the network speed collected at the 9th timestamp; N 10 This indicates the network speed collected at the 10th timestamp.
[0104] In equation (11), w N b P The conditions shown in equation (13) must be met:
[0105]
[0106] Among them, T i N represents the i-th timestamp; i This represents the network speed collected at the i-th timestamp.
[0107] Furthermore, unlike the other three types of node information, in this embodiment of the invention, after each network speed is collected, it is recorded in a CSV (Comma-Separated Values) file to construct a network speed dataset. The network speed is recorded in the format of (time, network speed). For example, the model training threshold can be 5000. When the network speed dataset is greater than 5000, an LSTM (Long Short-Term Memory) network is built and trained, and the trained LSTM network is used as the second network speed prediction model.
[0108] It is worth noting that, since network speed has temporal characteristics, this embodiment of the invention also constructs an LSTM network to improve the accuracy of network speed prediction. However, since the training of the LSTM network requires a sufficient amount of data, and the amount of network speed dataset in the initial stage is not yet sufficient, the LSTM network cannot be used to predict network speed at this time. In order to meet the real-time response requirements of the client, this embodiment of the invention initially uses a simple linear fitting (first network speed prediction model) to predict network speed. Although the prediction results of the first network speed prediction model are not excellent, they basically meet the requirements. More importantly, it can make up for the shortcomings of the LSTM network and meet the real-time requirements of network speed prediction.
[0109] Compared with the prior art, the node information prediction model of the present invention introduces a fault tolerance mechanism, that is, by setting upper and lower limits for the node information prediction value, it can prevent the node information prediction value from having a huge deviation that would affect the calculation of node information weight and the prediction of comprehensive performance, and avoid routing errors.
[0110] As one optional implementation, the weight calculation model includes a first weight calculation model and / or a second weight calculation model, wherein the first weight model is calculated using the following formula (14):
[0111]
[0112] Where W(x) represents the node information weight; w min This represents the lower bound of the node information weight; w max x1 represents the upper limit of the node information weight; x2 represents the first discriminant value of the node information prediction value; a represents the initial weight; x represents the node information prediction value.
[0113] As one optional implementation, the second weight calculation model is calculated using the following formulas (15) to (16):
[0114] W(i)=a(1-X(i)) (15)
[0115]
[0116] Where W(i) represents the node information weight of the i-th service node; a represents the initial weight; X(i) represents the proportion of the predicted node information value of the i-th service node; x i This represents the predicted node information value for the i-th service node; n represents the total number of service nodes.
[0117] It is worth noting that, based on the calculation rules of the weight calculation model, the embodiments of the present invention divide it into a first weight calculation model and a second weight calculation model, etc., wherein the first weight calculation model is shown in equation (14), and the second weight calculation model is shown in equations (15) to (16); further, the embodiments of the present invention also divide the weight calculation model into a CPU utilization weight calculation model, a memory utilization weight calculation model, a network speed weight calculation model, and an operation processing time weight calculation model based on the purpose of the weight calculation model, that is, according to the node information weight calculated by the weight calculation model. Based on this understanding, when the first weight calculation model is used to calculate the CPU utilization weight, the CPU utilization weight calculation model also belongs to the first weight calculation model; furthermore, the CPU utilization weight calculation model and the memory utilization weight calculation model can also belong to the first weight calculation model, and although both use the first weight calculation model, the specific parameters (such as the lower limit of the node information weight, the upper limit of the node information weight, the first discriminant value, and the second discriminant value, etc.) can be the same or different.
[0118] Furthermore, for different node information weights, it is necessary to select the appropriate weight calculation model (first weight calculation model or second weight calculation model) based on the characteristics of the node information.
[0119] As one optional embodiment, the weight calculation model includes a CPU utilization weight calculation model, a memory utilization weight calculation model, a network speed weight calculation model, and an operation processing time weight calculation model, and:
[0120] The CPU utilization weight calculation model and the memory utilization weight calculation model adopt the first weight calculation model, and the operation processing time weight calculation model adopts the second weight calculation model. The initial weight ratio of CPU utilization, memory utilization, network speed and operation processing time is 2:2:1:1.
[0121] It is understandable that, as can be seen from the calculation formulas of the first and second weight calculation models described above, the weight calculation model includes "initial weights." This is because, in actual application scenarios, the importance of different node information may vary. Such differences can sometimes be determined through experiments. Therefore, this embodiment of the invention retains the initial weights while dynamically adjusting the node information weights based on the predicted node information values, in order to further improve the accuracy of the weight calculation results. In addition, in some application scenarios, users may have different preferences and needs. For example, some people may pay more attention to certain node information. Therefore, retaining the initial weights can improve the adaptability of the weight calculation model. Furthermore, if it is not desired that the weight calculation model reflects the influence of human factors in actual application, the initial weight ratio can be set to 1:1:1:1.
[0122] Furthermore, in the field of power dispatching applications, experiments have revealed differences in the importance of CPU utilization, memory utilization, network speed, and operation processing time. These differences are roughly as shown in equation (17):
[0123] CPU utilization ≈ Memory utilization > Operation processing time ≈ Network speed (17)
[0124] Therefore, in some implementations, the initial weighting ratio of CPU utilization, memory utilization, network speed, and operation processing time is set to 2:2:1:1.
[0125] It is understandable that service nodes with higher CPU utilization have worse health. Therefore, it is necessary to reduce the CPU utilization weight of service nodes with high CPU utilization. Thus, the first weight calculation model is suitable for the CPU utilization weight calculation model. For example, the CPU utilization weight calculation model is shown in equation (18):
[0126]
[0127] Among them, W c (C pre ) represents the CPU utilization weight; C pre This represents the predicted CPU utilization value.
[0128] As can be seen from equation (18), the initial weight of the CPU utilization weight calculation model is 2, and the first weight calculation model also sets upper and lower limits, that is, the upper limit of the CPU utilization weight is 10 and the lower limit is 0.1.
[0129] Furthermore, the calculation principle of memory utilization weight is similar to that of CPU utilization weight, that is, the higher the memory utilization, the worse the health status of the service node. Therefore, it is necessary to reduce the memory utilization weight of the service node with high memory utilization. Thus, the first weight calculation model is suitable for the memory utilization weight calculation model. For example, the memory utilization weight calculation model is shown in equation (19):
[0130]
[0131] Among them, W M (M pre ) represents the memory utilization weight; M pre This represents the predicted memory utilization value.
[0132] It is worth noting that, in order to improve the accuracy and reliability of node information weights and ensure system stability, this embodiment of the invention also introduces a protection mechanism. Specifically, service nodes with high CPU memory utilization and / or high memory utilization should be used as little as possible. Therefore, this embodiment of the invention sets a precipitous weight for extremely high or low utilization rates (CPU utilization / memory utilization). That is, when the utilization rate exceeds 90%, a very small weight is set to ensure that the corresponding service node is not routed to as much as possible; while when the utilization rate is below 10%, a large weight is set to ensure that the corresponding service node is utilized as much as possible.
[0133] Compared with the prior art, the embodiments of the present invention introduce a protection mechanism for the weight calculation model, that is, by setting a cliff-like weight for ultra-high and ultra-low utilization, it can select idle service nodes and avoid busy service nodes as much as possible during routing, thereby making more even use of computing resources and improving the utilization rate of computing resources.
[0134] Furthermore, the longer the operation processing time, the worse the performance of the service node at that time. Therefore, it is necessary to reduce the operation processing time weight of the service node with a long operation processing time to avoid it being routed. Furthermore, a reference value is needed when judging the length of the operation processing time. Since the operation processing time weights of different service nodes are calculated based on the same operation processing time weight calculation model, the predicted operation processing time values of each service node can be compared horizontally to determine the operation processing time weight. For example, the operation processing time weight calculation model is shown in equations (20) to (21):
[0135] W P (i)=1-X P (i) (20)
[0136]
[0137] In equations (20) to (21), W P (i) represents the operation processing time weight of the i-th service node; X P (i) represents the proportion of the predicted operation processing time of the i-th service node; This represents the predicted operation processing time for the i-th service node; n represents the total number of service nodes.
[0138] As can be seen from equation (20), the initial weight of the operation processing time weight is 1.
[0139] Furthermore, regarding the calculation of network speed weights, since service nodes with faster network speeds have better performance, it is necessary to increase the network speed weight of service nodes with faster network speeds to ensure that they are routed to as many times as possible. Furthermore, a reference value is needed when judging network speed. Since the network speed weights of different service nodes are calculated based on the same network speed weight calculation model, the predicted network speed values of each service node can be compared horizontally to determine the network speed weight. For example, the network speed weight calculation model can adopt a variation of the second weight calculation model, i.e., the network speed weight calculation model is shown in equations (22) to (23):
[0140] W N (i)=X N (i) (22)
[0141]
[0142] In equations (22) to (23), W N (i) represents the network speed weight of the i-th service node; X N (i) represents the proportion of the predicted network speed of the i-th service node; This represents the predicted network speed of the i-th service node; n represents the total number of service nodes.
[0143] Furthermore, in step S4, the CPU utilization weight, memory utilization weight, network speed weight, and operation processing time weight of each service node need to be normalized, as shown in equation (24):
[0144]
[0145] Where, α C Indicates the current CPU utilization weight; α M Indicates the current memory utilization weight; α P Indicates the weight of the current operation processing time; α N The current network speed weight is displayed; W C (i) represents the CPU utilization weight of the i-th service node; W M (i) represents the memory utilization weight of the i-th service node; W P (i) represents the operation processing time weight of the i-th service node; W N (i) represents the network speed weight of the i-th service node.
[0146] Further, in step S5, the predicted values of node information are weighted and summed based on the current node information weight of each service node to obtain the comprehensive performance prediction value of each service node, as shown in equations (25) to (27):
[0147] Score i=α C C prei +α M M prei +α P (P max -P prei )+α N N prei (25)
[0148] P max =max(P pre1 ,...,P pre9 ,P pre10 (26)
[0149] N max =max(N) pre1 ,...,N pre9 N pre10 (27)
[0150] Among them, Score i α represents the overall performance prediction value of the i-th service node; C Indicates the current CPU utilization weight; α M Indicates the current memory utilization weight; α P Indicates the weight of the current operation processing time; α N The current network speed weight is displayed; C prei M represents the predicted CPU utilization of the i-th service node; prei P represents the predicted memory utilization of the i-th service node; prei N represents the predicted operation processing time for the i-th service node; prei P represents the predicted network speed of the i-th service node; max This indicates the maximum value of the predicted operation processing time; max represents the MAX function.
[0151] Furthermore, the overall performance prediction value, Score, was selected. i The largest service node is designated as the target service node, and the client's request is forwarded to the target service node.
[0152] Compared with existing technologies, the load balancing method based on dynamic weights provided in this invention, upon receiving a client's request, obtains historical node information for each service node; wherein, the node information includes CPU utilization, memory utilization, network speed, and operation processing time; based on the historical node information, a node information prediction model is invoked to calculate the predicted node information value for the next moment; wherein, the node information prediction model includes a CPU utilization prediction model, a memory utilization prediction model, a network speed prediction model, and an operation processing time prediction model; based on the predicted node information value, a weight calculation model is invoked to calculate the node information weight; the node information weight of each service node is normalized to obtain the current node information weight; the predicted node information value is weighted and summed using the current node information weight to obtain the comprehensive performance prediction value for each service node; the service node with the highest comprehensive performance prediction value is selected as the target service node, and the client's request is forwarded to the target service node. This invention provides an embodiment where different models are used to calculate predicted values for different node information, thereby improving the accuracy of the predicted values. Furthermore, this invention provides an embodiment where the weights of each node information are dynamically adjusted based on the predicted values and weight calculation models, thereby improving the accuracy of the overall performance predicted values and selecting more suitable service nodes to improve the system's resource utilization and stability.
[0153] See Figure 7 This invention also provides a load balancing device 10 based on dynamic weights, comprising:
[0154] The node information acquisition module 11 is used to acquire historical node information of each service node after receiving a request from the client; the node information includes CPU utilization, memory utilization, network speed and operation processing time.
[0155] The node information prediction module 12 is used to calculate the predicted value of the node information at the next moment based on the historical node information by calling the node information prediction model; wherein, the node information prediction model includes a CPU utilization prediction model, a memory utilization prediction model, a network speed prediction model, and an operation processing time prediction model.
[0156] The weight calculation module 13 is used to calculate the node information weight by calling the weight calculation model based on the predicted value of the node information.
[0157] The normalization module 14 is used to normalize the node information weight of each service node to obtain the current node information weight.
[0158] The performance prediction module 15 is used to perform weighted summation on the predicted values of the node information using the weight of the current node information to obtain the comprehensive performance prediction value of each service node.
[0159] The request forwarding module 16 is used to select the service node with the highest comprehensive performance prediction value as the target service node, and forward the client's request to the target service node.
[0160] The load balancing device based on dynamic weight provided in this embodiment of the invention can realize all the process steps of the load balancing method based on dynamic weight described in the above embodiments. The functions and technical effects of each module and unit in the device are the same as the functions and technical effects of the load balancing method based on dynamic weight described in the above embodiments. The specific implementation method will not be described in detail here.
[0161] See Figure 8 The load balancing device 20 based on dynamic weights provided in this embodiment of the invention includes a processor 21, a memory 22, and a computer program stored in the memory 22 and configured to be executed by the processor 21. When the processor 21 executes the computer program, it implements the steps as described in the above embodiment of the load balancing method based on dynamic weights, for example... Figure 1 The steps S1 to S6 described above; or, when the processor executes the computer program, it implements the functions of each module in the above-described device embodiments.
[0162] The dynamic weight-based load balancing device can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. The dynamic weight-based load balancing device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the schematic diagram is merely an example of a dynamic weight-based load balancing device and does not constitute a limitation on the dynamic weight-based load balancing device. It may include more or fewer components than illustrated, or combine certain components, or use different components. For example, the dynamic weight-based load balancing device may also include input / output devices, network access devices, buses, etc.
[0163] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. This processor is the control center of the dynamic weight-based load balancing device, connecting all parts of the device via various interfaces and lines.
[0164] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the dynamic weight-based load balancing device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created according to the use of the controller, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart memory card (SMC), secure digital card (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0165] The module integrated into the dynamic weight-based load balancing device, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0166] Compared with existing technologies, the load balancing device, equipment, and storage medium based on dynamic weights provided in this embodiment of the invention, upon receiving a client request, acquires historical node information of each service node; wherein, the node information includes CPU utilization, memory utilization, network speed, and operation processing time; based on the historical node information, it calls a node information prediction model to calculate the predicted value of the node information for the next moment; wherein, the node information prediction model includes a CPU utilization prediction model, a memory utilization prediction model, a network speed prediction model, and an operation processing time prediction model; based on the predicted value of the node information, it calls a weight calculation model to calculate the node information weight; it normalizes the node information weight of each service node to obtain the current node information weight; it uses the current node information weight to perform a weighted summation of the predicted value of the node information to obtain the comprehensive performance prediction value of each service node; it selects the service node with the highest comprehensive performance prediction value as the target service node and forwards the client's request to the target service node. This invention provides an embodiment where different models are used to calculate predicted values for different node information, thereby improving the accuracy of the predicted values. Furthermore, this invention provides an embodiment where the weights of each node information are dynamically adjusted based on the predicted values and weight calculation models, thereby improving the accuracy of the overall performance predicted values and selecting more suitable service nodes to improve the system's resource utilization and stability.
[0167] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A load balancing method based on dynamic weights, characterized in that: include: After receiving the client's request, the historical node information of each service node is obtained; the node information includes CPU utilization, memory utilization, network speed and operation processing time; Based on the historical node information, a node information prediction model is called to calculate a node information prediction value at the next moment; wherein the node information prediction model includes a CPU utilization prediction model, a memory utilization prediction model, a network speed prediction model, and an operation processing time prediction model; Based on the node information prediction value, a weight calculation model is called to calculate the node information weight; Normalizing the node information weight of each service node to obtain the current node information weight; The node information prediction value is weighted and summed using the current node information weight to obtain a comprehensive performance prediction value of each service node; The service node with the highest comprehensive performance prediction value is selected as the target service node, and the client's request is forwarded to the target service node.
2. The load balancing method based on dynamic weight according to claim 1, characterized in that: The historical node information is stored in a hash table array, each hash table in the hash table array is used to store the historical node information of a service node, and the key of each hash table is a timestamp, and the value is the node information collected at the current timestamp.
3. The load balancing method based on dynamic weight according to claim 1, characterized in that: The network speed prediction model includes a first network speed prediction model and a second network speed prediction model, wherein the first network speed prediction model is a least squares model with a lower limit, and the second network speed prediction model is an LSTM network. Then, based on the historical node information, calling the node information prediction model to calculate the node information prediction value at the next moment includes: When the current number of network speed data sets is greater than a preset model training threshold, the historical network speed is input into the second network speed prediction model to obtain a network speed prediction value; When the current number of the network speed data set is not greater than the model training threshold, the historical network speed is input into the first network speed prediction model to obtain the network speed prediction value.
4. The load balancing method based on dynamic weights according to claim 1, characterized in that: The weight calculation model includes a first weight calculation model and / or a second weight calculation model, and the first weight calculation model is calculated by the following formula: Where W(x) represents the node information weight; w min Indicates the lower limit of the node information weight; w max represents the upper limit value of the node information weight; x1 represents the first discriminant value of the node information prediction value; x2 represents the second discriminant value of the node information prediction value; a represents the initial weight; x represents the node information prediction value.
5. The load balancing method based on dynamic weights according to claim 4, characterized in that: The second weight calculation model is calculated by the following formula: W(i)=a(1-X(i)) Where W(i) represents the node information weight of the i-th service node; a represents the initial weight; X(i) represents the node information prediction value ratio of the i-th service node; x i represents the node information prediction value of the i-th service node; n represents the total number of service nodes.
6. The load balancing method based on dynamic weights according to claim 5, characterized in that: The weight calculation model includes a CPU utilization weight calculation model, a memory utilization weight calculation model, a network speed weight calculation model and an operation processing time weight calculation model, and: The CPU utilization weight calculation model and the memory utilization weight calculation model adopt the first weight calculation model, and the operation processing time weight calculation model adopts the second weight calculation model, wherein the initial weight ratio of CPU utilization, memory utilization, network speed and operation processing time is 2:2:1:
1.
7. The load balancing method based on dynamic weights according to claim 1, characterized in that: After acquiring the historical node information of each service node and before invoking the node information prediction model to calculate the node information prediction value at the next moment, the method further includes: Determining whether the amount of the historical node information meets a preset prediction condition; If the amount of the historical node information does not satisfy the prediction condition, a polling method is used to select a target service node, and the client's request is forwarded to the target service node.
8. A load balancing device based on dynamic weights, characterized in that: include: The node information acquisition module is used to obtain the historical node information of each service node after receiving the request from the client; the node information includes CPU utilization, memory utilization, network speed and operation processing time; A node information prediction module, used to call a node information prediction model to calculate a node information prediction value at the next moment based on the historical node information; wherein the node information prediction model includes a CPU utilization prediction model, a memory utilization prediction model, a network speed prediction model, and an operation processing time prediction model; A weight calculation module, used to call a weight calculation model to calculate the node information weight based on the node information prediction value; A normalization module, used to normalize the node information weight of each service node to obtain the current node information weight; A performance prediction module, configured to perform weighted sum processing on the node information prediction value using the current node information weight to obtain a comprehensive performance prediction value of each service node; The request forwarding module is used to select the service node with the highest comprehensive performance prediction value as the target service node, and forward the client's request to the target service node.
9. A load balancing device based on dynamic weights, characterized in that: The system comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the load balancing method based on dynamic weights as claimed in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the dynamic weight-based load balancing method according to any one of claims 1 to 7.
Citation Information
Cited By
Event-driven service message processing and routing method and device for improving system flexibility, computer equipment and readable storage medium
CN120075302A
An event-driven service message processing and routing method, device, computer equipment and readable storage medium for improving system elasticity
CN120075302B
Request processing method and device, medium and program product
CN120692100A
Calculation power scheduling method, device and equipment for large model heterogeneous reasoning and medium
CN121455645A