Load balancing method, device and equipment in message processing process

Through model predictive control, task allocation is optimized based on resource usage data of cluster nodes, which solves the problem of uneven resource allocation of message middleware in the existing technology and improves the system's responsiveness and resource utilization.

CN118626264APending Publication Date: 2024-09-10ZHONGHUI INFORMATION TECH (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410800943.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

When the existing technology handles complex and dynamically changing system loads, it is unable to achieve balanced resource allocation of message middleware, resulting in problems of long response time and low throughput.

Method used

By obtaining the current and historical resource usage data of cluster nodes, we construct performance impact functions and cost functions, and use model predictive control to optimize task allocation to ensure load balancing in the future time zone.

Benefits of technology

Under changing system load conditions, maintain optimal performance and resource allocation, and improve resource utilization and responsiveness of message middleware.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626264A
    Figure CN118626264A
Patent Text Reader

Abstract

The invention discloses a load balancing method, device and equipment in a message processing process, relates to the technical field of message processing, and can keep optimal performance and resource allocation under a continuously changing system load condition and improve the resource utilization rate of message middleware. The method comprises the steps that first resource use data of a cluster node at the current moment are obtained, and the first resource use data comprise at least one piece of performance index data of the cluster node in the current message processing process; performing model prediction control on the to-be-allocated task by taking the first resource use data as a state vector to obtain a task allocation sequence, the task allocation sequence comprising task information suitable for being allocated by the cluster node in a future set time region, and allocating the task information corresponding to the future set time region to the cluster node according to the task allocation sequence, therefore, the node realizes load balancing of message processing according to the distributed task information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of message processing, and in particular to a load balancing method, device and equipment for a message processing process. Background Art

[0002] With the in-depth development of enterprise informatization and service-oriented, message middleware plays an extremely important role in distributed architecture as an important means of asynchronous message processing, system decoupling, load balancing and flow control. Message middleware often needs to process a large number of messages and consumer requests, which requires message middleware to have not only an efficient message delivery mechanism, but also an intelligent load balancing strategy.

[0003] In related technologies, load balancing algorithms such as round-robin, random, and least connections can be used to alleviate the load balancing of the message processing process. Although these algorithms can provide a certain degree of load balancing in some scenarios, they cannot achieve precise control when dealing with complex and dynamically changing system loads, resulting in problems such as uneven resource allocation, long system response time, and low throughput in the message middleware. Summary of the invention

[0004] In view of this, the present application provides a load balancing method, device and equipment for the message processing process, the main purpose of which is to solve the problem that the load balancing method in the prior art cannot achieve precise control, resulting in uneven resource allocation, long system response time, low throughput and other problems in the message middleware.

[0005] According to a first aspect of the present application, a load balancing method for a message processing process is provided, comprising:

[0006] Acquire first resource usage data of the cluster node at a current moment, where the first resource usage data includes at least one performance indicator data of the cluster node during a current message processing process;

[0007] Based on the given task to be assigned as an input vector, the first resource usage data is used as a state vector to perform model predictive control on the task to be assigned to obtain a task assignment sequence, wherein the task assignment sequence includes task information suitable for assignment of cluster nodes in a future set time zone;

[0008] According to the task allocation sequence, task information corresponding to the future set time zone is allocated to the cluster nodes, so that the nodes can achieve load balancing of message processing according to the allocated task information.

[0009] Furthermore, based on the given task to be assigned as an input vector, the first resource usage data is used as a state vector to perform model predictive control on the task to be assigned, and before obtaining the task assignment sequence, the method further includes:

[0010] Acquire second resource usage data of the cluster node in a historical time zone, where the second resource usage data includes at least one performance indicator data of the cluster node in a historical message processing process;

[0011] The second resource usage data is used as a state variable to perform system modeling, and a performance impact function with a mapping relationship is constructed. The performance indicator function captures the impact factor of a given task on different performance indicator data through the mapping relationship.

[0012] Further, based on the given task to be assigned as an input vector, the first resource usage data is used as a state vector to perform model predictive control on the task to be assigned to obtain a task assignment sequence, including:

[0013] Capturing the impact factor of a given task to be assigned on different performance indicator data according to the performance impact function;

[0014] On the basis of given tasks to be assigned as input vectors, the impact factors of the tasks to be assigned on different performance indicator data are taken as state vectors to perform model predictive control on the tasks to be assigned, so as to obtain a task assignment sequence.

[0015] Furthermore, based on the given task to be assigned as an input vector, the influence factor of the task to be assigned on different performance indicator data is used as a state vector to perform model predictive control on the task to be assigned to obtain a task assignment sequence, including:

[0016] Using the impact factor of the task to be assigned on different performance indicator data as a state vector to construct a cost function;

[0017] On the basis of given tasks to be assigned as input vectors, a load balancing algorithm is applied to the cost function to perform model predictive control on the tasks to be assigned, so as to obtain a task assignment sequence.

[0018] Furthermore, the use of the impact factor of the task to be assigned on different performance indicator data as a state vector to construct a cost function includes:

[0019] Using the impact factor of the task to be assigned on different performance indicator data as a state vector, converting the first resource usage data and the second resource usage data into a state space equation;

[0020] A cost function is constructed based on the state-space equation.

[0021] Furthermore, based on the given tasks to be assigned as input vectors, the load balancing algorithm is applied to the cost function to perform model predictive control on the tasks to be assigned to obtain a task assignment sequence, including:

[0022] Based on a given task to be assigned as an input vector, using quadratic programming to solve the third resource usage data of the cluster node in a future set time zone when the cost function is minimized, the third resource usage data including at least one performance indicator data of the cluster node in a future message processing process;

[0023] Model predictive control is performed on the tasks to be assigned according to a resource usage constraint to obtain a task assignment sequence, wherein the resource usage constraint is that the third resource usage data does not exceed the maximum capacity of the cluster node.

[0024] Furthermore, the task to be assigned is a periodic rolling process. After assigning the task information corresponding to the future set time zone to the cluster nodes according to the task assignment sequence so that the nodes achieve load balancing of message processing according to the assigned task information, the method further includes:

[0025] In response to a process trigger of the next periodic task allocation, obtaining third resource usage data of the cluster node in a future set time zone according to the task allocation sequence;

[0026] The third resource data is used as the latest state vector to perform model control prediction for the next cycle of the task to be assigned, so as to obtain a task assignment sequence for the next cycle.

[0027] According to a second aspect of the present application, a load balancing device for a message processing process is provided, comprising:

[0028] A first acquisition unit, configured to acquire first resource usage data of the cluster node at a current moment, wherein the first resource usage data includes at least one performance indicator data of the cluster node in a current message processing process;

[0029] A prediction unit, configured to perform model prediction control on the task to be assigned based on a given task to be assigned as an input vector and using the first resource usage data as a state vector to obtain a task assignment sequence, wherein the task assignment sequence includes task information suitable for assignment to cluster nodes in a future set time zone;

[0030] The allocation unit is used to allocate task information corresponding to the future set time zone to the cluster nodes according to the task allocation sequence, so that the nodes can achieve load balancing of message processing according to the allocated task information.

[0031] Furthermore, the device also includes:

[0032] a second acquisition unit, configured to perform model predictive control on the task to be assigned by taking the first resource usage data as a state vector based on a given task to be assigned as an input vector, and to acquire second resource usage data of the cluster node in a historical time region before obtaining a task assignment sequence, wherein the second resource usage data includes at least one performance indicator data of the cluster node in a historical message processing process;

[0033] A construction unit is used to use the second resource usage data as a state variable to perform system modeling and construct a performance impact function with a mapping relationship, wherein the performance indicator function captures the impact factor of a given task on different performance indicator data through the mapping relationship.

[0034] Furthermore, the prediction unit comprises:

[0035] A capture module, used for capturing the impact factor of a given task to be assigned on different performance indicator data according to the performance impact function;

[0036] The prediction module is used to perform model prediction control on the task to be assigned based on the given task to be assigned as an input vector and to take the impact factor of the task to be assigned on different performance indicator data as a state vector to obtain a task assignment sequence.

[0037] Furthermore, the prediction module is specifically used for:

[0038] Using the impact factor of the task to be assigned on different performance indicator data as a state vector to construct a cost function;

[0039] On the basis of given tasks to be assigned as input vectors, a load balancing algorithm is applied to the cost function to perform model predictive control on the tasks to be assigned, so as to obtain a task assignment sequence.

[0040] Furthermore, the prediction unit is further configured to:

[0041] Using the impact factor of the task to be assigned on different performance indicator data as a state vector, converting the first resource usage data and the second resource usage data into a state space equation;

[0042] A cost function is constructed based on the state-space equation.

[0043] Furthermore, the prediction unit is further configured to:

[0044] Based on a given task to be assigned as an input vector, using quadratic programming to solve the third resource usage data of the cluster node in a future set time zone when the cost function is minimized, the third resource usage data including at least one performance indicator data of the cluster node in a future message processing process;

[0045] Model predictive control is performed on the tasks to be assigned according to a resource usage constraint to obtain a task assignment sequence, wherein the resource usage constraint is that the third resource usage data does not exceed the maximum capacity of the cluster node.

[0046] Furthermore, the task to be assigned is a periodic rolling process, and the device further includes:

[0047] A third acquisition unit is used for, after allocating the task information corresponding to the future set time zone to the cluster nodes according to the task allocation sequence so that the nodes realize the load balancing of message processing according to the allocated task information, in response to the process triggering of the next period task allocation, acquiring the third resource usage data of the cluster nodes in the future set time zone according to the task allocation sequence;

[0048] The prediction unit is further configured to use the third resource data as the latest state vector to perform model control prediction for the next cycle of the task to be assigned, so as to obtain a task assignment sequence for the next cycle.

[0049] According to a third aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in the first aspect when executing the computer program.

[0050] According to a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0051] By means of the above technical scheme, the present application provides a method, device and equipment for load balancing in a message processing process. Compared with the existing technology that uses a load balancing strategy to achieve load balancing in a message processing process, the present application obtains the first resource usage data of the cluster node at the current moment, and the first resource usage data includes at least one performance indicator data of the cluster node in the current message processing process. On the basis of a given task to be assigned as an input vector, the first resource usage data is used as a state vector to perform model predictive control on the task to be assigned, and a task assignment sequence is obtained. The task assignment sequence includes task information suitable for assignment of the cluster node in a future set time zone, and the task information corresponding to the future set time zone is assigned to the cluster node according to the task assignment sequence, so that the node achieves load balancing of message processing according to the assigned task information. The whole process takes into account the use of the resource usage data of the cluster node as a state vector, and load balances the task assignment in the message processing process by introducing model predictive control, which can maintain the optimal performance and resource allocation under the changing system load conditions, so that the system can respond to load changes more intelligently and improve the resource utilization of the message middleware.

