A task distribution method and device

By making each execution node both a server and a client in the task distribution system, it determines the execution node of the task, solves the problems of central control node stability and multi-machine competition, and achieves high availability of task distribution and cheap CI/CD. sex and flexibility.

CN112256437BActive Publication Date: 2024-10-18NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011247793.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-10
Publication Date
2024-10-18
Estimated Expiration
2040-11-10

AI Technical Summary

Technical Problem

In the existing task distribution system, the central control node has high stability requirements. Once it goes down, all execution nodes will be unable to perform tasks or lose monitoring of all nodes. After the introduction of multi-machine control, the problem of multi-machine competition for masters is prone to occur, resulting in execution Potential scheduling disorder of nodes.

Method used

Using a decentralized task distribution method, each execution node is both a server and a client. By receiving the tasks to be processed and deciding whether to execute them directly or jump to other nodes for execution, the inherent stability risks of the central control node are eliminated. Each sub-node They have equal status and serve as redundant backups for each other.

Benefits of technology

It achieves high availability and elasticity of task distribution and avoids single point of failure of the central control node. The entire node network is completely symmetrical to users, regardless of priority, which improves the cheapness and flexibility of CI/CD.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112256437B_ABST
    Figure CN112256437B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a task distribution method and device, wherein the method comprises: the current node receives the task to be processed and determines the target node for executing the task to be processed; if the target node is the current node, the task to be processed is executed at the current node; if the target node is not the current node, the task to be processed is sent to the target node to execute the task to be processed at the target node. Thus, each execution node can receive and distribute tasks, eliminating the inherent stability risks of centralized control using a central control node, and each sub-node has an equal status and serves as a redundant backup for each other. When a sub-node fails, any other node can be used to replace it.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of task management, and in particular to a task distribution method and a task distribution device. Background Art

[0002] Modern enterprise-level CI / CD work generally requires organizing various tasks together to achieve purposes such as agile development, rapid iteration, and even providing services to customers. These tasks are executed in parallel or serially according to their specific types. In order to organize these tasks in an orderly manner, a task distribution system is often required to distribute the tasks to the corresponding execution machines for execution. The purpose of the task distribution system is to find the execution machines that can be used and send the tasks to the execution machines for execution.

[0003] In the prior art, a typical task distribution system consists of a central control node and multiple execution nodes. The central control node is responsible for processing the user's pending tasks and distributing the actual tasks to the various execution nodes for execution. The execution nodes send the execution process and results back to the central control node. After distributing the tasks, the central node is only responsible for maintaining communication with the execution nodes, and the execution nodes return the task execution status in real time when executing the tasks, or send back the results uniformly after the tasks are completed. The central control node will actively or passively inform the user of the execution status of each task according to the execution status of the tasks.

[0004] However, in the above scenario, the stability of the central control node is required to be high. Once the node goes down, all execution nodes will be unable to execute tasks or lose the monitoring status of all nodes. In order to maintain the stability of the central control node, the number of central control nodes is often expanded to achieve the purpose of redundant backup. However, once multi-machine control is introduced, it is equivalent to introducing the inherent defect of multi-machine competition (multiple redundant central control nodes compete for the actual central control node that is activated). In the process of multi-machine competition, one or some nodes may not know who controls them for a while, or they may be controlled by multiple "pseudo" hosts at the same time, which may easily cause potential scheduling disorder of the execution nodes. Summary of the invention

[0005] In view of the above problems, embodiments of the present invention are proposed to provide a task distribution method and a corresponding task distribution device that overcome the above problems or at least partially solve the above problems.

[0006] In a first aspect, an embodiment of the present invention discloses a task distribution method, the method comprising:

[0007] The current node receives the task to be processed and determines a target node for executing the task to be processed;

[0008] If the target node is the current node, the task to be processed is executed on the current node; if the target node is not the current node, the task to be processed is sent to the target node so as to be executed on the target node.

[0009] Optionally, determining a target node for executing the task to be processed includes:

[0010] Obtaining load data of all nodes connected to the current node;

[0011] According to the load data, an executable node is determined from all nodes as a target node for executing the task to be processed.

[0012] Optionally, determining, according to the load data, an executable node from all nodes as a target node for executing the task to be processed includes:

[0013] When a plurality of executable nodes are included, the plurality of executable nodes are sorted according to the load data to obtain a sorting result;

[0014] According to the sorting result, a target node for executing the task to be processed is determined from the plurality of executable nodes.

