Task scheduling method, device, terminal and storage medium

By introducing task processing nodes into the distributed system, the sequential scheduling of tasks is solved, and the system instability caused by the scheduling center under high tasks is improved, and the system stability and task scheduling efficiency are improved.

CN114896043BActive Publication Date: 2025-05-09ENVISION DIGITAL INT PTE LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210554622.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-20
Publication Date
2025-05-09
Estimated Expiration
2042-05-20

AI Technical Summary

Technical Problem

In distributed systems, the dispatching center needs to perform a large amount of calculations and data transmission when the task volume is large, resulting in system instability.

Method used

By introducing a task processing node into the distributed system, the task processing node receives scheduling information, pulls the assigned tasks based on the scheduling information, and sends the scheduling information to the next task processing node when the task pull results meet the conditions, realizing sequential scheduling of tasks.

Benefits of technology

This solution avoids system instability caused by the scheduling center's separate processing of task calculations and allocations, improves the stability of the distributed system, and maintains the efficiency of task scheduling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114896043B_ABST
    Figure CN114896043B_ABST
Patent Text Reader

Abstract

The present application is about a task scheduling method, device, terminal and storage medium, and relates to the field of distributed system technology. The method comprises: receiving scheduling information; the scheduling information is used to indicate the tasks assigned to each node in the node sequence; the node sequence includes at least two of the task processing nodes including the first node; according to the scheduling information, pulling the task assigned to the first node; in response to the task pulling result satisfying the scheduling information transmission condition, sending the scheduling information to the next task processing node in the node sequence, thereby ensuring the efficiency of task scheduling while improving the stability of the distributed system. It avoids the system instability caused by a large number of remote calls through the scheduling center in a short period of time when only the scheduling center performs task calculation and allocation, thereby improving the stability of the distributed system while ensuring the efficiency of task scheduling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of distributed systems, and in particular to a task scheduling method, device, terminal and storage medium. Background Art

[0002] At present, an independent scheduling center system is usually established in a distributed system to manage the tasks registered to the task center and to trigger the scheduling of tasks at a fixed time.

[0003] In the related art, the dispatch center calculates the amount of tasks to be executed, distributes the tasks to each node in the cluster according to the calculated amount of tasks, and each node runs the received tasks.

[0004] However, when performing task scheduling using the above method, the task calculation and allocation processes are all executed by the scheduling center. When the task volume is large, the scheduling center needs to perform a large amount of calculation and data transmission. Therefore, a large number of remote calls through the scheduling center in a short period of time may cause system instability. Summary of the invention

[0005] The embodiment of the present application provides a task scheduling method, device, terminal and storage medium, which can improve the stability of the task scheduling system. The technical solution is as follows:

[0006] In one aspect, a task scheduling method is provided, the method being executed by a first node in a distributed system, the distributed system comprising a scheduling center and a plurality of task processing nodes, the first node being one of at least two of the task processing nodes; the method comprising:

[0007] Receiving scheduling information; the scheduling information is used to indicate the tasks assigned to each node in the node sequence; the node sequence includes at least two of the task processing nodes including the first node;

[0008] Pulling the task assigned to the first node according to the scheduling information;

[0009] In response to the task pulling result satisfying the scheduling information transmission condition, the scheduling information is sent to the next task processing node in the node sequence.

[0010] In a possible implementation, in response to the task pulling result satisfying the scheduling information transmission condition, sending the scheduling information to the next task processing node in the node sequence includes:

[0011] In response to there being remaining unpulled tasks after pulling the tasks assigned to the first node, the scheduling information is sent to the next task processing node in the node sequence.

[0012] In a possible implementation, the scheduling information includes an estimated task load of each node in the node sequence;

[0013] The pulling, according to the scheduling information, the task assigned to the first node includes:

[0014] Determine the number of tasks to be allocated to the first node according to the estimated task carrying capacity of the first node in the scheduling information;

[0015] Based on the number of tasks assigned to the first node, the tasks assigned to the first node are pulled.

[0016] In a possible implementation, the scheduling information further includes an index identifier of the task to be currently pulled;

[0017] Pulling the task assigned to the first node based on the number of tasks assigned to the first node includes:

[0018] Tasks are pulled starting from the task corresponding to the index identifier until tasks equal to the number of tasks allocated to the first node are pulled, or until there are no remaining tasks that have not been pulled.

[0019] In a possible implementation, in response to the task pulling result satisfying the scheduling information transmission condition, sending the scheduling information to the next task processing node in the node sequence includes:

[0020] In response to the task pulling result satisfying the scheduling information transmission condition, after updating the index identifier of the current task to be pulled in the scheduling information according to the task pulling result, the scheduling information is sent to the next task processing node in the node sequence.

[0021] In one aspect, a task scheduling method is provided, the method being executed by a scheduling center in a distributed system, the distributed system further comprising a plurality of task processing nodes, the method comprising:

[0022] Acquire node information of a plurality of the task processing nodes; the node information is used to indicate the survival status of the task processing nodes;

[0023] According to the node information of the plurality of task processing nodes, at least two of the task processing nodes are selected from the plurality of task processing nodes to form a node sequence;

[0024] Generate scheduling information; the scheduling information is used to indicate the tasks assigned to each node in the node sequence;

[0025] The scheduling information is sent to the first task processing node in the node sequence so that each task processing node in the node sequence pulls tasks according to the scheduling information, and when the task pulling result meets the scheduling information transmission condition, the scheduling information is sent to the next task processing node in the node sequence.

[0026] On the other hand, a task scheduling device is provided, the device is used in a first node in a distributed system, the distributed system includes a scheduling center and a plurality of task processing nodes, the first node is one of at least two of the task processing nodes; the device includes:

[0027] A scheduling receiving module, used for receiving scheduling information; the scheduling information is used for indicating the tasks respectively assigned to each node in the node sequence; the node sequence includes at least two of the task processing nodes including the first node;

[0028] A task pulling module, used to pull the task assigned to the first node according to the scheduling information;

[0029] The scheduling sending module is used to send the scheduling information to the next task processing node in the node sequence in response to the task pulling result satisfying the scheduling information transmission condition.