[0052] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0054] Figure 1 It is a flow chart of a load balancing method for a message processing process in an embodiment of the present application;

[0055] Figure 2 It is a flow chart of a load balancing method for a message processing process in another embodiment of the present application;

[0056] Figure 3 yes Figure 1 A schematic flow chart of a specific implementation of step 102;

[0057] Figure 4 yes Figure 3 A schematic flow chart of a specific implementation of step 302;

[0058] Figure 5 It is a flow chart of a load balancing method for a message processing process in another embodiment of the present application;

[0059] Figure 6 It is a flowchart of a load balancing method for a message processing process in another embodiment of the present application;

[0060] Figure 7 It is a structural diagram of a load balancing device in a message processing process in an embodiment of the present application;

[0061] Figure 8 It is a schematic diagram of the device structure of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0062] Now the content of the present invention will be discussed with reference to several exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and thus implement the content of the present invention, rather than implying any limitation on the scope of the present invention.

[0063] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including but not limited to." The term "based on" is to be interpreted as "based, at least in part, on." The terms "one embodiment" and "an embodiment" are to be interpreted as "at least one embodiment." The term "another embodiment" is to be interpreted as "at least one other embodiment."

[0064] In the related technology, load balancing algorithms such as round-robin, random, and least connections can be used to alleviate the load balancing of the message processing process. For the round-robin algorithm, it is possible to maintain each server list, access it in sequence, define a server index variable, initialize it to 0, and each time a new request is received, assign the request to the server corresponding to the current index, and then add 1 to the index. If it exceeds the list length, it is reset to 0 and the above process is repeated. However, the round-robin algorithm has the following disadvantages: First, it does not consider the actual load of the server, but simply allocates requests in sequence, which may cause some servers to be overloaded while other servers are idle. Second, requests for different small resources are treated equally, and cannot be treated differently according to different types of requests and resource requirements. Third, when the number of servers changes, manual adjustment and configuration are required, and it cannot adapt.