[0015] Optionally, all nodes connected to the current node include: nodes in the same local area network as the current node, and / or nodes in a different local area network that is reachable to the current node at the network layer of the OSI model.

[0016] Optionally, before the step of acquiring the load data of all nodes connected to the current node, the method further includes:

[0017] It is determined that the node that sends the notification message to the current node is a node connected to the current node.

[0018] Optionally, the acquiring load data of all nodes connected to the current node includes:

[0019] The current node sends an assignment request to each node connected to the current node in turn;

[0020] Receive the load data returned by each node.

[0021] Optionally, after the step of determining, according to the load data, an executable node from all nodes as a target node for executing the task to be processed, the method further includes:

[0022] An assignment message is generated for each of the nodes, and the assignment message is returned to each of the nodes.

[0023] In a second aspect, an embodiment of the present invention further discloses a task distribution device, the device comprising:

[0024] A target node determination module is used for receiving a task to be processed at a current node and determining a target node for executing the task to be processed;

[0025] A task execution module is used to execute the pending task on the current node if the target node is the current node; if the target node is not the current node, send the pending task to the target node so as to execute the pending task on the target node.

[0026] In a third aspect, an embodiment of the present invention further discloses an electronic device, including:

[0027] A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform a method as described in any one of the embodiments of the present invention.

[0028] In a fourth aspect, an embodiment of the present invention further discloses a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method described in any one of the embodiments of the present invention is executed.

[0029] The embodiments of the present invention include the following advantages:

[0030] In the embodiment of the present invention, the task to be processed is received through the current node, and the target node for executing the task to be processed is determined. If the target node is the current node, the task to be processed is executed at the current node. If the target node is not the current node, the task to be processed is sent to the target node to execute the task to be processed on the target node. Thus, each execution node can receive and assign tasks, eliminating the inherent stability risks of centralized control using a central control node. Each child node has an equal status and serves as a redundant backup for each other. When a child node fails, any other node can be used to replace it. The entire node network is completely symmetrical for users, regardless of primary and secondary or parent-child structures, making the entire CI / CD cheaper and more flexible. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 is a flowchart of a task distribution method embodiment of the present invention;

[0032] Figure 2A It is a schematic diagram of a task of the present invention after one reflection;

[0033] Figure 2B It is a structural schematic diagram of an execution node of the present invention;

[0034] Figure 3 It is a schematic diagram of an execution node of the present invention distributed in two local area networks;

[0035] Figure 4 is a schematic diagram of a decision-making process of the present invention;

[0036] Figure 5 is a schematic diagram of a decision result of the present invention;

[0037] Figure 6 It is a schematic diagram of sending BGP notifications between execution nodes of the present invention;

[0038] Figure 7 It is a schematic diagram of an execution node polling decision of the present invention;

[0039] Figure 8 is a schematic diagram of a multi-task distribution of the present invention;

[0040] Fig. 9 is a structural block diagram of an embodiment of a task distribution device of the present invention;

[0041] Fig.10 is a structural block diagram of an electronic device of the present invention;

[0042] Fig.11 It is a structural block diagram of a storage medium of the present invention. DETAILED DESCRIPTION

[0043] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0044] In order to avoid the need to centrally receive and distribute tasks through a central control node, in an embodiment of the present invention, the structure of the execution node can be changed. Each execution node can be composed of a server and a client. The server is responsible for receiving one or more tasks passed over and deciding whether to execute these tasks directly or redirect them through the client. The client can execute the tasks assigned by the server or reflect the tasks to other execution nodes through communication. This execution node with both server and client characteristics constitutes the cornerstone of the subsequent large-scale reflective execution network, so that a decentralized structural design can be adopted to eliminate the inherent stability risks of centralized control using a central control node. Each child node has an equal status and serves as a redundant backup for each other. When a child node fails, any other node can be used to replace it. For users, the entire node network is completely symmetrical, regardless of primary and secondary, or parent-child structure, making the entire CI / CD cheaper and more flexible.

[0045] Reference Figure 1 , shows a flowchart of a task distribution method embodiment of the present invention, which may specifically include the following steps:

[0046] Step 101, the current node receives a task to be processed and determines a target node for executing the task to be processed;

[0047] The pending task may be an unprocessed task, and the pending task may be generated according to a user's request. Specifically, when a user requests to access data in a database, an access data task may be generated according to the user's access request, and the access data task may be sent to the execution node as a pending task.