[0030] In a possible implementation, the scheduling sending module includes:

[0031] The first sending submodule is configured to send the scheduling information to a next task processing node in the node sequence in response to there being remaining unpulled tasks after pulling the tasks assigned to the first node.

[0032] In a possible implementation, the scheduling information includes an estimated task load of each node in the node sequence;

[0033] The task pulling module includes:

[0034] a quantity determination submodule, configured to determine the number of tasks to be allocated to the first node according to the estimated task carrying capacity of the first node in the scheduling information;

[0035] The pulling submodule is used to pull the tasks allocated to the first node based on the number of tasks allocated to the first node.

[0036] In a possible implementation, the scheduling information further includes an index identifier of the task to be currently pulled;

[0037] The pulling submodule includes:

[0038] The pulling unit is used to pull tasks starting from the tasks corresponding to the index identifier until tasks equal to the number of tasks allocated to the first node are pulled, or until there are no remaining tasks that have not been pulled.

[0039] In a possible implementation, the scheduling sending module includes:

[0040] The second sending submodule is used to respond to the task pulling result satisfying the scheduling information transmission condition, update the index identifier of the current task to be pulled in the scheduling information according to the task pulling result, and then send the scheduling information to the next task processing node in the node sequence.

[0041] On the other hand, a task scheduling device is provided, the device is used in a scheduling center in a distributed system, the distributed system also includes a plurality of task processing nodes, the device includes:

[0042] An information acquisition module, used to acquire node information of a plurality of the task processing nodes; the node information is used to indicate the survival status of the task processing nodes;

[0043] A sequence generation module, used for selecting at least two of the task processing nodes from the plurality of task processing nodes according to the node information of the plurality of task processing nodes, to form a node sequence;

[0044] A scheduling generation module, used to generate scheduling information; the scheduling information is used to indicate the tasks assigned to each node in the node sequence;

[0045] A scheduling transmission module is used to send the scheduling information to the first task processing node in the node sequence, so that each task processing node in the node sequence pulls tasks according to the scheduling information, and when the task pulling result meets the scheduling information transmission condition, the scheduling information is sent to the next task processing node in the node sequence.

[0046] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the above-mentioned task scheduling method.

[0047] On the other hand, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the above-mentioned task scheduling method.

[0048] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the task scheduling method provided in the above various optional implementations.

[0049] The technical solution provided by this application may have the following beneficial effects:

[0050] Each task processing node pulls its assigned task through the received scheduling information. When each task processing node determines that the scheduling information transmission conditions are met after the task is pulled, it sends the scheduling information to the next task processing node, thereby realizing the scheduling process of each task processing node in sequence according to the node sequence. Through the above scheme, it is possible to avoid the system instability caused by a large number of remote calls made by the scheduling center in a short period of time when only the scheduling center performs task calculation and allocation, thereby improving the stability of the distributed system while ensuring the efficiency of task scheduling. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0052] Figure 1 An exemplary embodiment of the present application shows a schematic diagram of the structure of a distributed system;

[0053] Figure 2 A flowchart of a task scheduling method shown in an exemplary embodiment of the present application is shown;

[0054] Figure 3 A flowchart of a task scheduling method shown in an exemplary embodiment of the present application is shown;

[0055] Figure 4 A flowchart of a task scheduling method shown in another exemplary embodiment of the present application is shown;

[0056] Figure 5 yes Figure 4 A task scheduling flow chart related to the illustrated embodiment;

[0057] Figure 6 yes Figure 4 A schematic diagram of determining a surviving node involved in the illustrated embodiment;

[0058] Figure 7 yes Figure 4 The illustrated embodiment is a schematic diagram of a second round of task allocation required;

[0059] Figure 8 yes Figure 4 A schematic diagram of task pulling and running involved in the illustrated embodiment;

[0060] Fig. 9 yes Figure 4 A schematic diagram of a task amount estimation involved in the illustrated embodiment;

[0061] Fig.10 A block diagram of a task scheduling device shown in an exemplary embodiment of the present application is shown;

[0062] Fig.11 A block diagram of a task scheduling device shown in an exemplary embodiment of the present application is shown;

[0063] Fig.12 A structural block diagram of a computer device shown in an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

[0064] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0065] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0066] Figure 1It is a structural diagram of a distributed system according to an exemplary embodiment. The distributed system includes: a scheduling center 120 and at least two task processing nodes 140. At least two task processing nodes 140 are used to execute the task scheduling method of the present application. The scheduling center 120 can generate scheduling information for task allocation. After generating the initial scheduling information, the scheduling center 120 sends the scheduling information to any task processing node 140, so that the task processing node 140 that receives the scheduling information can obtain the assigned task according to the scheduling information, and send the updated scheduling information to the next task processing node 140, so that the next task processing node 140 can obtain the assigned task according to the received scheduling information and continue to transmit the scheduling information downward until the task to be assigned is assigned and stops transmitting the scheduling information, and each task processing node 140 runs its assigned task, thereby completing the process of scheduling and running the task.

[0067] Among them, the dispatch center 120 can be a server. In some scenarios, the dispatch center can be called a central server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The distributed system also includes a target database and other edge nodes. The target database can transmit data with the dispatch center 120 and each edge node. When the edge node is started, the edge node will register in the target database, so that the target database can perceive the surviving nodes in the distributed system and obtain the node information of each surviving node.

[0068] Exemplarily, the target database may be a registration center, a CMDB configuration management database, and a prometheus monitoring system (including a time series database).

[0069] The task processing node 140 may be a terminal, which may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The dispatch center 120 and the task processing node 140 may be directly or indirectly connected via wired or wireless communication, and this application does not limit this.