[0065] For random algorithms, we can maintain a server list and randomly select a server from the list each time a new request is received. We can use a random number generator to generate a random number between 0 and the length of the list as an index. However, random algorithms have the following disadvantages: First, random allocation of requests may lead to uneven load distribution, with some servers being overloaded and others underloaded. Second, it is impossible to make judgments based on the actual load status and remaining resources of the server, which can easily lead to uneven resource utilization. Third, it is impossible to differentiate between different types of requests, and resource-intensive requests may be assigned to already busy servers.

[0066] For the minimum connection algorithm, a server list can be maintained, and the current number of active connections of each server is not recorded. Each time a new request is received, the list is traversed to find the server with the least number of active connections, the request is assigned to this server, and its number of active connections is updated. If there are multiple servers with the same and least number of active connections, one can be selected randomly. However, the minimum connection algorithm has the following disadvantages: First, it only considers the number of active connections, but does not consider the resources actually consumed by each connection, such as CPU, memory, etc., which may lead to uneven load distribution when a single request occupies a large amount of resources. Second, it is impossible to distinguish between different types of requests, and it is impossible to treat requests with high resource requirements differently. Third, in the long connection scenario, it will cause extremely uneven load distribution, because the connection will remain connected after it is established and will not be reallocated.

[0067] In general, although the above algorithms can provide a certain degree of load balancing in some scenarios, these methods cannot achieve precise control when dealing with complex and dynamically changing system loads, resulting in problems such as uneven resource allocation, long system response time, and low throughput in the message middleware.

[0068] In order to solve this problem, this embodiment provides a load balancing method for message processing, such as Figure 1 As shown, the following steps are included:

[0069] 101. Obtain first resource usage data of a cluster node at a current moment.

[0070] Among them, a cluster is a high-performance computer system that connects multiple computers in a local area network or the Internet, and uses software and hardware to achieve resource sharing and task allocation to jointly complete a task. Clusters are mainly used in large-scale data processing, scientific computing, digital processing and other fields, and can provide higher computing efficiency and larger data storage capacity. Cluster nodes, as computing units in a cluster, are usually composed of ordinary computers. They are connected and communicated through the network and use the same operating system and application programs. Each cluster node has its own CPU, memory, hard disk and other resources, and can work together to complete computing tasks.

[0071] During the working process of a specific cluster, tasks will be assigned to cluster nodes for processing according to certain rules and strategies. Here, tasks are usually provided in the form of executable files. During the task allocation process, the scheduler can allocate tasks based on the load of the message middleware, that is, the complexity, priority and node load of the task. The scheduler is the core function of the cluster and is responsible for managing and coordinating task execution and resource allocation on cluster nodes.

[0072] Considering the load balancing of the message processing process, the load of the message middleware usually reflects the load situation of the cluster node at the current moment, rather than just reacting to the current load situation. This embodiment predicts the load of the message middleware based on the first resource usage data to formulate a load balancing strategy in advance. Here, the first resource usage data includes at least one performance indicator data of the cluster node in the current message processing process, such as CPU usage, memory usage, and message queue length data.

[0073] The executor of this embodiment can be a load balancing device or equipment for the message processing process. In the scheduler, the first resource usage data can be used to reflect the load status of the node on different performance indicators at the current moment. The first resource usage data can be used as the state basis for load prediction, and multiple performance indicators can be combined to adjust resources to cope with load changes in future time periods, thereby achieving comprehensive optimization of multiple performance of load balancing.

[0074] 102. Based on the given tasks to be assigned as input vectors, the first resource usage data is used as a state vector to perform model predictive control on the tasks to be assigned to obtain a task assignment sequence.

[0075] Among them, the given tasks to be assigned are task sequences waiting to be processed, including existing tasks to be processed and new tasks to be processed. Here, the tasks to be assigned are task sequences that have not been assigned. After the tasks to be assigned are subjected to model predictive control, a task assignment sequence will be output. The task assignment sequence includes task information suitable for assignment to cluster nodes in a set time zone in the future, that is, each task in the task sequence to be processed will have a corresponding assigned cluster node to send the task to the corresponding cluster node.

[0076] In this embodiment, the first resource usage data can reflect the load situation of the cluster node at the current moment. Using it as a state vector can obtain the current state of the system, so that the task to be assigned can judge the future input and output based on the historical information of the process during the state model predictive control. In the model predictive control process, the state equation, transfer function and even step response or pulse response can be used as a prediction model. The prediction model can reflect the future behavior of the system and calculate the future control action based on the compensation function or performance function.

[0077] It should be noted that the predictive control process as a feedback control algorithm is not completed offline once, but is repeatedly performed online at a limited moving time interval. If the model and process match incorrectly, or if there is a control performance problem caused by system uncertainties, the predictive control process can compensate for it for free or correct the model parameters based on online identification.

[0078] 103. Distribute task information corresponding to a future set time zone to cluster nodes according to the task distribution sequence, so that the nodes achieve load balancing of message processing according to the distributed task information.

[0079] In this embodiment, the task allocation process rolls forward periodically. The task allocation sequence obtained after the current moment's pending tasks are subjected to model predictive control is issued to the corresponding cluster node as the current moment's task allocation strategy. Then the task allocation process enters the next task allocation decision cycle. The first resource usage data collected in the current cycle is used as the state vector, and the task allocation sequence output in the previous cycle is subjected to model predictive control in the current cycle to obtain the task allocation sequence of the current cycle. By rolling forward in this way, the task allocation sequence can be dynamically adjusted according to real-time data during the message processing process to adapt to different workloads and cluster status changes, and has high flexibility and adaptability.

[0080] It can be understood that the task allocation sequence is the task allocation result obtained through load balancing, which is calculated based on the actual system status and can not only cope with the current load situation, but also predict and adapt to the load changes of future work.

[0081] The load balancing method for the message processing process provided by the embodiment of the present application is compared with the current prior art method of realizing load balancing in the message processing process through load balancing strategy. The present application obtains the first resource usage data of the cluster node at the current moment, and the first resource usage data includes at least one performance indicator data of the cluster node in the current message processing process. On the basis of the given task to be assigned as the input vector, the first resource usage data is used as the state vector to perform model predictive control on the task to be assigned, and a task allocation sequence is obtained. The task allocation sequence includes task information suitable for allocation of the cluster node in the future set time area, and the task information corresponding to the future set time area is allocated to the cluster node according to the task allocation sequence, so that the node realizes load balancing of message processing according to the allocated task information. The whole process takes into account the use of the resource usage data of the cluster node as the state vector, and load balances the task allocation in the message processing process by introducing model predictive control, which can maintain the optimal performance and resource allocation under the changing system load conditions, so that the system can respond to load changes more intelligently and improve resource utilization.