[0048] The current node may refer to the execution node that currently receives the pending task. The current node may be composed of a server and a client, and receives the pending task through the server. After receiving the pending task, it does not execute the pending task immediately, but decides on which execution node to execute the pending task after making a decision, that is, determines the target node for executing the pending task.

[0049] Specifically, the current status of all execution nodes in the cluster can be obtained, and the current status may include an available status and an unavailable status. For example, the number of tasks of the execution node can be queried to determine whether the execution node is in an available status. After the current status of all execution nodes in the cluster is obtained, the execution node in an available status can be determined as the target node based on the current status of all execution nodes. As an example, assuming that there are currently 3 execution nodes, and the current node is node 1, if the current status of node 1 is an available status, the current status of node 2 is an unavailable status, and the current status of node 3 is an unavailable status, then the current node can be determined to be the target node; if the current status of node 1 is an unavailable status, the current status of node 2 is an unavailable status, and the current status of node 3 is an available status, then node 3 can be determined to be the target node.

[0050] Step 102: if the target node is the current node, the task to be processed is executed on the current node; if the target node is not the current node, the task to be processed is sent to the target node so as to be executed on the target node.

[0051] After determining the target node for executing the pending task, it can be further determined whether the target node is the current node. If the target node is the current node, the pending task can be executed at the current node to obtain an execution result.

[0052] If the target node is not the current node, the pending task can be sent to the target node to execute the pending task on the target node. Specifically, in the same local area network, all execution machines in the local area network can communicate directly without routing forwarding, where the local area network does not specifically refer to the IP (Internet Protocol) network segment with the same mask, and can be considered as a group of smaller execution machines. When the target node is not the current node, the pending task can be directly sent to the target node through communication reflection.

[0053] As an example, Figure 2A As shown in the figure, there are 4 execution nodes. After receiving the pending task, the current node needs to reflect it once to other nodes for execution. After receiving the pending task, other nodes can continue to reflect the pending task to other nodes. Figure 2B As shown, there are 4 execution nodes, each of which includes a server and a client. The server is responsible for receiving the tasks to be processed and deciding whether to execute them directly locally or redirect them to its node via the client for execution.

[0054] In a cross-LAN network, the tasks to be processed can be forwarded from one LAN island to another LAN island through the network layer of the third layer of the OSI model, such as Figure 3 As shown, execution nodes 1 to 4 are in the same LAN, execution nodes a to d are in the same LAN, and the third layer network layer routes of the two LANs are reachable. When a pending task is transferred from the previous LAN to execution node a, execution node a only knows that the pending task does not come from its own LAN. From its perspective, the pending task has experienced at least two reflections. From the perspective of execution node 1, similarly, it actively throws the pending task to execution node a. It does not know whether the pending task will be thrown elsewhere by execution node a (nor does it need to know), so the secondary transmission of a secondary reflection task is completely visible to the two associated front and back nodes. In an embodiment of the present invention, the following can be used: Figure 3 The task transfer structure shown is called a quadratic reflection structure.

