Task allocation method and device

Through the neural network model, predicting the future load of the server node and optimizing task allocation with the current load information, the problem of load imbalance between server nodes is solved and more accurate load control and balance is achieved.

CN120353554APending Publication Date: 2025-07-22INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510487409.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

In the prior art, the load prediction results of multiple server nodes are inaccurate, resulting in unreasonable resource allocation and the purpose of load balancing cannot be achieved.

Method used

By obtaining the historical load information of the server node, using the neural network model to predict the load in the future time period, combining the current load information, determining the overall load status, and then optimizing the task allocation plan to achieve load balancing.

Benefits of technology

Improve the load control accuracy of server nodes in the target time period and achieve load balancing effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120353554A_ABST
    Figure CN120353554A_ABST
Patent Text Reader

Abstract

The invention discloses a task allocation method and device, and relates to the technical field of computers.The method comprises the steps that after m to-be-allocated tasks (wherein the m to-be-allocated tasks are tasks to be operated in a target time period) are obtained, first prediction information corresponding to the target time period can be determined according to historical load information of multiple server nodes; furthermore, second prediction information can be determined according to the first prediction information and the current loads corresponding to the plurality of server nodes. Furthermore, a first allocation scheme can be determined according to the second prediction information, and the m to-be-allocated tasks are allocated to the plurality of server nodes based on the first allocation scheme, and the first allocation scheme is used for indicating the server nodes allocated to the m to-be-allocated tasks. In this way, the load of each server node in the target time period can be controlled more accurately, and the purpose of load balancing is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a task allocation method and apparatus. Background Art

[0002] Currently, when using multiple server nodes to run tasks, in order to improve the utilization efficiency of each server node, the load of each server node can be predicted, and then tasks can be allocated to the corresponding server nodes according to the prediction results, so as to achieve the purpose of balancing the load of multiple server nodes.

[0003] However, in the prior art, when predicting the load of each server node, the prediction results are often inaccurate. As a result, when tasks are allocated to the corresponding server nodes according to the prediction results, the problem of unreasonable resource allocation will occur. Summary of the Invention

[0004] This application provides a task allocation method and apparatus to at least solve the problem of unbalanced load of multiple server nodes in the related art.

[0005] This application provides a task allocation method, including: obtaining m tasks to be allocated; the m tasks to be allocated are tasks to be run within a target time period, and m is a positive integer; determining first prediction information corresponding to the target time period according to the historical load information of multiple server nodes; the first prediction information is used to indicate the loads of multiple server nodes at multiple time points within the target time period; determining second prediction information according to the first prediction information and the current loads corresponding to multiple server nodes respectively; the second prediction information is used to indicate the overall load status of multiple server nodes within the target time period; determining a first allocation plan according to the second prediction information; the first allocation plan is used to indicate: the server nodes to which the m tasks to be allocated are respectively allocated; allocating the m tasks to be allocated to multiple server nodes based on the first allocation plan.

[0006] The present application also provides a task allocation device, including: an acquisition unit, configured to acquire m tasks to be allocated; the m tasks to be allocated are tasks to be run within a target time period, and m is a positive integer; a processing unit, configured to determine first prediction information corresponding to the target time period according to historical load information of a plurality of server nodes; the first prediction information is used to indicate the loads of the plurality of server nodes at multiple time points within the target time period; the processing unit is further configured to determine second prediction information according to the first prediction information and the detected current loads corresponding to the plurality of server nodes respectively; the second prediction information is used to indicate the overall load status of the plurality of server nodes at multiple time points within the target time period; the processing unit is further configured to determine a first allocation plan according to the second prediction information; the first allocation plan is used to indicate: the server nodes respectively allocated to the m tasks to be allocated; and allocate the m tasks to be allocated to the plurality of server nodes based on the first allocation plan.

[0007] The present application also provides an electronic device, including: a memory, configured to store a computer program; a processor, configured to implement the steps of any one of the above task allocation methods when executing the computer program.