[0082] Furthermore, considering that model predictive control is a prediction of future load, it allows the system to adjust resource allocation in advance. In other words, model predictive control uses historical resource usage data to act on real-time feedback to adjust the task allocation strategy, making the system more flexible and robust. Specifically, Figure 2 As shown, before step 102, the method further includes the following steps:

[0083] 201. Obtain second resource usage data of cluster nodes in a historical time zone.

[0084] 202. Use the second resource usage data as a state variable to perform system modeling and construct a performance impact function with a mapping relationship.

[0085] In this embodiment, the second resource usage data includes at least one performance indicator data of the cluster node during the historical message processing process. The specific indicator content is the same as the first resource usage data, but the time zone corresponding to the collection of the performance indicator data is different. The first resource usage data is at least one performance indicator data obtained at the current moment, and the second resource usage data is at least one performance indicator data collected in the historical time zone. The historical time zone here can be the past week, the past day, or the past 10 hours, which is not limited here.

[0086] Specifically, in the process of system modeling with the second resource usage data as the state variable, the state space method can be used to model the second resource usage data. Taking into account that the performance indicator data of the cluster node will change after message processing, the performance indicator data of the cluster node before message processing is used as input, and the performance indicator data of the cluster node after message processing is used as output. The state change is formed by input and output for modeling, and a performance impact function with a mapping relationship is constructed. The performance indicator function captures the impact factor of a given task on different performance indicator data through the mapping relationship.

[0087] Correspondingly, such as Figure 3 As shown, step 102 specifically includes the following steps:

[0088] 301. Capture the impact factor of a given task to be assigned on different performance indicator data according to the performance impact function.

[0089] 302. Based on the given task to be assigned as an input vector, the impact factor of the task to be assigned on different performance indicator data is used as a state vector to perform model predictive control on the task to be assigned, so as to obtain a task assignment sequence.

[0090] In this embodiment, the performance impact function captures the impact factors of a given task to be assigned on different performance indicator data before and after message processing through a mapping relationship. Using the impact factors as state vectors allows the system to take into account unprocessed tasks and the current status of cluster nodes during the task assignment stage. The impact factors are used to control the results of model prediction, so that the system performs load balancing and reasonably allocates tasks to be executed to ensure that the assigned tasks can allow each cluster node to reach a load balanced state.

[0091] In actual application scenarios, at least one performance indicator data of a cluster node in the current message processing process can be expressed as follows: represents the CPU usage of the i-th cluster node at time t. Let represents the memory usage of the i-th cluster node at time t, let represents the message queue length of the i-th cluster node at time t. Given the task to be assigned is μ(t) = [task1(t),ask2(t),,…,task N (t)], where task i (t) represents the number of tasks or some form of task load assigned to the i-th cluster node at time t.

[0092] The purpose of the specific model predictive control process is to optimize the future input μ(t), μ(t+1),…, μ(t+m-1) by predicting the task information suitable for allocation in the future time zone, where t to t+m-1 is the predicted time range, that is, the current to the preset time zone in the future, so as to minimize multiple performance indicator data while meeting the system performance requirements and operation constraints, so that the system can achieve load balancing in the message processing process.

[0093] Specifically, Figure 4 As shown, step 302 includes the following steps:

[0094] 401. Use the impact factor of the task to be assigned on different performance indicator data as a state vector to construct a cost function.

[0095] 402. Based on the given tasks to be assigned as input vectors, a load balancing algorithm is applied to the cost function to perform model predictive control on the tasks to be assigned, so as to obtain a task assignment sequence.

[0096] In this embodiment, the state vector can characterize the change in performance indicators of the task to be assigned after the message is processed. The cost function constructed using the state vector can be used to evaluate the load of the system to obtain the allocation decision suitable for the task to be processed when the system is in load balancing, that is, how to allocate the task to be processed to achieve load balancing of the message processing process.

[0097] Specifically, in the process of using the impact factor of the task to be assigned on different performance indicator data as the state vector to construct the cost function, the impact factor of the task to be assigned on different performance indicator data can be used as the state vector, the first resource usage data and the second resource usage data can be converted into a state space equation, and the cost function can be constructed according to the state space equation. Here, the cost function can be expressed using the following formula:

[0098]

[0099] in, They represent the CPU usage, memory usage, and message queue length of the i-th cluster node at time t, respectively. cup (t) represents the impact factor of the task to be assigned on the CPU usage, μ cup (t), μ men (t), μ quece (t) represent the influencing factors of CPU usage, memory usage, and message queue length of the task pair to be assigned.