[0070] Optionally, the system may also include a management device ( Figure 1 (not shown), the management device is connected to the dispatch center 120 via a communication network. Optionally, the communication network is a wired network or a wireless network.

[0071] Optionally, the above-mentioned wireless network or wired network uses standard communication technology and / or protocol. The network is usually the Internet, but it can also be any network, including but not limited to any combination of local area network (LAN), metropolitan area network (MAN), wide area network (WAN), mobile, wired or wireless network, private network or virtual private network. In some embodiments, the data exchanged through the network is represented by technology and / or format including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technology can also be used to replace or supplement the above-mentioned data communication technology.

[0072] Figure 2 is a flowchart of a task scheduling method according to an exemplary embodiment. The task scheduling method can be executed by a first node in a distributed system. The first node can be the above Figure 1 The task processing node 140 is shown in the system. Figure 2 As shown, the task scheduling method may include the following steps:

[0073] In step 201, scheduling information is received; the scheduling information is used to indicate the tasks assigned to each node in the node sequence; the node sequence includes at least two task processing nodes including the first node.

[0074] In an embodiment of the present application, the first node receives scheduling information sent by a scheduling center or sent by other task processing nodes. The first node is one of at least two task processing nodes.

[0075] In one possible implementation, when the first node is the first task processing node in the node sequence, the first node receives scheduling information directly sent by the scheduling center; when the first node is not the first task processing node in the node sequence, and the first node is the i-th task processing node in the node sequence, the first node receives scheduling information sent by the task processing node at the i-1 position in the node sequence.

[0076] Step 202: Pull the task assigned to the first node according to the scheduling information.

[0077] In an embodiment of the present application, the first node pulls the assigned task according to the task assigned to the first node by the scheduling center indicated by the received scheduling information.

[0078] In a possible implementation, in response to the first node receiving the scheduling information, the task assigned to the first node is determined based on the scheduling information; the scheduling information is generated by the scheduling center and is used to determine the tasks assigned to each target node.

[0079] Among them, a task is used to indicate a functional module provided by a system in a distributed cluster to achieve a specific business goal. It can be a separate microservice, a piece of business logic code, or a script. Scheduling is used to indicate the action of triggering or calling a task at a specified time period or a specified time point. A node can be used to indicate a single instance running in a distributed system.

[0080] In one possible implementation, in response to the estimated task capacity of each node in the node sequence contained in the scheduling information; the number of tasks allocated to the first node is determined according to the estimated task capacity of the first node in the scheduling information; and based on the number of tasks allocated to the first node, the tasks allocated to the first node are pulled.

[0081] In another possible implementation, in response to the scheduling information also including the index identifier of the task currently to be pulled; the first node starts pulling tasks from the task corresponding to the index identifier until it pulls the number of tasks allocated to the first node, or until there are no remaining tasks that have not been pulled.

[0082] Step 203: In response to the task pulling result satisfying the scheduling information transmission condition, the scheduling information is sent to the next task processing node in the node sequence.

[0083] In an embodiment of the present application, after the first node pulls the corresponding task according to the scheduling information, the first node determines whether the task pulling result meets the scheduling information transmission condition, and can send the scheduling information to the task processing node located next to the first node in the node sequence.

[0084] In one possible implementation, in response to the sum of the number of tasks assigned to the first node and the tasks pulled by other task processing nodes that have already pulled tasks before the first node in the node sequence being less than the total number of tasks to be assigned, and there are other task processing nodes in the node sequence that have not pulled tasks, scheduling information is sent to the next task processing node in the node sequence.

[0085] That is to say, when the i-th task processing node in the node sequence obtains the task assigned to it based on the received scheduling information, and determines that there are still remaining tasks that have not been pulled, it determines the next task processing node based on the node sequence, that is, the i+1-th task processing node, and sends the scheduling information to the i+1-th task processing node.

[0086] In a possible implementation, the first node determines the maximum number of tasks assigned by the first node each time and the number of currently unassigned tasks based on the scheduling information, and determines the number of tasks that need to be assigned to the next task processing node.

[0087] That is to say, when the number of currently unassigned tasks is less than or equal to the maximum number of tasks that can be assigned to the task processing node each time, all currently unassigned tasks can be assigned to the task processing node, and the task allocation is ended at the same time; when the number of currently unassigned tasks is greater than the maximum number of tasks that can be assigned to the task processing node each time, tasks are obtained from the currently unassigned tasks according to the maximum number of tasks assigned each time and assigned to the task processing node.

[0088] In a possible implementation, in response to there being remaining unpulled tasks after pulling the tasks assigned to the first node, scheduling information is sent to the next task processing node in the node sequence.

[0089] In a possible implementation, in response to the task pulling result satisfying the scheduling information transmission condition, after updating the index identifier of the current task to be pulled in the scheduling information according to the task pulling result, the scheduling information is sent to the next task processing node in the node sequence.

[0090] To summarize, each task processing node pulls its assigned task through the received scheduling information. When each task processing node determines that the scheduling information transmission conditions are met after the task is pulled, it sends the scheduling information to the next task processing node, thereby realizing the scheduling process of each task processing node in sequence according to the node sequence. Through the above scheme, the system instability caused by a large number of remote calls through the scheduling center in a short period of time when only the scheduling center performs task calculation and allocation can be avoided, thereby improving the stability of the distributed system while ensuring the efficiency of task scheduling.

[0091] Figure 3 is a flowchart of a task scheduling method according to an exemplary embodiment. The task scheduling method can be executed by a scheduling center in a distributed system. The scheduling center can be the above Figure 1 In the system shown, the dispatch center 120 is shown. Figure 3 As shown, the task scheduling method may include the following steps:

[0092] Step 301, obtaining node information of a number of task processing nodes; the node information is used to indicate the survival status of the task processing nodes.

[0093] Step 302 : Select at least two task processing nodes from the task processing nodes according to the node information of the task processing nodes to form a node sequence.

[0094] Step 303, generating scheduling information; the scheduling information is used to indicate the tasks assigned to each node in the node sequence.

[0095] Step 304, sending the scheduling information to the first task processing node in the node sequence, so that each task processing node in the node sequence pulls tasks according to the scheduling information, and when the task pulling result meets the scheduling information transmission condition, sends the scheduling information to the next task processing node in the node sequence.

[0096] To summarize, each task processing node pulls its assigned task through the received scheduling information. When each task processing node determines that the scheduling information transmission conditions are met after the task is pulled, it sends the scheduling information to the next task processing node, thereby realizing the scheduling process of each task processing node in sequence according to the node sequence. Through the above scheme, the system instability caused by a large number of remote calls through the scheduling center in a short period of time when only the scheduling center performs task calculation and allocation can be avoided, thereby improving the stability of the distributed system while ensuring the efficiency of task scheduling.

[0097] Figure 4 is a flowchart of a task scheduling method according to another exemplary embodiment. The task scheduling method can be applied to a distributed system and is interactively executed by a scheduling center and a task processing node. The scheduling center can be the above Figure 1 The dispatch center 120 in the system shown in the figure can be the above-mentioned task processing node Figure 1 The task processing node 140 is shown in the system. Figure 4 As shown, the task scheduling method may include the following steps:

[0098] In step 401, in response to the i-th task processing node in the node sequence receiving scheduling information, the i-th task processing node pulls the corresponding task based on the scheduling information.

[0099] In an embodiment of the present application, when the i-th task processing node in the node sequence receives scheduling information, the i-th task processing node determines the task assigned to itself for execution based on the received scheduling information.

[0100] Among them, the task processing node is a node that supports task processing; the i-th task processing node is the i-th task processing node in the order of the node sequence; i is a positive integer greater than or equal to 1; the scheduling information is generated by the scheduling center, and the scheduling information can be used to determine the tasks assigned to each task processing node.

[0101] In a possible implementation, the i-th task processing node receives scheduling information, and based on the scheduling information, determines the task assigned to the i-th task processing node, with the following steps: in response to the first task processing node receiving scheduling information from the scheduling center, based on the scheduling information, determines the task assigned to the first task processing node. In response to the j-th task processing node receiving scheduling information from the j-1-th task processing node, based on the scheduling information, determines the task assigned to the j-th task processing node.

[0102] That is to say, after the scheduling center generates the scheduling information, it determines one of the task processing nodes as the first task processing node according to the node sequence. The scheduling center sends the generated scheduling information to the determined first task processing node. The first task processing node receives the scheduling information, analyzes the scheduling information, and determines the task assigned to the first task processing node.

[0103] Here, j can be a positive integer greater than or equal to 2.

[0104] That is to say, after the first task processing node pulls the tasks assigned to it, if there are still tasks that have not been pulled, the scheduling information will be passed among the task processing nodes, so that the subsequent task processing nodes will pull the tasks assigned to them in sequence according to the order of the node sequence until all tasks are pulled.

[0105] In a possible implementation, the scheduling information includes a scheduling instruction, node information of each task processing node, an estimated task load of each task processing node, and an index identifier corresponding to the task currently to be pulled.

[0106] The scheduling instruction is used to notify the task processing node to start task allocation; the node information of each task processing node is information determined by the scheduling center querying the target database, and the node information of the task processing node is used to determine each task processing node that supports task allocation. The node information may include a node sequence.

[0107] Exemplarily, the scheduling information generated by the scheduling center, that is, the scheduling information received by the first task processing node, includes scheduling instructions, node information of each task processing node, estimated task carrying capacity of each task processing node, and index identifier corresponding to the task currently to be pulled. Since no task pulling has been completed at this time, the index identifier corresponding to the task currently to be pulled is the index identifier of all tasks to be pulled. For example, all tasks to be pulled are from task 1 to task 100, then the index identifier corresponding to the task currently to be pulled is 1-100.

[0108] In one possible implementation, the first task processing node receives scheduling information, starts task pulling based on the scheduling instructions, and determines whether the estimated task carrying capacity of the task processing node is less than the total number of tasks (the total number of tasks is the number of all tasks to be pulled). If the estimated task carrying capacity of the task processing node is less than the total number of tasks, it is determined that the number of tasks allocated by the first task processing node is the estimated task carrying capacity of the task processing node, and the assigned task index identifier is determined according to the index identifier corresponding to the current task to be pulled.

[0109] For example, the estimated task carrying capacity of the task processing node is 100,000, the total number of tasks is 1,000,000, the index identifier corresponding to the current task to be assigned is 1-1,000,000, and the index identifier of the task to be assigned can be 1-100,000.

[0110] In one possible implementation, the j-th task processing node receives scheduling information, starts task allocation based on the scheduling instruction, and determines whether the estimated task carrying capacity of the task processing node is less than the total number of tasks currently remaining. If the estimated task carrying capacity of the task processing node is less than the total number of tasks currently remaining, then it is determined that the number of tasks allocated by the j-th task processing node is the estimated task carrying capacity of the task processing node, and the assigned task index identifier is determined according to the index identifier corresponding to the current task to be assigned.

[0111] For example, the estimated task carrying capacity of the task processing node is 100,000, and the total number of tasks is 1,000,000. For the second task processing node, the index identifier corresponding to the current task to be pulled is 100,000-1,000,000, and the determined assigned task index identifier can be 100,001-200,000.

[0112] In one possible implementation, the scheduling center obtains node information of several task processing nodes; the node information is used to indicate the survival status of the task processing nodes; according to the node information of the several task processing nodes, at least two task processing nodes are selected from the several task processing nodes to form a node sequence; scheduling information is generated; the scheduling information is sent to the first task processing node in the node sequence, so that each task processing node in the node sequence pulls tasks according to the scheduling information, and when the task pulling result meets the scheduling information transmission condition, the scheduling information is sent to the next task processing node in the node sequence.

[0113] In a possible implementation manner, the target database includes surviving nodes in the current distributed system and node information of the surviving nodes.

[0114] The task processing nodes are selected by the scheduling center from the surviving nodes according to a target ratio, and the target ratio is pre-configured or determined based on feedback information from the task processing nodes.

[0115] In a possible implementation, the dispatch center initiates cluster node liveness detection, senses the surviving nodes in the system through the target database, sets a node ratio, and obtains surviving nodes above the node ratio as task processing nodes.

[0116] If the number of live nodes sensed by the target database is N and the configured node ratio is p, the number of task processing nodes n can be calculated by the following formula:

[0117] n=CEIL(N*p)

[0118] Among them, CEIL() refers to a function that takes an integer.

[0119] For example, Figure 5 This is a task scheduling flow chart involved in the embodiment of the present application. Figure 5 As shown, the scheduling center and each task processing node scheduling task that can maintain load balance include the following steps:

[0120] S51, the scheduling center selects a surviving node as a task processing node.

[0121] S52, randomly select a task processing node from n task processing nodes, and the scheduling center sends scheduling information to the task processing node. The scheduling information includes scheduling instructions, node information of the selected n task processing nodes, the estimated single-node task load m, and the current maximum identity of the retrieved task, which defaults to 0.

[0122] S53, the task processing node that receives the scheduling instruction attempts to obtain m tasks and determines whether the total number of tasks M is greater than m.

[0123] S54, if the total number of tasks M is greater than m, the information in S52 is sent to the next task processing node among the n task processing nodes, and the next task processing node sequentially executes the above steps until the task allocation is completed. The number of RPC calls T can be calculated by the following formula:

[0124] T=CEIL(M / m)

[0125] In a possible implementation, the surviving nodes in the target database awareness system are determined by querying whether the target database contains registration information of the nodes.

[0126] Among them, the target database can be a registration center, a CMDB configuration management database, and a prometheus monitoring system (including a time series database).

[0127] For example, when each node is started, it can register its own information to the registration center and continue to maintain the connection between the node and the registration center. The registration center can be responsible for managing node information. When a new connection is created, the node information corresponding to the new connection is added, and when the connection is lost, the corresponding node information is deleted. When initiating task scheduling, the scheduling center can query the registration center to obtain a list of node survival based on the application name.

[0128] For example, Figure 6 Schematic diagram of determining a surviving node involved in an embodiment of the present application. Figure 6 As shown, the scheduling center 61 queries the list of surviving nodes in the registration center, CMDB configuration management database or prometheus monitoring system (including the time series database) to determine the surviving nodes in the current cluster. There is a connection between nodes 1, 2 and 3 in the cluster and the registration center, CMDB configuration management database or prometheus monitoring system, so the registration center, CMDB configuration management database or prometheus monitoring system includes node information corresponding to nodes 1, 2 and 3. When node 4 starts to establish a connection with the registration center, CMDB configuration management database or prometheus monitoring system, the node information corresponding to node 4 is added to the registration center, CMDB configuration management database or prometheus monitoring system. The nodes with node information in the registration center, CMDB configuration management database or prometheus monitoring system constitute the surviving node list.

[0129] In one possible implementation, for relatively stable clusters, the number of selected task processing nodes is configured in advance in the scheduling center, without the need to connect to the registration center to sense surviving nodes. For non-system scheduling tasks, such as script calls or batch sending and executing shell commands, surviving nodes are not sensed, and the nodes that need to be sent are configured in the scheduling center.

[0130] In step 402, in response to the fact that the sum of the numbers of tasks pulled by the task processing nodes that have currently pulled tasks is less than the total number of tasks to be pulled, and the node sequence also includes task processing nodes that have not pulled tasks, the task processing node that is currently pulling tasks sends scheduling information to the next task processing node according to the node sequence.

[0131] In one possible implementation, when the task to be pulled has not been pulled completely, the task processing node that will pull the task next is determined based on the node information of the task processing node in the scheduling information, and the updated scheduling information is sent to the next task processing node, which continues to pull its assigned tasks based on the received scheduling information.

[0132] In step 403, in response to the sum of the number of tasks pulled by each task processing node in the node sequence being less than the total number of tasks to be pulled, remaining tasks are determined.

[0133] In an embodiment of the present application, after all task processing nodes have pulled corresponding tasks according to the estimated task load of the task processing nodes in the scheduling information, if there are still remaining tasks that have not been pulled, the remaining tasks are determined by the task processing node that pulled the tasks last in this round.

[0134] The remaining tasks are tasks other than the tasks that have been pulled from the tasks to be pulled.

[0135] For example, Figure 7 Schematic diagram of a second round of task pulling required in an embodiment of the present application. Figure 7 As shown, when the total number of tasks is 30,000, and the task processing nodes in the cluster only include node 1 and node 2, and the estimated task carrying capacity of a single node in the scheduling information is 10,000, a round of task allocation is performed through step 302, which can include first node 1 performing task retrieval to obtain 10,000 tasks, and the corresponding task index identifiers are 1-10,000, and then node 2 performing task retrieval to obtain 10,000 tasks, and the corresponding task index identifiers are 10,001-20,000. After a round of task allocation, it is determined that there are remaining tasks, and the number of remaining tasks is 10,000. At the same time, it can also be determined that the index identifiers of the remaining tasks are 20,001-30,000.

[0136] In step 404, each task processing node pulls the remaining tasks in sequence according to the node sequence.

[0137] In the embodiment of the present application, when performing the second round of task allocation, the remaining tasks may be pulled by at least one of the task processing nodes.

[0138] In a possible implementation, the remaining tasks obtained are evenly divided, and each task processing node pulls the equally divided remaining tasks according to the order in which the task processing nodes in the first round of task allocation assign tasks, that is, the order of the node sequence.

[0139] Exemplarily, when the total number of tasks is 30,000 and the cluster includes 2 task processing nodes, the estimated task carrying capacity of each task processing node is 10,000, it can be determined that there are remaining tasks after the first round of task allocation, and the number of remaining tasks is 10,000. The last task processing node that performs task allocation in the first round calculates the remaining tasks after equal division, that is, each task processing node needs to carry 5,000 tasks in the second round of task allocation, and the task index identifier carried by the first task processing node in the second round of task allocation is 20,001-25,000, and the task index identifier carried by the second task processing node is 25,001-30,000.

[0140] In a possible implementation, the obtained number of remaining tasks is compared with the estimated task carrying capacity of each task processing node. When the number of remaining tasks is less than the estimated task carrying capacity of each task processing node, the remaining number of tasks is directly allocated to the first task processing node. If the number of remaining tasks is greater than the estimated task carrying capacity of each task processing node, the number of remaining tasks is divided by the estimated task carrying capacity of each task processing node, and the task processing nodes that need to carry tasks in the second round are obtained according to the order of task allocation of the task processing nodes in the first round, and the remaining tasks are allocated to the task processing nodes in sequence.

[0141] Exemplarily, when the total number of tasks is 35,000 and the cluster includes 2 task processing nodes, the estimated task carrying capacity of each task processing node is 10,000, it can be determined that there are remaining tasks after the first round of task allocation, and the number of remaining tasks is 10,000. The last task processing node that performs task allocation in the first round calculates the task processing node that needs to perform task allocation in the next round, that is, the first task processing node needs to carry 10,000 tasks in the second round of task allocation, and the task index identifier carried by the first task processing node during the second round of task allocation is 20,001-30,000, the second task processing node needs to carry 5,000 tasks in the second round of task allocation, and the task index identifier carried by the second task processing node during the second round of task allocation is 30,001-35,000.

[0142] In a possible implementation, task pulling and task running may be asynchronous, that is, the task processing node may start running the task after acquiring the assigned task.

[0143] In a possible implementation, a task processing node includes several threads for executing tasks.

[0144] Among them, in the same task processing node, tasks can be processed in parallel by several threads at the same time, thereby improving the efficiency of task processing.

[0145] For example, Figure 8 Schematic diagram of a task pull and operation involved in the embodiment of the present application. Figure 8 As shown, when the total number of tasks is 1,000,000, and the cluster includes 20 nodes, and the estimated task load of a single node in the scheduling information is 100,000, the node selection ratio is 0.5. Step 402 is used to pull tasks, which can include firstly determining that the scheduling center has 10 task processing nodes based on the node selection ratio and the nodes in the cluster, namely nodes 1 to 10, and node 1 performs task retrieval to obtain 10,000 tasks and executes them, and the corresponding task index is identified as 1-100,000, and then tasks are retrieved and executed for nodes 2 to 10 in turn based on the same steps. The number of RPC calls between nodes for task allocation through the above steps is 10 times. If it is assumed that the execution time of a single task is 100ms, and each task processing node processes tasks in parallel through 5 threads, the overall estimated task execution time is 2000s.

[0146] In step 405, in response to the reporting interface of the scheduling center being integrated on the task processing node; in response to the task processing node completing the tasks pulled by each node, feedback information is sent to the scheduling center.

[0147] The feedback information includes the number of completed tasks and the running time.

[0148] In a possible implementation, the task processing node is additionally integrated with the reporting interface of the scheduling center. After the task is completed, the task processing node reports the number of tasks and the running time to the scheduling center. The scheduling center obtains the reported information, calculates the ideal number of task processing nodes based on the average running time, and calculates the number of task processing nodes that can be increased or decreased based on the current number of running task processing nodes and the total number of cluster nodes. In the next scheduling, the proportion of selected nodes is adjusted according to the calculated number of task processing nodes that can be increased or decreased. In this way, the number of task processing nodes can be selected more accurately.

[0149] For example, Fig. 9Schematic diagram of task volume estimation involved in the embodiment of the present application. Fig. 9 As shown, after scheduling a round of tasks, nodes 1, 2, and 3 feedback the task running status to the scheduling center, and the scheduling center adjusts the proportion of selected nodes used for the next task scheduling based on the feedback information.

[0150] To summarize, each task processing node pulls its assigned task through the received scheduling information. When each task processing node determines that the scheduling information transmission conditions are met after the task is pulled, it sends the scheduling information to the next task processing node, thereby realizing the scheduling process of each task processing node in sequence according to the node sequence. Through the above scheme, the system instability caused by a large number of remote calls through the scheduling center in a short period of time when only the scheduling center performs task calculation and allocation can be avoided, thereby improving the stability of the distributed system while ensuring the efficiency of task scheduling.

[0151] Fig.10 The structure block diagram of a task scheduling device provided by an exemplary embodiment of the present application is shown. The task scheduling device is used on a task processing node in a distributed system, and the task scheduling device includes:

[0152] The scheduling receiving module 1010 is used to receive scheduling information; the scheduling information is used to indicate the tasks assigned to each node in the node sequence; the node sequence includes at least two of the task processing nodes including the first node;

[0153] A task pulling module 1020, configured to pull the task assigned to the first node according to the scheduling information;

[0154] The scheduling sending module 1030 is used to send the scheduling information to the next task processing node in the node sequence in response to the task pulling result satisfying the scheduling information transmission condition.

[0155] In a possible implementation, the scheduling sending module 1030 includes:

[0156] The first sending submodule is configured to send the scheduling information to a next task processing node in the node sequence in response to there being remaining unpulled tasks after pulling the tasks assigned to the first node.

[0157] In a possible implementation, the scheduling information includes an estimated task load of each node in the node sequence;

[0158] The task pulling module 1020 includes:

[0159] a quantity determination submodule, configured to determine the number of tasks to be allocated to the first node according to the estimated task carrying capacity of the first node in the scheduling information;

[0160] The pulling submodule is used to pull the tasks allocated to the first node based on the number of tasks allocated to the first node.

[0161] In a possible implementation, the scheduling information further includes an index identifier of the task to be currently pulled;

[0162] The pulling submodule includes:

[0163] The pulling unit is used to pull tasks starting from the tasks corresponding to the index identifier until tasks equal to the number of tasks allocated to the first node are pulled, or until there are no remaining tasks that have not been pulled.

[0164] In a possible implementation, the scheduling sending module 1030 includes:

[0165] The second sending submodule is used to respond to the task pulling result satisfying the scheduling information transmission condition, update the index identifier of the current task to be pulled in the scheduling information according to the task pulling result, and then send the scheduling information to the next task processing node in the node sequence.

[0166] To summarize, each task processing node pulls its assigned task through the received scheduling information. When each task processing node determines that the scheduling information transmission conditions are met after the task is pulled, it sends the scheduling information to the next task processing node, thereby realizing the scheduling process of each task processing node in sequence according to the node sequence. Through the above scheme, the system instability caused by a large number of remote calls through the scheduling center in a short period of time when only the scheduling center performs task calculation and allocation can be avoided, thereby improving the stability of the distributed system while ensuring the efficiency of task scheduling.

[0167] Fig.11 The structure block diagram of a task scheduling device provided by an exemplary embodiment of the present application is shown. The task scheduling device is used in a scheduling center in a distributed system, and the task scheduling device includes:

[0168] The information acquisition module 1110 is used to acquire node information of a plurality of the task processing nodes; the node information is used to indicate the survival status of the task processing nodes;

[0169] A sequence generation module 1120, configured to select at least two of the task processing nodes from the plurality of task processing nodes according to the node information of the plurality of task processing nodes, to form a node sequence;

[0170] The scheduling generation module 1130 is used to generate scheduling information; the scheduling information is used to indicate the tasks assigned to each node in the node sequence;

[0171] The scheduling transmission module 1140 is used to send the scheduling information to the first task processing node in the node sequence, so that each task processing node in the node sequence pulls tasks according to the scheduling information, and when the task pulling result meets the scheduling information transmission condition, the scheduling information is sent to the next task processing node in the node sequence.

[0172] To summarize, each task processing node pulls its assigned task through the received scheduling information. When each task processing node determines that the scheduling information transmission conditions are met after the task is pulled, it sends the scheduling information to the next task processing node, thereby realizing the scheduling process of each task processing node in sequence according to the node sequence. Through the above scheme, the system instability caused by a large number of remote calls through the scheduling center in a short period of time when only the scheduling center performs task calculation and allocation can be avoided, thereby improving the stability of the distributed system while ensuring the efficiency of task scheduling.

[0173] Fig.12 The structural block diagram of a computer device 1200 shown in an exemplary embodiment of the present application is shown. The computer device can be implemented as the target node in the above scheme of the present application. The computer device 1200 includes a central processing unit (CPU) 1201, a system memory 1204 including a random access memory (RAM) 1202 and a read-only memory (ROM) 1203, and a system bus 1205 connecting the system memory 1204 and the central processing unit 1201. The computer device 1200 also includes a large-capacity storage device 1206 for storing an operating system 1209, an application program 1210 and other program modules 1211.

[0174] The mass storage device 1206 is connected to the central processing unit 1201 via a mass storage controller (not shown) connected to the system bus 1205. The mass storage device 1206 and its associated computer readable medium provide non-volatile storage for the computer device 1200. That is, the mass storage device 1206 may include a computer readable medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0175] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically-Erasable Programmable Read-Only Memory (EEPROM) flash memory or other solid-state storage devices, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the above. The above-mentioned system memory 1204 and mass storage device 1206 can be collectively referred to as memory.