[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored, and wherein the computer program implements the steps of any one of the above task allocation methods when executed by a processor.

[0009] The present application also provides a computer program product, including a computer program, and the computer program implements the steps of any one of the above task allocation methods when executed by a processor.

[0010] Compared with the solution in the related art of predicting the loads of each server node within a future time period and allocating server nodes for tasks to be allocated according to the prediction results, in the above technical solution of the embodiment of the present application, after predicting the loads of the plurality of server nodes at multiple time points within the target time period (i.e., the first prediction information), the first prediction information is not directly used to determine the task allocation plan. Instead, the second prediction information is first determined according to the first prediction information and the current loads of the plurality of server nodes, and then the second prediction information is used to determine the task allocation plan (i.e., the second allocation plan). In this way, when allocating the m tasks to be allocated to the plurality of server nodes based on the first allocation plan, the loads of each server node within the target time period can be controlled more precisely to achieve the purpose of load balancing. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] To more clearly illustrate the embodiments of the present application, the accompanying drawings required for use in the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0012] Figure 1 It is a schematic structural diagram of a server cluster provided by an embodiment of the present application;

[0013] Figure 2 It is one of the schematic flowcharts of a task allocation method provided by an embodiment of the present application;

[0014] Figure 3 It is another schematic flowchart of a task allocation method provided by an embodiment of the present application;

[0015] Figure 4 It is yet another schematic flowchart of a task allocation method provided by an embodiment of the present application;

[0016] Figure 5 It is still another schematic flowchart of a task allocation method provided by an embodiment of the present application;

[0017] Figure 6 It is yet another schematic flowchart of a task allocation method provided by an embodiment of the present application;

[0018] Figure 7 It is still another schematic flowchart of a task allocation method provided by an embodiment of the present application;

[0019] Figure 8 It is a schematic structural diagram of a task allocation device provided by an embodiment of the present application;

[0020] Figure 9 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0021] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present application.

[0022] It should be noted that in the description of this application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or elements inherent to such a process, method, article or device. The terms "first", "second", etc. in this application are used to distinguish similar objects, rather than to describe a specific order or sequence.

[0023] In order to enable those skilled in the art of this technology to better understand the solution of this application, the following further describes this application in detail with reference to the accompanying drawings and specific embodiments.

[0024] In the embodiments of this application, it is considered that: in the case of using multiple server nodes to run tasks, in order to balance the loads of multiple server nodes, the loads of each server node in a future time period can be predicted, and the server nodes assigned to the tasks to be assigned can be determined according to the prediction results. However, currently when predicting the loads of server nodes in a future time period, the prediction results often have deviations. Therefore, when determining the server nodes assigned to the tasks to be assigned according to the prediction results, the expected load balancing effect is often not achieved.

[0025] Based on the above situation, the embodiments of this application provide a technical solution. In this technical solution, on the one hand, in the case where server nodes need to be assigned to tasks to be assigned, after obtaining m tasks to be assigned (where the m tasks to be assigned are tasks to be run in a target time period), the first prediction information corresponding to the target time period can be determined according to the historical load information of multiple server nodes. Among them, the first prediction information is used to indicate the loads of multiple server nodes at multiple time points in the target time period. On the other hand, the second prediction information can be determined according to the first prediction information and the current loads corresponding to multiple server nodes respectively, where the second prediction information is used to indicate the overall load status of multiple server nodes in the target time period. Furthermore, the first allocation plan can be determined according to the second prediction information, and the m tasks to be assigned are assigned to multiple server nodes based on the first allocation plan, where the first allocation plan is used to indicate the server nodes assigned to the m tasks to be assigned respectively.

[0026] Compared with the solution in the related art of predicting the loads of each server node in a future time period and allocating server nodes for tasks to be allocated according to the prediction results, in the above technical solution of the embodiments of the present application, after predicting the loads of multiple server nodes at multiple time points in a target time period (i.e., the first prediction information), the first prediction information is not directly used to determine the task allocation plan. Instead, the second prediction information is first determined according to the first prediction information and the current loads of the multiple server nodes, and then the second prediction information is used to determine the task allocation plan (i.e., the second allocation plan). In this way, when m tasks to be allocated are allocated to multiple server nodes based on the first allocation plan, the loads of each server node in the target time period can be controlled more precisely to achieve the purpose of load balancing.

[0027] Next, the technical solution provided by the embodiments of the present application will be introduced in detail with reference to examples.

[0028] First, the embodiments of the present application provide a task allocation method. Among them, the execution subject of the task allocation method can be a task allocation device. When the task allocation device runs, it can be used to execute all or part of the steps in the task allocation method provided by the embodiments of the present application. Among them, in the actual application process, the function of the task allocation device can be realized by an electronic device such as a personal computer (including desktop computers, laptop computers, handheld computers, and notebook computers), or a smart phone, a server, etc.; or, the function of the above task allocation device can also be realized by some hardware / software devices in the above electronic devices. The embodiments of the present application do not impose special restrictions on the specific form of the task allocation device.