[0100] It can be understood that the cost function here is equivalent to the load of cluster node task distribution in the next n task cycles. In order to achieve load balance in the task distribution of each cluster node, the smaller the cost function, the more balanced the tasks allocated to each cluster node by the system.

[0101] Specifically, based on the given task to be assigned as an input vector, the load balancing algorithm is applied to the cost function to perform model predictive control on the task to be assigned. In the process of obtaining the task assignment sequence, the third resource usage data of the cluster node in the future set time area when the cost function is minimized can be solved using quadratic programming based on the given task to be assigned as an input vector. Here, the third resource usage data includes at least one performance indicator data of the cluster node in the future message processing process. Then, model predictive control is performed on the task to be assigned according to the resource usage constraint to obtain the task assignment sequence. Here, the resource usage constraint is that the third resource usage data does not exceed the maximum capacity of the cluster node, that is, the resource usage of the task to be assigned cannot exceed the maximum capacity of the cluster node. The resource usage constraint here can be expressed using the following formula:

[0102]

[0103]

[0104]

[0105] in, Respectively represent the CPU usage, memory usage, and message queue length of the i-th cluster node.

[0106] It can be understood that the entire model predictive control process predicts the state data of m future time zones based on past time series data, and then constructs a cost function based on the state data, and minimizes the cost function through quadratic programming to obtain the optimal task allocation result. This process treats the performance indicator data such as CPU usage, memory occupancy, and message queue length of each cluster node as a multivariate time series, so that the system can achieve more refined load balancing between multiple performance indicators, which helps prevent some machines from being overloaded while other machines are idle, and optimizes the performance and resource utilization of the entire cluster.

[0107] By periodically collecting performance indicator data and performing system modeling and task division based on the performance indicator data, task requirements and machine performance can be matched more effectively to improve overall system performance. On the one hand, the model predictive control process captures the linear dependencies and relationships between these performance indicator data and predicts their future values; on the other hand, the model predictive control process performs parameter modeling on the system model to calculate the model parameters required for predictive control of the system.

[0108] Considering that the tasks to be assigned are a periodic rolling process, further, Figure 5 As shown, after step 103, the method further includes the following steps:

[0109] 501 . In response to a process trigger of the next period task allocation, third resource usage data of the cluster node in a future set time zone is obtained according to the task allocation sequence.

[0110] 502. Use the third resource data as the latest state vector to perform model control prediction for the next cycle of the task to be assigned, and obtain a task assignment sequence for the next cycle.

[0111] In this embodiment, the allocation process of periodic tasks can be automatically triggered after the allocation process of the current cycle is completed, and the latest state vector is generated according to the task allocation sequence obtained in the current cycle. The next model control prediction is performed on the assigned task through the latest state vector, so that the system can be dynamically adjusted according to real-time data to adapt to different workloads and cluster status changes. It has good flexibility and adaptability, and can not only cope with the current load situation, but also predict and adapt to future workload changes, thereby improving the responsiveness and stability of the system.

[0112] In actual application scenarios, such as Figure 6 As shown, Figure 6 The flowchart of the load balancing method for the message processing process is as follows. Specifically, given the tasks to be assigned are [task1(t),ask2(t),,…,task N (t)], based on the given task to be assigned, obtain at least one performance data of the cluster node in the current message processing process, including: CPU usage of the i-th cluster node Memory usage of the i-th cluster node The length of the message queue of the i-th cluster node Then, at least one performance data is used as a state vector to perform model predictive control on the task sequence to be assigned. In the model prediction process, the performance indicator function is first used to capture the impact of the task to be assigned on the performance indicator data, and then the load balancing calculation is performed on the task to be assigned according to the influencing factor. The task allocation sequence after load balancing is obtained as follows: The task allocation sequence obtained from task processing is used as feedback to the model predictive control of the next round of message processing.

[0113] Further, as Figure 1-5 The specific implementation of the method, the embodiment of the present application provides a load balancing device for a message processing process, such as Figure 7 As shown, the device includes: a first acquisition unit 61, a prediction unit 62, and an allocation unit 63.

[0114] A first acquisition unit 61 is used to acquire first resource usage data of the cluster node at a current moment, where the first resource usage data includes at least one performance indicator data of the cluster node during a current message processing process;

[0115] A prediction unit 62 is used to perform model prediction control on the task to be assigned based on a given task to be assigned as an input vector and use the first resource usage data as a state vector to obtain a task assignment sequence, wherein the task assignment sequence includes task information suitable for assignment of cluster nodes in a future set time zone;

[0116] The allocation unit 63 is used to allocate task information corresponding to the future set time zone to the cluster nodes according to the task allocation sequence, so that the nodes can achieve load balancing of message processing according to the allocated task information.