[0176] According to various embodiments of the present disclosure, the computer device 1200 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 1200 can be connected to the network 1208 through the network interface unit 1207 connected to the system bus 1205, or the network interface unit 1207 can be used to connect to other types of networks or remote computer systems (not shown).

[0177] The memory also includes at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is stored in the memory. The central processing unit implements all or part of the steps in the task scheduling method shown in the above-mentioned embodiments by executing the at least one instruction, at least one program, code set or instruction set.

[0178] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.

[0179] In an exemplary embodiment, a computer-readable storage medium is also provided, which is used to store at least one instruction, at least one program, code set or instruction set, and the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by a processor to implement all or part of the steps in the above-mentioned scene screen display method. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0180] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned Figure 2 , Figure 3 or Figure 4 All or part of the steps of the method shown in any embodiment.

[0181] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0182] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A task scheduling method, characterized in that: The method is performed by a first node in a distributed system, wherein the distributed system includes a scheduling center and a plurality of task processing nodes, and the first node is one of at least two of the task processing nodes; the method comprises: Receive scheduling information; the scheduling information is used to indicate the tasks respectively assigned to each node in the node sequence; the node sequence includes at least two of the task processing nodes including the first node; wherein, when the first node is the first task processing node in the node sequence, the first node receives the scheduling information directly sent by the scheduling center; when the first node is not the first task processing node in the node sequence, and the first node is the i-th task processing node in the node sequence, the first node receives the scheduling information sent by the task processing node at the i-1 position in the node sequence, where i is a positive integer greater than or equal to 1; In response to the estimated task load of each node in the node sequence included in the scheduling information; determining the number of tasks to be allocated to the first node according to the estimated task load of the first node in the scheduling information; and pulling the tasks allocated to the first node based on the number of tasks allocated to the first node; In response to the sum of the number of tasks assigned to the first node and the tasks pulled by other task processing nodes that have pulled tasks before the first node in the node sequence being less than the total number of tasks to be assigned, and there are other task processing nodes that have not pulled tasks in the node sequence, sending scheduling information to the next task processing node in the node sequence; Among them, the first node is used to determine the maximum number of tasks assigned by the first node each time and the number of currently unassigned tasks based on the scheduling information, and determine the number of tasks that need to be assigned to the next task processing node; when the number of currently unassigned tasks is less than or equal to the maximum number of tasks assigned by the task processing node each time, all currently unassigned tasks are assigned to the next task processing node, and task allocation is ended at the same time; when the number of currently unassigned tasks is greater than the maximum number of tasks assigned by the task processing node each time, tasks are obtained from the currently unassigned tasks according to the maximum number of tasks assigned each time and assigned to the next task processing node.