[0029] As Figure 1 shown in the figure is a schematic diagram of an application scenario provided by the embodiments of the present application. In this application scenario, there is a server cluster 10. Among them, the server cluster 10 includes multiple server nodes (in the figure, server node 101, server node 102, server node 103,..., server node 10k are taken as examples for illustration). Among them, each server node can use its own computing power resources to run related tasks. In addition, the server cluster 10 also includes a task allocation device 110 for allocating tasks to the server nodes. When the task allocation device 110 runs, the task allocation device 110 can execute all or part of the steps in the task allocation method provided by the embodiments of the present application. It can be understood that Figure 1 only the task allocation device 110 is exemplarily used as a functional module independent of the server nodes. In the actual application process, the function of the task allocation device 110 can also be realized by the server nodes in the server cluster 10. At this time, the task allocation device 110 can be used as a hardware / software device in the server nodes.

[0030] As Figure 2 shown, the task allocation method provided by the embodiments of the present application may include:

[0031] S201. The task allocation device obtains m tasks to be allocated.

[0032] Among them, the m tasks to be allocated are m tasks to be run within a target time period, and m is a positive integer.

[0033] S202. The task allocation device determines first prediction information corresponding to the target time period according to the historical load information of multiple server nodes.

[0034] Among them, the first prediction information is used to indicate the loads of multiple server nodes at multiple time points within the target time period.

[0035] For example, taking the target time period as a time period with a start time of t0 and an end time of t1, X time points are taken between t0 and t1, where X>1. Then the first prediction information may include the loads of multiple server nodes at the X time points.

[0036] In some implementation manners, a machine learning algorithm may be used to train a model using the historical load information of multiple server nodes to obtain a neural network model for predicting the load of server nodes (hereinafter referred to as the state prediction model). Furthermore, the state prediction model may be used to obtain the loads of multiple server nodes at multiple time points within the target time period (i.e., the first prediction information). Therefore, as Figure 3 shown, S202 may specifically include:

[0037] S2021. The task allocation device determines first prediction information corresponding to the target time period using the state prediction model.

[0038] Among them, the state prediction model is a neural network model trained using the historical load information of multiple server nodes for predicting the load of server nodes.

[0039] In some designs, the state prediction model is a neural network model trained using the first sample set as the training set and the second sample set as the validation set.

[0040] Specifically, the state prediction model may be a neural network model constructed based on a long short-term memory network (LSTM).

[0041] Among them, the first sample set includes multiple training samples, the second sample set includes multiple training samples, and a training sample includes the load corresponding to a server node at multiple adjacent historical time points; among them, the time corresponding to the training samples included in the first sample set is earlier than the time corresponding to the training samples included in the second sample set.

[0042] In the above design, it is considered that: on the one hand, during the operation of the server node, the loads in adjacent time are often correlated. Therefore, the load corresponding to the server node at multiple adjacent historical time points can be used as a training sample to train the state prediction model, which can help improve the accuracy of the prediction information output by the state prediction model. On the other hand, during the model training process, the data with a longer time can be used as the training set and the data closer to the current time can be used as the validation set, which can help improve the accuracy of the prediction information output by the state prediction model.

[0043] Exemplarily, the output result of the state prediction model can be expressed as:

[0044] P = LSTM(X)

[0045] Among them, P represents the output result of the state prediction model, LSTM represents the long short-term memory network, and X represents the training sample input into the state prediction model.

[0046] In addition, for the training process of the state prediction model, it will be introduced in detail in the corresponding parts of S401-S404 below and will not be elaborated here.

[0047] S203. The task allocation device determines the second prediction information according to the first prediction information and the current loads corresponding to multiple server nodes respectively.

[0048] Exemplarily, the current loads corresponding to multiple server nodes respectively can be obtained through the monitoring tool Prometheus.

[0049] Among them, the second prediction information is used to indicate the overall load status of multiple server nodes respectively within the target time period.

[0050] In some implementation manners, as Figure 4 shown, S203 may specifically include:

[0051] S2031. The task allocation device determines the comprehensive load indexes corresponding to multiple server nodes respectively according to the first prediction information and the current loads corresponding to multiple server nodes respectively.

[0052] Among them, the comprehensive load index satisfies the following formula (1):

[0053]

[0054] Among them, CLI represents the comprehensive load index; t0 and t1 are the start time and end time corresponding to the target time period respectively; P(t) represents the load value of the server node at time point t among multiple time points. For example, P(t) can be the load value of the server node at time point t included in the output result of the state prediction model; R represents the current load value corresponding to the server node.