[0055] When an execution node receives a pending task, it can decide where to execute the pending task, such as Figure 4 As shown, there are four decision results: 1. It is an available node with execution conditions (i.e., corresponding to Figure 4 1. There is an available node with execution conditions in the local area network where the current node is located (i.e., corresponding to Figure 4 3. If there is no available node in the local area network where the current node is located, but there is an available node in the adjacent local area network (called the third-layer neighbor), a second reflection is required, and the next node to which the reflection is made makes its own decision in its local area network (i.e., corresponding to Figure 4 Secondary reflection in the decision result); 4. If there is no available node and no next three-layer neighbor, it will not be executed and the process ends.

[0056] like Figure 5As shown, assuming a special case when there is only one available node, if the LAN neighbor 2 where the current node is located is an available node, then the LAN neighbor 2 is determined to be the target node. If the current node is an available node, then the current node is determined to be the target node. If there is no available node in the LAN where the current node is located, then the three-layer neighbor table is queried. If there is an available three-layer neighbor, then the task to be processed is forwarded to the three-layer neighbor network segment (i.e., the secondary reflection mentioned above). Among them, the method for generating the three-layer neighbor table is as follows: determine whether the node is the three-layer of the current node through BGP (Border Gateway Protocol). If the current node can obtain the notification message sent by the node, then the node is considered to be the three-layer neighbor of the current node, and maintain the corresponding three-layer neighbor table. In addition, the three-layer neighbors of the current node can also be discovered by other means, and the embodiments of the present invention are not limited to this.

[0057] In a preferred embodiment of the present invention, the determining of a target node for executing the task to be processed includes:

[0058] Obtain load data of all nodes connected to the current node; and determine, based on the load data, an executable node from all nodes as a target node for executing the task to be processed.

[0059] The load data may refer to data used to describe the load status of the execution node. Specifically, the number of tasks of the execution node may be queried as the load data. As an example, the number of processes in the execution node may be traversed to screen the process numbers that have a parent-child process relationship with the server in the execution node, and the number of tasks of the execution node may be obtained by the number of these process numbers. In addition, the number of tasks of the execution node may be determined by other methods, which are not limited in the embodiments of the present invention.

[0060] In an embodiment of the present invention, the load data of all nodes connected to the current node can be obtained, wherein all nodes connected to the current node may include: nodes in the same local area network as the current node, and / or nodes in a different local area network that is reachable to the current node at the network layer of the OSI model. The OSI model (Open System Interconnection Reference Model) divides the computer network architecture into 7 layers, the network layer is the third layer of the OSI model, and nodes in a different local area network that is reachable to the current node at the network layer of the OSI model can be called the third-layer neighbors of the current node. After the load data of all nodes connected to the current node are obtained, executable nodes can be determined from all nodes as target nodes for executing the task to be processed based on the load data.

[0061] In a preferred embodiment of the present invention, determining, according to the load data, an executable node from all nodes as a target node for executing the task to be processed includes:

[0062] When a plurality of executable nodes are included, the plurality of executable nodes are sorted according to the load data to obtain a sorting result; and based on the sorting result, a target node for executing the task to be processed is determined from the plurality of executable nodes.

[0063] Specifically, when there are multiple executable nodes, the multiple executable nodes can be sorted according to the load data to obtain a sorting result, and then the target node for executing the task to be processed is determined from the multiple executable nodes according to the sorting result. As an example, the load data includes the number of tasks, then the nodes can be sorted according to the number of tasks of each node, and the execution node with the least number of tasks is selected as the target node for executing the task to be processed. As another example, the load data includes memory utilization, then the nodes can be sorted according to the memory utilization of each node, and the execution node with the lowest memory utilization is selected as the target node for executing the task to be processed. In addition, the load data can also be set to other parameters according to actual needs, and the embodiment of the present invention is not limited to this.

[0064] In a preferred embodiment of the present invention, before the step of acquiring the load data of all nodes connected to the current node, the method further includes:

[0065] It is determined that the node that sends the notification message to the current node is a node connected to the current node.

[0066] In the embodiment of the present invention, before the step of obtaining the load data of all nodes connected to the current node, it is also possible to determine that the node that sends the notification message to the current node is the node connected to the current node. Specifically, if the current node can receive the passing message of other nodes, it can be considered that the node and the current node are reachable at the network layer of the OSI model, and the node can be determined to be the node connected to the current node, so as to obtain the load data of the node when making a decision to determine whether it is necessary to send the task to be processed to the node for execution.

[0067] As an example, Figure 6 As shown in the figure, there are three LANs. The third layer network layer between the LANs is reachable, and each other is informed of where the other is through BGP notification. Taking execution node X as an example, execution node X receives a notification message from the network where execution nodes Y and Z are located, and can know the neighbor relationship between execution nodes Y, Z and execution node X. After receiving the notification message, each execution node can maintain a three-layer neighbor table to record the neighbors of each node.

[0068] In a preferred embodiment of the present invention, the step of acquiring load data of all nodes connected to the current node includes:

[0069] The current node sends assignment requests to each node connected to the current node in turn; and receives load data returned by each node.

[0070] In the embodiment of the present invention, multiple tasks can be sent to multiple execution nodes in a multi-queue parallel manner. During the time between receiving pending tasks, deciding task distribution, and confirming that the other party has received the task distribution decision result, if other pending tasks are received, it is necessary to wait until the current decision is completed before responding. The "self-locking" feature of the current node can be guaranteed by reconstructing the serial feature of a three-way handshake behavior on the transport layer protocol to ensure that the problem of multiple tasks being written at the same time will not be caused.

[0071] Specifically, the current node may poll all nodes to decide the target node for executing the pending task. The current node sends an assignment request to each node connected to the current node in turn. The assignment request may refer to a request message for notifying that the pending task needs to be executed. For example, the assignment request may be: I may assign you. After receiving the assignment request, each node may inform the current node of the actual situation, that is, return load data to the current node, so that the current node can determine whether to assign this node according to the load data.

[0072] In a preferred embodiment of the present invention, after the step of determining, according to the load data, an executable node from all nodes as a target node for executing the task to be processed, the method further includes:

[0073] An assignment message is generated for each of the nodes, and the assignment message is returned to each of the nodes.

[0074] In the embodiment of the present invention, after the current node determines the executable node from all nodes as the target node for executing the task to be processed according to the load data, it can generate an assignment message for each node and return the assignment message to each node. For example, the assignment message generated for the target node is: I will assign you; the assignment message generated for the non-target node is: I will not assign you.

[0075] As an example, Figure 7As shown, the a / b task queue and the x / y task queue are submitted to execution node 1 and execution node 4 respectively. Assuming that there is a mutually exclusive relationship between tasks a and x (i.e., the same machine cannot run a and x at the same time), when execution node 1 polls the machines in the LAN network segment, it cannot poll execution node 4. Similarly, execution node 4 cannot poll execution node 1. In addition, if execution node 1 polls execution node 2 first, execution node 4 must wait until the assignment between execution node 2 and execution node 1 is completely completed before it can poll execution node 2. Among them, the complete completion of the assignment means that execution node 2 has determined whether execution node 1 uses me or not, rather than being in a temporarily unknown intermediate state.

[0076] Execution node 2 determines the assignment relationship through a three-way handshake with execution node 1: the first time, execution node 1 tells execution node 2 that I may assign you; the second time, execution node 2 tells execution node 1 my actual situation; the third time, execution node 1 tells execution node 2 that I will use you or not. During the three-way handshake, if execution node 4 sends a polling request, execution node 2 cannot respond until the three-way handshake is completed, then it starts to respond to the polling of execution node 4 and establishes a three-way handshake relationship with execution node 4.

[0077] In the specific implementation, if the tasks in multiple queues have mutually exclusive relationships, the response speed will be reduced. Through reasonable division, the mutually exclusive tasks can be placed in different LANs to improve the response speed of task distribution. Figure 8 As shown, tasks 1, 2... and tasks a, b... have a mutually exclusive relationship, so tasks 1, 2... and tasks a, b... are divided into different local area networks.

[0078] In the embodiment of the present invention, the task to be processed is received through the current node, and the target node for executing the task to be processed is determined. If the target node is the current node, the task to be processed is executed at the current node. If the target node is not the current node, the task to be processed is sent to the target node to execute the task to be processed on the target node. Thus, each execution node can receive and assign tasks, eliminating the inherent stability risks of centralized control using a central control node. Each child node has an equal status and serves as a redundant backup for each other. When a child node fails, any other node can be used to replace it. The entire node network is completely symmetrical for users, regardless of primary and secondary or parent-child structures, making the entire CI / CD cheaper and more flexible.

[0079] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0080] Reference Fig. 9 , shows a structural block diagram of an embodiment of a task distribution device of the present invention, which may specifically include the following modules:

[0081] The target node determination module 901 is used for the current node to receive the task to be processed and determine the target node for executing the task to be processed;

[0082] The task execution module 902 is used to execute the pending task on the current node if the target node is the current node; if the target node is not the current node, send the pending task to the target node so as to execute the pending task on the target node.

[0083] In a preferred embodiment of the present invention, the target node determination module 901 includes:

[0084] A load data acquisition submodule, used to acquire load data of all nodes connected to the current node;

[0085] The target node determination submodule is used to determine, according to the load data, an executable node from all nodes as a target node for executing the task to be processed.

[0086] In a preferred embodiment of the present invention, the target node determination submodule includes:

[0087] A sorting unit, used for sorting the plurality of executable nodes according to the load data to obtain a sorting result when a plurality of executable nodes are included;

[0088] A target node determination unit is used to determine a target node for executing the task to be processed from the plurality of executable nodes according to the sorting result.

[0089] In a preferred embodiment of the present invention, all nodes connected to the current node include: nodes in the same local area network as the current node, and / or nodes in a different local area network that is reachable to the current node at the network layer of the OSI model.

[0090] In a preferred embodiment of the present invention, the device further comprises:

[0091] The node determination module is used to determine that the node that sends the notification message to the current node is a node connected to the current node.

[0092] In a preferred embodiment of the present invention, the load data acquisition submodule includes:

[0093] An assignment request sending unit, configured for the current node to send assignment requests to each node connected to the current node in sequence;

[0094] The load data receiving unit is used to receive the load data returned by each node.

[0095] In a preferred embodiment of the present invention, the load data acquisition submodule further includes:

[0096] The assignment message returning unit is used to generate an assignment message for each node and return the assignment message to each node.

[0097] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0098] like Fig.10 As shown, an embodiment of the present invention further provides an electronic device, including:

[0099] Processor 1001, storage medium 1002 and bus 1003, the storage medium 1002 stores machine-readable instructions executable by the processor 1001, when the electronic device is running, the processor 1001 communicates with the storage medium 1002 through the bus 1003, and the processor 1001 executes the machine-readable instructions to execute the method as described in any one of the embodiments of the present invention. The specific implementation method and technical effect are similar and will not be repeated here.

[0100] like Fig.11 As shown, the embodiment of the present invention further provides a storage medium, on which a computer program 1101 is stored, and the computer program 1101 is executed by a processor to execute the method as described in any one of the embodiments of the present invention. The specific implementation method and technical effect are similar and will not be repeated here.

[0101] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0102] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0103] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0104] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0105] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0106] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0107] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0108] The above is a detailed introduction to a task distribution method and a task distribution device provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A task distribution method, characterized in that: Applied to an execution node in a cluster; the cluster includes at least one local area network; the local area network includes at least one execution node; The execution nodes in the cluster back up each other; The execution node includes a server and a client; the method includes: The server of the current node receives the task to be processed and determines the target node for executing the task to be processed; the current node is used to distribute the task to be processed among the current node and the execution nodes connected to the current node; in the case that the current node and the execution nodes connected to the current node cannot execute the task to be processed, the execution of the task to be processed stops; in the case that the current node fails, any execution node in the cluster except the current node is used to replace the current node to receive and distribute the task to be processed; the execution nodes connected to the current node include: nodes in the same local area network as the current node, and / or nodes in a different local area network that are reachable to the current node at the network layer of the OSI model; If the target node is the current node, the client of the current node executes the task to be processed; if the target node is not the current node, and the target node is a node in a different local area network that is reachable from the current node at the network layer of the OSI model, the client of the current node sends the task to be processed to the target node, so that the target node determines the next target node for executing the task to be processed among the target node and the execution nodes connected to the target node.