2. The method according to claim 1, characterized in that In response to the task pulling result satisfying the scheduling information transmission condition, sending the scheduling information to the next task processing node in the node sequence includes: In response to there being remaining unpulled tasks after pulling the tasks assigned to the first node, the scheduling information is sent to the next task processing node in the node sequence.

3. The method according to claim 1, characterized in that The scheduling information also includes the index identifier of the task to be pulled currently; Pulling the task assigned to the first node based on the number of tasks assigned to the first node includes: Tasks are pulled starting from the task corresponding to the index identifier until tasks equal to the number of tasks allocated to the first node are pulled, or until there are no remaining tasks that have not been pulled.

4. The method according to claim 3, characterized in that In response to the task pulling result satisfying the scheduling information transmission condition, sending the scheduling information to the next task processing node in the node sequence includes: In response to the task pulling result satisfying the scheduling information transmission condition, after updating the index identifier of the current task to be pulled in the scheduling information according to the task pulling result, the scheduling information is sent to the next task processing node in the node sequence.

5. A task scheduling method, characterized in that: The method is executed by a scheduling center in a distributed system, the distributed system further comprising a plurality of task processing nodes, and the method comprises: Acquire node information of a plurality of the task processing nodes; the node information is used to indicate the survival status of the task processing nodes; According to the node information of the plurality of task processing nodes, at least two of the task processing nodes are selected from the plurality of task processing nodes to form a node sequence; Generate scheduling information; the scheduling information is used to indicate the tasks assigned to each node in the node sequence; Send the scheduling information to the first task processing node in the node sequence, so that each task processing node in the node sequence pulls tasks according to the scheduling information, and sends the scheduling information to the next task processing node in the node sequence when the task pulling result meets the scheduling information transmission condition; The task processing node includes a first node, and the first node is used for: In response to the estimated task load of each node in the node sequence included in the scheduling information; determining the number of tasks to be allocated to the first node according to the estimated task load of the first node in the scheduling information; and pulling the tasks allocated to the first node based on the number of tasks allocated to the first node; In response to the sum of the number of tasks assigned to the first node and the tasks pulled by other task processing nodes that have pulled tasks before the first node in the node sequence being less than the total number of tasks to be assigned, and there are other task processing nodes that have not pulled tasks in the node sequence, sending scheduling information to the next task processing node in the node sequence; Based on the scheduling information, determine the maximum number of tasks assigned each time by the first node and the number of currently unassigned tasks, and determine the number of tasks that need to be assigned to the next task processing node; when the number of currently unassigned tasks is less than or equal to the maximum number of tasks assigned each time by the task processing node, assign all currently unassigned tasks to the next task processing node and end task assignment at the same time; when the number of currently unassigned tasks is greater than the maximum number of tasks assigned each time by the task processing node, obtain tasks from the currently unassigned tasks according to the maximum number of tasks assigned each time and assign them to the next task processing node.