[0055] In some other implementation manners, the comprehensive load index can also be calculated using other formulas.

[0056] For example, in some designs, the comprehensive load index satisfies the following formula two:

[0057]

[0058] Among them, CLI represents the comprehensive load index; t0 and t1 are the start time and end time corresponding to the target time period respectively; P(t) represents the load value of the server node at time point t among multiple time points. For example, P(t) can be the load value of the server node at time point t included in the output result of the state prediction model; R represents the current load value corresponding to the server node.

[0059] For another example, in some designs, the comprehensive load index satisfies the following formula three:

[0060]

[0061] Among them, CLI represents the comprehensive load index; t0 and t1 are the start time and end time corresponding to the target time period respectively; P(t) represents the load value of the server node at time point t among multiple time points. For example, P(t) can be the load value of the server node at time point t included in the output result of the state prediction model; R represents the current load value corresponding to the server node; ω1 and ω2 are preset weight values, and the sum of ω1 and ω2 is 1.

[0062] S2032. The task allocation device determines the second prediction information according to the comprehensive load indexes corresponding to multiple server nodes respectively.

[0063] For example, the task allocation device can use the comprehensive load indexes corresponding to multiple server nodes respectively as the second prediction information for subsequent processing. For another example, the task allocation device can further process the comprehensive load indexes corresponding to multiple server nodes respectively, and then use the processing result as the second prediction information for subsequent processing.

[0064] In the above implementation, considering that the overall load status of the server node in the target time period can be reflected by integrating the loads at each time point of the server node in the target time period, and then the comprehensive load indexes corresponding to the server nodes can be calculated in a standardized manner by using the above formula (1), so as to obtain the second prediction information that can accurately reflect the overall load status of each server node in the target time period.

[0065] S204. The task allocation device determines a first allocation plan according to the second prediction information.

[0066] The first allocation plan is used to indicate the server nodes respectively allocated to the m tasks to be allocated.

[0067] In some implementations, when the second prediction information includes the comprehensive load indexes corresponding to the above multiple server nodes, the first allocation plan may include:

[0068] The tasks to be allocated are allocated to the current server node in descending order of the comprehensive load indexes corresponding to the multiple server nodes. After the load of the current server node is greater than the threshold load, the tasks to be allocated are allocated to the next server node.

[0069] Exemplarily, taking a server cluster including three server nodes: nodeA, nodeB, and nodeC as an example: Assume that in the target time period between time point t0 and time point t1, it is necessary to allocate server nodes for 5 tasks (denoted as: Task 1, Task 2, Task 3, Task 4, and Task 5). Among them, the resource requirements of each task are as follows:

[0070] Task 1: The CPU usage rate requirement is 20%, and the memory occupancy rate is 10%.

[0071] Task 2: The CPU usage rate requirement is 30%, and the memory occupancy rate is 15%.

[0072] Task 3: The CPU usage rate requirement is 40%, and the memory occupancy rate is 20%.

[0073] Task 4: The CPU usage rate requirement is 10%, and the memory occupancy rate is 5%.

[0074] Task 5: The CPU usage rate requirement is 50%, and the memory occupancy rate is 25%.

[0075] In addition, assume that the current loads of each server node are:

[0076] Node A: CPU usage rate 50%, memory occupancy rate 40%.

[0077] Node B: CPU usage rate is 70%, memory occupancy rate is 60%.

[0078] Node C: CPU usage rate is 30%, memory occupancy rate is 20%.

[0079] Then, according to Formula 1, calculate the comprehensive load index CLI_A corresponding to nodeA, the comprehensive load index CLI_B corresponding to nodeB, and the comprehensive load index CLI_C corresponding to nodeC respectively, where:

[0080]

[0081] Among them, exemplarily, the weighted average of the CPU usage rate and the memory occupancy rate (i.e., (50 + 40) / 2) is used as the current load value R corresponding to nodeA. In addition, 80 is the calculation result.

[0082]

[0083] Among them, exemplarily, the weighted average of the CPU usage rate and the memory occupancy rate (i.e., (70 + 60) / 2) is used as the current load value R corresponding to nodeB. In addition, 120 is the calculation result.

[0084]

[0085] Among them, exemplarily, the weighted average of the CPU usage rate and the memory occupancy rate (i.e., (30 + 20) / 2) is used as the current load value R corresponding to nodeC. In addition, 60 is the calculation result.