[0117] The load balancing device for the message processing process provided by the embodiment of the present invention is compared with the current prior art method of realizing load balancing in the message processing process through load balancing strategy. The present application obtains the first resource usage data of the cluster node at the current moment, and the first resource usage data includes at least one performance indicator data of the cluster node in the current message processing process. On the basis of the given task to be assigned as the input vector, the first resource usage data is used as the state vector to perform model predictive control on the task to be assigned, and a task allocation sequence is obtained. The task allocation sequence includes task information suitable for allocation of the cluster node in the future set time area, and the task information corresponding to the future set time area is allocated to the cluster node according to the task allocation sequence, so that the node realizes load balancing of message processing according to the allocated task information. The whole process takes into account the use of the resource usage data of the cluster node as the state vector, and load balances the task allocation in the message processing process by introducing model predictive control, which can maintain the optimal performance and resource allocation under the changing system load conditions, so that the system can respond to load changes more intelligently and improve resource utilization.

[0118] In a specific application scenario, the device further includes:

[0119] a second acquisition unit, configured to perform model predictive control on the task to be assigned by taking the first resource usage data as a state vector based on a given task to be assigned as an input vector, and to acquire second resource usage data of the cluster node in a historical time region before obtaining a task assignment sequence, wherein the second resource usage data includes at least one performance indicator data of the cluster node in a historical message processing process;

[0120] A construction unit is used to use the second resource usage data as a state variable to perform system modeling and construct a performance impact function with a mapping relationship, wherein the performance indicator function captures the impact factor of a given task on different performance indicator data through the mapping relationship.

[0121] In a specific application scenario, the prediction unit includes:

[0122] A capture module, used for capturing the impact factor of a given task to be assigned on different performance indicator data according to the performance impact function;

[0123] The prediction module is used to perform model prediction control on the task to be assigned based on the given task to be assigned as an input vector and to take the impact factor of the task to be assigned on different performance indicator data as a state vector to obtain a task assignment sequence.

[0124] In a specific application scenario, the prediction module is specifically used to:

[0125] Using the impact factor of the task to be assigned on different performance indicator data as a state vector to construct a cost function;

[0126] On the basis of given tasks to be assigned as input vectors, a load balancing algorithm is applied to the cost function to perform model predictive control on the tasks to be assigned, so as to obtain a task assignment sequence.

[0127] In a specific application scenario, the prediction module is further used to:

[0128] Using the impact factor of the task to be assigned on different performance indicator data as a state vector, converting the first resource usage data and the second resource usage data into a state space equation;

[0129] A cost function is constructed based on the state-space equation.

[0130] In a specific application scenario, the prediction module is further used to:

[0131] Based on a given task to be assigned as an input vector, using quadratic programming to solve the third resource usage data of the cluster node in a future set time zone when the cost function is minimized, the third resource usage data including at least one performance indicator data of the cluster node in a future message processing process;

[0132] Model predictive control is performed on the tasks to be assigned according to a resource usage constraint to obtain a task assignment sequence, wherein the resource usage constraint is that the third resource usage data does not exceed the maximum capacity of the cluster node.

[0133] In a specific application scenario, the task to be assigned is a periodic rolling process, and the device further includes:

[0134] A third acquisition unit is used for, after allocating the task information corresponding to the future set time zone to the cluster nodes according to the task allocation sequence so that the nodes realize the load balancing of message processing according to the allocated task information, in response to the process triggering of the next period task allocation, acquiring the third resource usage data of the cluster nodes in the future set time zone according to the task allocation sequence;

[0135] The prediction unit is further specifically used to use the third resource data as the latest state vector to perform model control prediction for the next cycle of the task to be assigned, so as to obtain a task assignment sequence for the next cycle.

[0136] It should be noted that for other corresponding descriptions of the various functional units involved in the load balancing device for a message processing process provided in this embodiment, reference can be made to Figure 1-Figure 5 The corresponding description in will not be repeated here.

[0137] Based on the above Figure 1-Figure 5 The method shown in the embodiment of the present application accordingly provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Figure 1-Figure 5 The load balancing method of the message processing process is shown.

[0138] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.

[0139] Based on the above Figure 1-Figure 5 The method shown, and Figure 7 In order to achieve the above-mentioned purpose, the embodiment of the present application also provides a load balancing entity device for the message processing process, which can be a computer, a smart phone, a tablet computer, a smart watch, a server, or a network device, etc. The entity device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1-Figure 5 The load balancing method of the message processing process is shown.

[0140] Optionally, the physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.

[0141] In an exemplary embodiment, see Figure 8 The physical device includes a communication bus, a processor, a memory and a communication interface, and may also include an input / output interface and a display device, wherein each functional unit can communicate with each other through the bus. The memory stores a computer program, and the processor is used to execute the program stored in the memory and execute the load balancing method of the message processing process in the above embodiment.

[0142] Those skilled in the art will appreciate that the load balancing entity device structure of a message processing process provided in this embodiment does not constitute a limitation on the entity device, and may include more or fewer components, or a combination of certain components, or different component arrangements.