6. A task scheduling device, characterized in that: The device is used in a first node in a distributed system, wherein the distributed system includes a scheduling center and a plurality of task processing nodes, and the first node is one of at least two of the task processing nodes; the device comprises: A scheduling receiving module, used for receiving scheduling information; the scheduling information is used for indicating the tasks respectively assigned to each node in the node sequence; the node sequence includes at least two of the task processing nodes including the first node; wherein, when the first node is the first task processing node in the node sequence, the first node receives the scheduling information directly sent by the scheduling center; when the first node is not the first task processing node in the node sequence, and the first node is the i-th task processing node in the node sequence, the first node receives the scheduling information sent by the task processing node at the i-1 position in the node sequence, where i is a positive integer greater than or equal to 1; A task pulling module, configured to respond to the estimated task carrying capacity of each node in the node sequence included in the scheduling information; determine the number of tasks allocated to the first node according to the estimated task carrying capacity of the first node in the scheduling information; and pull the tasks allocated to the first node based on the number of tasks allocated to the first node; A scheduling sending module, configured to send scheduling information to a next task processing node in the node sequence in response to the sum of the number of tasks assigned to the first node and the tasks pulled by other task processing nodes that have already pulled tasks and are located before the first node in the node sequence being less than the total number of tasks to be assigned, and there are other task processing nodes that have not pulled tasks in the node sequence; Among them, the first node is used to determine the maximum number of tasks assigned by the first node each time and the number of currently unassigned tasks based on the scheduling information, and determine the number of tasks that need to be assigned to the next task processing node; when the number of currently unassigned tasks is less than or equal to the maximum number of tasks assigned by the task processing node each time, all currently unassigned tasks are assigned to the next task processing node, and task allocation is ended at the same time; when the number of currently unassigned tasks is greater than the maximum number of tasks assigned by the task processing node each time, tasks are obtained from the currently unassigned tasks according to the maximum number of tasks assigned each time and assigned to the next task processing node.