[0086] Arrange in descending order according to the sorting of the comprehensive load index: nodeC → nodeA → nodeB. Therefore, tasks can be preferentially assigned to the node (NodeC) with a decreasing comprehensive load index, and then assigned to other nodes in turn. The assignment process may include S301 - S305:

[0087] S301. Assign Task 1 to NodeC.

[0088] Among them, the new load of NodeC is: CPU usage rate: 30% + 20% = 50%; memory occupancy rate: 20% + 10% = 30%.

[0089] S302. Assign Task 2 to NodeC.

[0090] Among them, the new load of NodeC is: CPU usage rate: 50% + 30% = 80%; memory occupancy rate: 30% + 15% = 45%.

[0091] S303. Assign Task 3 to NodeA.

[0092] Among them, since Node C is already close to full load, Task 3 is assigned to NodeA.

[0093] Among them, the new load of NodeA is: CPU usage rate: 50% + 40% = 90%; memory occupancy rate: 40% + 20% = 60%.

[0094] S304. Assign Task 4 to NodeA.

[0095] Among them, the new load of NodeA is: CPU usage rate: 90% + 10% = 100%; memory occupancy rate: 60% + 5% = 65%.

[0096] S305. Assign Task 5 to NodeB.

[0097] Among them, since Node A is already close to full load, Task 4 is assigned to NodeB.

[0098] Among them, the new load of NodeB is: CPU usage rate: 70% + 50% = 120%; memory occupancy rate: 60% + 25% = 85%.

[0099] S205. The task allocation device allocates m tasks to be allocated to multiple server nodes based on the first allocation scheme.

[0100] For example, when the first allocation scheme is the allocation scheme corresponding to the above S301 - S305, the task allocation device can allocate m tasks to be allocated to multiple server nodes based on the first allocation scheme according to the process of the above S301 - S305.

[0101] In some implementation manners, as Figure 5 shown, the method may further include:

[0102] S206. When the load balancing degree corresponding to the first allocation scheme is lower than a preset threshold, the task allocation device determines n candidate allocation schemes.

[0103] Among them, each candidate allocation scheme in the n candidate allocation schemes is respectively used to indicate: a scheme for allocating m tasks to be allocated to server nodes.

[0104] Exemplarily, the n candidate allocation schemes may be n randomly generated candidate allocation schemes.

[0105] For example, taking the allocation of 5 tasks (Task 1, Task 2, Task 3, Task 4, and Task 5) to three server nodes (nodeA, nodeB, and nodeC) as an example: The 5 tasks can be allocated to the three server nodes in a random permutation and combination manner, thereby generating n candidate allocation schemes. For example, the n candidate allocation schemes can include: Scheme 1 {C; C; A; A; B} (indicating that Task1 to Task5 are respectively allocated to NodeC, NodeC, NodeA, NodeA, NodeB), Scheme 2 {C; A; C; B; A} (indicating that Task1 to Task5 are respectively allocated to NodeC, NodeA, NodeC, NodeB, NodeA), and so on.

[0106] S207. The task allocation device uses the n candidate allocation schemes as the initial population and determines the second allocation scheme with the highest fitness using a genetic algorithm.

[0107] For example, the second allocation scheme can specifically be the candidate allocation scheme with the highest fitness determined from the generated candidate allocation schemes after a preset number of iterations using a genetic algorithm.

[0108] For another example, the second allocation scheme can specifically be the candidate allocation scheme with a fitness greater than the threshold value generated during the iteration using a genetic algorithm.

[0109] Among them, in the genetic algorithm, the fitness of each candidate allocation scheme is used to indicate the load balancing degree of the multiple server nodes corresponding to the candidate allocation scheme during the target time period.

[0110] Among them, the load balancing degree of the multiple server nodes during the target time period is determined based on the first prediction information and the currently detected loads corresponding to the multiple server nodes respectively.

[0111] In some implementation manners, the fitness of each candidate allocation scheme satisfies the following Formula 4:

[0112]

[0113] Among them, Fitness represents the value of the fitness of a candidate allocation scheme, i represents the i-th server node among the multiple server nodes, and CLI_i represents the comprehensive load index of the i-th server node determined based on the first prediction information and the currently detected loads corresponding to the multiple server nodes respectively in the case of using this candidate allocation scheme to allocate server nodes for m tasks to be allocated.