[0143] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the load balancing of the above-mentioned message processing process, and the hardware and software resources of the physical device, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing physical device.

[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware. By applying the technical solution of the present application, compared with the current existing methods, the present application introduces model predictive control to load balance the task allocation in the message processing process, and can maintain optimal performance and resource allocation under changing system load conditions, so that the system can respond to load changes more intelligently and improve resource utilization.

[0145] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.

[0146] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.

Claims

1. A load balancing method for a message processing process, characterized in that: include: Acquire first resource usage data of the cluster node at a current moment, where the first resource usage data includes at least one performance indicator data of the cluster node during a current message processing process; Based on the given task to be assigned as an input vector, the first resource usage data is used as a state vector to perform model predictive control on the task to be assigned to obtain a task assignment sequence, wherein the task assignment sequence includes task information suitable for assignment of cluster nodes in a future set time zone; According to the task allocation sequence, task information corresponding to the future set time zone is allocated to the cluster nodes, so that the nodes can achieve load balancing of message processing according to the allocated task information.

2. The method according to claim 1, characterized in that Based on the given task to be assigned as an input vector, the method further includes: performing model predictive control on the task to be assigned by using the first resource usage data as a state vector to obtain a task assignment sequence. Acquire second resource usage data of the cluster node in a historical time zone, where the second resource usage data includes at least one performance indicator data of the cluster node in a historical message processing process; The second resource usage data is used as a state variable to perform system modeling, and a performance impact function with a mapping relationship is constructed. The performance indicator function captures the impact factor of a given task on different performance indicator data through the mapping relationship.

3. The method according to claim 2, characterized in that The method of performing model predictive control on the task to be assigned based on the given task to be assigned as an input vector and using the first resource usage data as a state vector to obtain a task assignment sequence includes: Capturing the impact factor of a given task to be assigned on different performance indicator data according to the performance impact function; On the basis of given tasks to be assigned as input vectors, the impact factors of the tasks to be assigned on different performance indicator data are taken as state vectors to perform model predictive control on the tasks to be assigned, so as to obtain a task assignment sequence.

4. The method according to claim 3, characterized in that Based on the given task to be assigned as an input vector, the influence factor of the task to be assigned on different performance indicator data is used as a state vector to perform model predictive control on the task to be assigned to obtain a task assignment sequence, including: Using the impact factor of the task to be assigned on different performance indicator data as a state vector to construct a cost function; On the basis of given tasks to be assigned as input vectors, a load balancing algorithm is applied to the cost function to perform model predictive control on the tasks to be assigned, so as to obtain a task assignment sequence.

5. The method according to claim 4, characterized in that The step of using the impact factor of the task to be assigned on different performance indicator data as a state vector to construct a cost function includes: Using the impact factor of the task to be assigned on different performance indicator data as a state vector, converting the first resource usage data and the second resource usage data into a state space equation; A cost function is constructed based on the state-space equation.

6. The method according to claim 4, characterized in that Based on the given tasks to be assigned as input vectors, the load balancing algorithm is applied to the cost function to perform model predictive control on the tasks to be assigned to obtain a task assignment sequence, including: Based on a given task to be assigned as an input vector, using quadratic programming to solve the third resource usage data of the cluster node in a future set time zone when the cost function is minimized, the third resource usage data including at least one performance indicator data of the cluster node in a future message processing process; Model predictive control is performed on the tasks to be assigned according to a resource usage constraint to obtain a task assignment sequence, wherein the resource usage constraint is that the third resource usage data does not exceed the maximum capacity of the cluster node.

7. The method according to any one of claims 1 to 6, characterized in that The task to be assigned is a periodic rolling process. After assigning the task information corresponding to the future set time zone to the cluster nodes according to the task assignment sequence so that the nodes achieve load balancing of message processing according to the assigned task information, the method further includes: In response to a process trigger of the next periodic task allocation, obtaining third resource usage data of the cluster node in a future set time zone according to the task allocation sequence; The third resource data is used as the latest state vector to perform model control prediction for the next cycle of the task to be assigned, so as to obtain a task assignment sequence for the next cycle.

8. A load balancing device for a message processing process, characterized in that: include: A first acquisition unit, configured to acquire first resource usage data of the cluster node at a current moment, wherein the first resource usage data includes at least one performance indicator data of the cluster node in a current message processing process; A prediction unit, configured to perform model prediction control on the task to be assigned based on a given task to be assigned as an input vector and using the first resource usage data as a state vector to obtain a task assignment sequence, wherein the task assignment sequence includes task information suitable for assignment to cluster nodes in a future set time zone; The allocation unit is used to allocate task information corresponding to the future set time zone to the cluster nodes according to the task allocation sequence, so that the nodes can achieve load balancing of message processing according to the allocated task information.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the load balancing method of the message processing process described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the load balancing method of the message processing process described in any one of claims 1 to 7 are implemented.