7. A task scheduling device, characterized in that: The device is used in a dispatching center in a distributed system, and the distributed system also includes a plurality of task processing nodes. The device includes: An information acquisition module, used to acquire node information of a plurality of the task processing nodes; the node information is used to indicate the survival status of the task processing nodes; A sequence generation module, configured to select at least two of the task processing nodes from the plurality of task processing nodes according to the node information of the plurality of task processing nodes, so as to form a node sequence; A scheduling generation module, used to generate scheduling information; the scheduling information is used to indicate the tasks assigned to each node in the node sequence; A scheduling transmission module, used to send the scheduling information to the first task processing node in the node sequence, so that each task processing node in the node sequence pulls tasks according to the scheduling information, and when the task pulling result meets the scheduling information transmission condition, sends the scheduling information to the next task processing node in the node sequence; The task processing node includes a first node, and the first node is used for: In response to the estimated task load of each node in the node sequence included in the scheduling information; determining the number of tasks to be allocated to the first node according to the estimated task load of the first node in the scheduling information; and pulling the tasks allocated to the first node based on the number of tasks allocated to the first node; In response to the sum of the number of tasks assigned to the first node and the tasks pulled by other task processing nodes that have pulled tasks before the first node in the node sequence being less than the total number of tasks to be assigned, and there are other task processing nodes that have not pulled tasks in the node sequence, sending scheduling information to the next task processing node in the node sequence; Based on the scheduling information, determine the maximum number of tasks assigned each time by the first node and the number of currently unassigned tasks, and determine the number of tasks that need to be assigned to the next task processing node; when the number of currently unassigned tasks is less than or equal to the maximum number of tasks assigned each time by the task processing node, assign all currently unassigned tasks to the next task processing node and end task assignment at the same time; when the number of currently unassigned tasks is greater than the maximum number of tasks assigned each time by the task processing node, obtain tasks from the currently unassigned tasks according to the maximum number of tasks assigned each time and assign them to the next task processing node.

8. A computer device, characterized in that: The computer device includes a processor and a memory, the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the task scheduling method as described in any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the task scheduling method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Task scheduling method and device

    CN107870948A

  • Task scheduling method and device, computer equipment and storage medium

    CN111522641A