[0114] Specifically, during the iteration process using the genetic algorithm, operations such as selection, crossover, and mutation can be performed on the individuals (i.e., candidate allocation schemes) in each generation of the population. Among them, the roulette wheel selection method can be used for the selection operation, the single-point crossover method can be used for the crossover operation, and for the mutation operation, one item in the candidate allocation scheme can be randomly changed with a probability of 0.01.

[0115] S208. The task allocation device allocates the m tasks to be allocated to multiple server nodes based on the second allocation scheme.

[0116] The above implementation method can use the genetic algorithm to determine the second allocation scheme with the optimal load balancing degree from a large number of candidate allocation schemes, and then allocate the m tasks to be allocated to multiple server nodes based on the second allocation scheme, so that the load of each server node can be more accurately controlled within the target time period to achieve the purpose of load balancing.

[0117] In some implementation methods, as Figure 6 shown, the method may further include:

[0118] S209. The task allocation device detects the running states of multiple server nodes.

[0119] For example, the monitoring tool Prometheus can be used to detect each index in the running states of each server node. Among them, when any one or more indexes exceed the preset threshold, an alarm mechanism is triggered.

[0120] S210. When the task allocation device detects that multiple server nodes have failed, it generates a fault log.

[0121] Among them, the fault log at least includes the location and time of the server node corresponding to the fault.

[0122] For example, the ELK Stack tool can be used to generate the fault log, and the fault log can include information such as the occurrence time of the current fault, the server nodes involved, the specific reasons triggered, and their solutions.

[0123] In some designs, the method can also use the above fault log to train the above state prediction model, so that the result output by the state prediction model can include fault prediction information.

[0124] The training process of the above state prediction model will be introduced below. As Figure 7 shown, the method may further include:

[0125] S401. The task allocation device obtains the historical load information of multiple server nodes.

[0126] Among them, the historical load information of each server node may specifically include: the load of the server node at the corresponding time point collected every preset sampling time.

[0127] For example, the monitoring tool Prometheus can be used to detect the load of the server node every preset sampling time, and the load of the server node at the corresponding time point.

[0128] S402. The task allocation device preprocesses the historical load information of multiple server nodes respectively to obtain preprocessed information.

[0129] Among them, the preprocessing may include: deduplication, normalization, removing abnormal data, and standardization using the standard score (Z-score), etc.

[0130] S403. The task allocation device determines a first sample set and a second sample set according to the preprocessed information.

[0131] Among them, the first sample set includes multiple training samples, the second sample set includes multiple training samples, and one training sample includes the load corresponding to a server node at multiple adjacent historical time points; among them, the time corresponding to the training samples included in the first sample set is earlier than the time corresponding to the training samples included in the second sample set.

[0132] S404. Using the first sample set as the training set and the second sample set as the validation set, train the neural network model to obtain a state prediction model.

[0133] Specifically, the state prediction model can be a neural network model constructed based on LSTM.

[0134] Specifically, the state prediction model can be a neural network model including two layers of LSTM units and a fully connected layer. Among them, in the two layers of LSTM units, each layer includes 100 hidden units; the fully connected layer is used to output the state prediction result.

[0135] Exemplarily, the output result of the state prediction model can be expressed as:

[0136] P = LSTM(X)

[0137] Among them, P represents the output result of the state prediction model, LSTM represents the long short-term memory network, and X represents the training sample input into the state prediction model.

[0138] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.

[0139] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present application further provides a task allocation device. This embodiment corresponds to the foregoing method embodiment. For the convenience of reading, the details in the foregoing method embodiment will not be repeated one by one in this embodiment. However, it should be clear that the task allocation device in this embodiment can correspondingly implement all the content in the foregoing method embodiment.

[0140] An embodiment of the present application provides a task allocation device. Figure 8 As a schematic structural diagram of the task allocation device, as Figure 8 shown, the task allocation device 50 includes:

[0141] An acquisition unit 501, configured to acquire m tasks to be allocated; the m tasks to be allocated are tasks to be run within a target time period, and m is a positive integer.

[0142] A processing unit 502, configured to determine first prediction information corresponding to the target time period according to historical load information of multiple server nodes; the first prediction information is used to indicate the loads of the multiple server nodes at multiple time points within the target time period;

[0143] The processing unit 502 is further configured to determine second prediction information according to the first prediction information and the current loads corresponding to the multiple server nodes respectively; the second prediction information is used to indicate the overall load status of the multiple server nodes within the target time period;

[0144] The processing unit 502 is further configured to determine a first allocation plan according to the second prediction information; the first allocation plan is used to indicate: the server nodes respectively allocated to the m tasks to be allocated;