2. The method according to claim 1, characterized in that The determining of a target node for executing the task to be processed includes: Obtaining load data of all nodes connected to the current node; According to the load data, an executable node is determined from all nodes as a target node for executing the task to be processed.

3. The method according to claim 2, characterized in that The step of determining, according to the load data, an executable node from all nodes as a target node for executing the task to be processed comprises: When a plurality of executable nodes are included, the plurality of executable nodes are sorted according to the load data to obtain a sorting result; According to the sorting result, a target node for executing the task to be processed is determined from the plurality of executable nodes.

4. The method according to claim 2 or 3, characterized in that: Before the step of acquiring the load data of all nodes connected to the current node, the method further includes: It is determined that the node that sends the notification message to the current node is a node connected to the current node.

5. The method according to claim 2, characterized in that: The acquiring load data of all nodes connected to the current node includes: The current node sends an assignment request to each node connected to the current node in turn; Receive the load data returned by each node.

6. The method according to claim 5, characterized in that After the step of determining, according to the load data, an executable node from all nodes as a target node for executing the task to be processed, the method further includes: An assignment message is generated for each of the nodes, and the assignment message is returned to each of the nodes.

7. A task distribution device, characterized in that: Applied to an execution node in a cluster; the cluster includes at least one local area network; the local area network includes at least one execution node; The execution nodes in the cluster back up each other; The execution node includes a server and a client; the device includes: A target node determination module, used for a server of a current node to receive a task to be processed and determine a target node for executing the task to be processed; the current node is used to distribute the task to be processed among the current node and the execution nodes connected to the current node; in the case where the current node and the execution nodes connected to the current node cannot execute the task to be processed, the execution of the task to be processed stops; in the case where the current node fails, any execution node in the cluster except the current node is used to replace the current node to receive and distribute the task to be processed; the execution nodes connected to the current node include: nodes in the same local area network as the current node, and / or nodes in a different local area network that are reachable from the current node at the network layer of the OSI model; A task execution module is used for, if the target node is the current node, the client of the current node executes the task to be processed; if the target node is not the current node, and the target node is a node in a different local area network that is reachable from the current node at the network layer of the OSI model, the client of the current node sends the task to be processed to the target node, so that the target node determines the next target node for executing the task to be processed from among the target node and the execution nodes connected to the target node.

8. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is executed.

Citation Information

Patent Citations

  • Data query system, method and apparatus

    CN108205561A

  • Task processing method, computer readable storage medium and terminal equipment

    CN108446177A