[0145] The processing unit 502 is further configured to allocate the m tasks to be allocated to the multiple server nodes based on the first allocation plan.

[0146] In some implementation manners, the processing unit 502 is configured to determine the first prediction information corresponding to the target time period according to historical load information of multiple server nodes, including:

[0147] The processing unit 502 is configured to use a state prediction model to determine the first prediction information corresponding to the target time period; the state prediction model is a neural network model for predicting the load of a server node, which is trained using historical load information of multiple server nodes.

[0148] In some implementation manners, the processing unit 502 is further configured to determine the second prediction information according to the first prediction information and the current loads corresponding to the multiple server nodes respectively, including:

[0149] The processing unit 502 is further configured to determine the comprehensive load index corresponding to each of the multiple server nodes according to the first prediction information and the current load corresponding to each of the multiple server nodes; wherein, the comprehensive load index satisfies the following formula (1):

[0150]

[0151] wherein, CLI represents the comprehensive load index, t0 and t1 are respectively the start time and end time corresponding to the target time period, P(t) represents the load value of the server node at time point t among multiple time points, and R represents the current load value corresponding to the server node;

[0152] The processing unit 502 is further configured to determine the second prediction information according to the comprehensive load index corresponding to each of the multiple server nodes.

[0153] In some implementation manners, the first allocation scheme includes: allocating the tasks to be allocated to the current server node in descending order of the comprehensive load index corresponding to each of the multiple server nodes until the load of the current server node is greater than the threshold load, and then allocating the tasks to be allocated to the next server node.

[0154] In some implementation manners, the processing unit 502 is further configured to determine n candidate allocation schemes when the load balancing degree corresponding to the first allocation scheme is lower than a preset threshold; each candidate allocation scheme among the n candidate allocation schemes is respectively used to indicate a scheme for allocating m tasks to be allocated to the server nodes;

[0155] The processing unit 502 is further configured to use the n candidate allocation schemes as the initial population and determine the second allocation scheme with the highest fitness by using a genetic algorithm;

[0156] wherein, in the genetic algorithm, the fitness of each candidate allocation scheme is used to indicate the load balancing degree of the multiple server nodes corresponding to the candidate allocation scheme within the target time period; wherein, the load balancing degree of the multiple server nodes within the target time period is determined according to the first prediction information and the detected current load corresponding to each of the multiple server nodes;

[0157] The processing unit 502 is further configured to allocate the m tasks to be allocated to the multiple servers based on the second allocation scheme.

[0158] In some implementation manners, the processing unit 502 is further configured to detect the running states of the multiple server nodes;

[0159] The processing unit 502 is further configured to generate a fault log when it detects that a fault occurs in the multiple server nodes; the fault log at least includes the location and time of the server node corresponding to the fault.

[0160] In some implementations, the state prediction model is a neural network model trained by using the first sample set as the training set and the second sample set as the validation set; wherein, the first sample set and the second sample set respectively include a plurality of training samples, and a training sample includes the load corresponding to a server node at a plurality of adjacent historical time points; wherein, the time corresponding to the training samples included in the first sample set is earlier than the time corresponding to the training samples included in the second sample set.

[0161] The task allocation device 50 provided in the embodiments of the present application can execute the methods provided in any of the above embodiments, and the implementation principles and technical effects are similar, which will not be elaborated here.

[0162] The embodiments of the present application also provide an electronic device, as Figure 9 shown, the electronic device includes a memory 601 and a processor 602. A computer program is stored in the memory 601, and the processor 602 is configured to run the computer program to execute the steps in the embodiments of the above-mentioned permission detection method of any software product.

[0163] The embodiments of the present application also provide a computer-readable storage medium, in which a computer program is stored. Wherein, the computer program is configured to execute the steps in the embodiments of the above-mentioned permission detection method of any software product when running.

[0164] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drives, read-only memories (ROM for short), random access memories (RAM for short), mobile hard disks, magnetic disks, or optical disks and other various media that can store computer programs.

[0165] The embodiments of the present application also provide a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, the steps in the embodiments of the above-mentioned permission detection method of any software product are implemented.

[0166] The embodiments of the present application also provide another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the embodiments of the above-mentioned permission detection method of any software product are implemented.

[0167] Those skilled in the art may further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0168] The above has introduced in detail a method and device for detecting the permissions of a software product provided by this application. Specific examples are used herein to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art of this technology, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A task allocation method, characterized in that Including: Obtain m tasks to be assigned; The m tasks to be assigned are tasks to be run within a target time period, and m is a positive integer; Determine first prediction information corresponding to the target time period according to the historical load information of multiple server nodes; The first prediction information is used to indicate the loads of the multiple server nodes at multiple time points within the target time period; Determine second prediction information according to the first prediction information and the current loads corresponding to the multiple server nodes respectively; the second prediction information is used to indicate the overall load status of the multiple server nodes within the target time period; Determine a first allocation plan according to the second prediction information; The first allocation plan is used to indicate: the server nodes respectively assigned to the m tasks to be assigned; Allocate the m tasks to be assigned to the multiple server nodes based on the first allocation plan.

2. The method according to claim 1, wherein The determining the first prediction information corresponding to the target time period according to the historical load information of multiple server nodes includes: Use a state prediction model to determine the first prediction information corresponding to the target time period; the state prediction model is a neural network model for predicting the load of a server node trained using the historical load information of the multiple server nodes.

3. The method according to claim 1, wherein The determining the second prediction information according to the first prediction information and the current loads corresponding to the multiple server nodes respectively includes: Determine the comprehensive load indexes corresponding to the multiple server nodes respectively according to the first prediction information and the current loads corresponding to the multiple server nodes respectively; wherein, the comprehensive load index satisfies the following formula one: Wherein, CLI represents the comprehensive load index, t0 and t1 are respectively the start time and end time corresponding to the target time period, P(t) represents the value of the load of the server node at time point t among the multiple time points, and R represents the value of the current load corresponding to the server node; Determine the second prediction information according to the comprehensive load indexes corresponding to the multiple server nodes respectively.

4. The method according to claim 3, wherein The first allocation plan includes: allocating the tasks to be assigned to the current server node in descending order of the comprehensive load indexes corresponding to the multiple server nodes respectively until the load of the current server node is greater than the threshold load, and then allocating the tasks to be assigned to the next server node.

5. The method according to claim 1, wherein The method further includes: When the load balancing degree corresponding to the first allocation plan is lower than a preset threshold, determine n candidate allocation plans; each candidate allocation plan among the n candidate allocation plans is respectively used to indicate: a plan for allocating the m tasks to be assigned to server nodes; Use the n candidate allocation plans as an initial population and use a genetic algorithm to determine a second allocation plan with the highest fitness; Among them, in the genetic algorithm, the fitness of each candidate allocation scheme is used to indicate: the load balancing degree of the corresponding multiple server nodes of the candidate allocation scheme during the target time period; among them, the load balancing degree of the multiple server nodes during the target time period is determined according to the first prediction information and the currently detected loads corresponding to the multiple server nodes respectively. Based on the second allocation scheme, allocate the m tasks to be allocated to the multiple servers.

6. The method according to claim 1, wherein The method further includes: Detect the operating status of the multiple server nodes. After detecting that the multiple server nodes fail, generate a fault log; the fault log at least includes the location and time of the server node corresponding to the fault.

7. The method according to claim 2, wherein The state prediction model is a neural network model trained using a first sample set as the training set and a second sample set as the validation set; among them, both the first sample set and the second sample set include multiple training samples, and one training sample includes the loads corresponding to a server node at multiple adjacent historical time points; among them, the time corresponding to the training samples included in the first sample set is earlier than the time corresponding to the training samples included in the second sample set.

8. A task allocation device, characterized in that, It includes: An acquisition unit for acquiring m tasks to be allocated. The m tasks to be allocated are tasks to be run during the target time period, and m is a positive integer. A processing unit for determining first prediction information corresponding to the target time period according to the historical load information of multiple server nodes; the first prediction information is used to indicate the loads of the multiple server nodes at multiple time points during the target time period. The processing unit is further used to determine second prediction information according to the first prediction information and the currently detected loads corresponding to the multiple server nodes respectively; the second prediction information is used to indicate the overall load status of the multiple server nodes during the target time period. The processing unit is further used to determine a first allocation scheme according to the second prediction information; the first allocation scheme is used to indicate: the server nodes allocated to the m tasks to be allocated respectively. Based on the first allocation scheme, allocate the m tasks to be allocated to the multiple server nodes.

9. An electronic device, characterized in that, It includes: A memory for storing a computer program. A processor for implementing the steps of the task allocation method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the task allocation method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Server task allocation method and device, electronic equipment and storage medium

    CN120762919A

  • Server task allocation methods, devices, electronic equipment, and storage media

    CN120762919B