Decentralized task scheduling system and method
By dividing the edge node cluster in the distributed computing system and selecting high-performance scheduling nodes, a snapshot consensus group is formed, which solves the problems of low concurrent execution efficiency and high consensus communication burden caused by undivided scheduling nodes, and improves the multi-tasking of the system. Concurrent execution performance and consensus throughput.
Patent Information
- Application Number
- CN202410547679.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-06
- Publication Date
- 2024-09-17
AI Technical Summary
In the existing distributed computing task scheduling system, the scheduling nodes are not divided into clusters, resulting in low concurrent execution efficiency of multi-tasks, and frequent communication burdens when data packaging consensus is uploaded to the chain, affecting system throughput.
Adopting a decentralized task scheduling system, through edge node cluster division, scheduling nodes with high bandwidth and strong computing power are selected as super nodes in each cluster to form an intra-group snapshot consensus group and an inter-group snapshot consensus group to achieve task scheduling and consensus. On-chain, and adjust the packaging threshold and block size based on consensus gains.
It improves multi-task concurrent execution performance and system consensus throughput, and realizes efficient parallel processing of tasks and adaptive packaging interval adjustment through edge node cluster division and DAG graph storage of task dependencies.
Smart Images

Figure CN118656183A
Abstract
Description
Technical Field
[0001] The present invention relates to distributed computing task scheduling technology, and in particular to a decentralized task scheduling system and method. Background Art
[0002] Distributed computing task scheduling refers to the process of effectively managing and allocating computing tasks in a distributed computing environment. In a distributed computing system, tasks are usually divided into small subtasks and assigned to multiple computing nodes to speed up processing. The goal of task scheduling is to reasonably allocate tasks and improve the overall performance and efficiency of the system.
[0003] In the prior art, the application number is 202111192320.8, and the application name is a logistics scheduling method and system based on blockchain key data evidence. A task scheduling solution is proposed: S1, an entry step, S2, an upload step, packaging and generating key data evidence according to the logistics task information, and sending the key data evidence to the node of the target blockchain, S3, an acquisition step, any node in the above-mentioned target blockchain obtains the key data evidence from the blockchain ledger, and unpacks it into logistics task information according to the key data evidence, S4, a receipt step, generating a marked data block according to the transaction information and the key data evidence, and the marked data block is used to pair the marked logistics task information with the transaction information, S5, a confirmation step, and the current node receives the returned consensus result information.
[0004] However, in the above task scheduling scheme, the scheduling nodes are not divided into clusters, but all scheduling nodes participate in the consensus together, which is not conducive to achieving local efficient concurrent execution of multiple tasks and affects the efficiency of scheduling; in addition, when the data is packaged and the consensus is uploaded to the chain, no appropriate block packaging interval is set, which may lead to too frequent consensus and cause excessive communication burden, thereby affecting the throughput of the system consensus. Summary of the invention
[0005] The technical problem to be solved by the present invention is to propose a decentralized task scheduling system and method to improve the performance of concurrent execution of multiple tasks and the throughput of system consensus.
[0006] The technical solution adopted by the present invention to solve the above technical problems is:
[0007] On the one hand, the present invention provides a decentralized task scheduling system, including multiple edge node clusters divided according to space, each edge node cluster includes multiple scheduling nodes and multiple working nodes, all scheduling nodes in the edge node cluster form an intra-cluster snapshot consensus group, and one scheduling node (a scheduling node with high bandwidth and strong computing power) is selected from each edge node cluster as a super node, which, while executing the work of the scheduling node, also forms an inter-cluster snapshot consensus group with super nodes in other edge node clusters;
[0008] The working node is used to maintain a heartbeat with the scheduling node responsible for managing it, accept the task scheduling of the scheduling node, execute the task and return the result to the scheduling node; and when the working node has an identity conversion function, upon receiving an identity conversion command, convert the identity of the working node to a scheduling node;
[0009] The scheduling node is responsible for maintaining and managing the working nodes connected to it in the edge node cluster, scheduling tasks within the group, and packaging the task execution status of the working nodes that execute tasks within the group under its management according to blocks, and consolidating the packaged block data with other scheduling nodes in the snapshot consensus group within the group, and calculating the benefits of this consensus on the chain, and adjusting the size of the next packaged block according to the benefit value; and is responsible for resisting failures when other scheduling nodes in the snapshot consensus group within the group fail;
[0010] The super nodes participating in the inter-cluster snapshot consensus group are also responsible for executing cross-cluster task scheduling, packaging the task execution status of the working nodes that execute cross-cluster tasks in their clusters into blocks, and consolidating the packaged block data with other super nodes in the inter-cluster snapshot consensus group. The benefits of this consensus chain are calculated, and the size of the next packaged block is adjusted according to the benefit value.
[0011] Furthermore, the scheduling node includes:
[0012] The work node management module is the only channel for the scheduling node and the work node to interact. It is used to maintain and manage the work nodes in the cluster that are connected to the scheduling node, and to issue task execution commands to the corresponding work nodes according to the task scheduling information issued by the task scheduling module.
[0013] The task scheduling module is used to obtain the resource information and service deployment information of each working node managed by the scheduling node by accessing the data storage module, perform task scheduling based on the information, and submit the task scheduling information of the working nodes managed by the scheduling node to the working node management module;
[0014] A data storage module is used to store the resource information and service deployment information of all working nodes managed by the scheduling node, the information of other scheduling nodes in the intra-cluster snapshot consensus group, and historical and real-time generated task scheduling information; if the scheduling node is a super node, the data storage module also stores the information of other super nodes in the inter-cluster snapshot consensus group;
[0015] The consensus module is used to package the task execution status of the working nodes that execute the tasks within the group managed by the scheduling node according to the blocks, reach a consensus with other scheduling nodes in the snapshot consensus group within the group on the packaged block data, and store it as a snapshot chain in a chain structure, and calculate the income of the current consensus on the chain within the group, and adjust the size of the next packaged block according to the income value; if the scheduling node is a super node, the consensus module is also used to package the task execution status of the working nodes that execute cross-group tasks in the cluster to which it belongs, and reach a consensus with other super nodes in the snapshot consensus group between groups on the packaged block data, and store it as a snapshot chain in a chain structure, and calculate the income of the current consensus on the chain between groups, and adjust the size of the next packaged block according to the income value;
[0016] The scheduling node communication module is used to request assistance from other scheduling nodes in the snapshot consensus group within the cluster when the working node managed by the scheduling node cannot complete the task. If all working nodes in the cluster cannot complete the task, they request assistance from the super node in the cluster. The super node in the cluster requests assistance from other super nodes in the snapshot consensus group between clusters through its own scheduling node communication module.
[0017] The fault resistance module is used to select a working node with identity conversion function and closest to the failed and disconnected scheduling node through negotiation with other normal scheduling nodes when the scheduling node determines that a scheduling node in the snapshot consensus group in the group has failed and lost connection. The fault resistance module of the scheduling node responsible for managing the working node sends an identity conversion command to the working node and copies the currently stored snapshot chain in the group to the working node, making it a new scheduling node.
[0018] Furthermore, the working node includes:
[0019] The node matching module is used to find nearby scheduling nodes that can manage it, establish connections to complete node matching, and maintain heartbeat detection; and, when the working node receives a matching broadcast from other scheduling nodes, it determines whether the matched scheduling node has been abandoned by the snapshot consensus group in the group based on the member information of the current snapshot consensus group in the matching broadcast. If so, it establishes a matching relationship with the scheduling node that sent the matching broadcast;
[0020] The task execution module is used to receive the task execution command issued by the scheduling node responsible for its management, and feed back the task execution result to the scheduling node;
[0021] The working node with identity conversion function also includes: an identity conversion module, which is used to convert the identity from a working node to a scheduling node after receiving an identity conversion command issued by the scheduling node managed by it, replace the failed scheduling node to join the snapshot consensus group in the group, and receive a copy of the snapshot chain in the group, and initiate a matching broadcast of the establishment request to the working nodes nearby, wherein the matching broadcast carries the member information of the snapshot consensus group in the current group.
[0022] On the other hand, the present invention also provides a decentralized task scheduling method, which is applied to the above-mentioned decentralized task scheduling system, and the method comprises the following steps:
[0023] S1. When a scheduling node in the edge node cluster receives a task, it schedules the task and generates task scheduling information and stores it locally in the form of a DAG graph. Each node in the DAG graph corresponds to a task, and the edges between nodes correspond to the dependencies between tasks.
[0024] S2. According to the task scheduling information, after the working node responsible for executing the task completes the task, the scheduling node that manages the working node updates the node status information of the task in the DAG graph and determines the type of the task. If it is an intra-group task, the intra-group task completion information is cached in the local intra-group task cache queue, and the process proceeds to step S3; if it is a cross-group task, the cross-group task completion information is sent to the super node in the cluster, and the super node caches the cross-group task completion information in the local cross-group task cache queue, and the process proceeds to step S8;
[0025] S3, each scheduling node calculates the cumulative weight of the task completion information of all the tasks in the task cache queue according to the importance weight of the task completion information of each task in the local task cache queue, and determines whether the cumulative weight reaches the set packaging threshold. If so, execute step S4, otherwise, return to step S3;
[0026] S4. For the scheduling node whose cumulative weight reaches the set packing threshold, the task information corresponding to the updated DAG graph nodes in the local DAG graph of the scheduling node since the last group task packing is packed into blocks, and sent to other scheduling nodes in the snapshot consensus group of the group, and the cache queue is cleared;
[0027] S6. Each scheduling node in the snapshot consensus group in the group reaches a consensus on the block. If the consensus is passed, all scheduling nodes in the snapshot consensus group in the group store the block in a chain structure to form a snapshot chain in the group.
[0028] S7. The scheduling node for this block packaging calculates the revenue value generated by the consensus on the chain within the group, and readjusts the packaging threshold according to the revenue value, and returns to step S3;
[0029] S8, each super node calculates the cumulative weight of the task completion information of all cross-group tasks in the cross-group task cache queue according to the importance weight of the task completion information of each cross-group task in its local cross-group task cache queue, and determines whether the cumulative weight reaches the set packaging threshold. If so, execute step S9, otherwise return to step S8;
[0030] S9. For the super node whose cumulative weight reaches the set packaging threshold, the cross-group task information corresponding to the updated DAG graph nodes in the local DAG graph of the super node since the last cross-group task packaging is packaged into blocks, and sent to other super nodes in the inter-group snapshot consensus group, and the cache queue is cleared;
[0031] S10. All super nodes in the inter-group snapshot consensus group reach a consensus on the block. If the consensus is passed, all super nodes in the inter-group snapshot consensus group store the block in a chain structure to form an inter-group snapshot chain.
[0032] S11. The super node that packages the block this time calculates the revenue value generated by the inter-group consensus on the chain, and readjusts the packaging threshold according to the revenue value, and returns to step S8.
[0033] Furthermore, in step S1, the task scheduling includes:
[0034] The scheduling node determines whether the working nodes it manages can complete the task based on the services deployed by the working nodes it manages. If so, it schedules the task to the appropriate working node. If none of the working nodes it manages can complete the task, the scheduling node first requests assistance from other scheduling nodes in the consensus group within the group. If none of the working nodes managed by other scheduling nodes in the consensus group within the group can complete the task, the scheduling node requests assistance from scheduling nodes in other clusters through the super node in the cluster.
[0035] Furthermore, the scheduling to a suitable working node includes:
[0036] The scheduling to the appropriate working node includes:
[0037] The scheduling node predicts the time required for a working node that can execute the task to complete the task from the time it receives the task to the time it completes the task based on the services deployed by the working nodes it manages and the current resource usage information. It then selects the working node that can complete the task the fastest and assigns the task to the working node for execution.
[0038] Furthermore, in step S3, the importance weight of the task completion information of each intra-group task and in step S8, the importance weight of the task completion information of each cross-group task are calculated as follows:
[0039] importance=(i+m)*req
[0040] Among them, i is the importance of the task itself, m is the number of post-tasks of the task, and req is the scheduling coefficient of the task;
[0041] in,
[0042] Furthermore, in step S7, the scheduling node of this block packaging calculates the revenue value generated by the intra-group consensus on the chain, and in step S11, the super node of this block packaging calculates the revenue value generated by the inter-group consensus on the chain, both of which include:
[0043] Calculate the benefit y of a single task:
[0044]
[0045] Among them, t represents the waiting time from when the task is stored in the local cache queue to when it is uploaded to the consensus chain, k is used to adjust the impact of the waiting time on the revenue, and p is used to adjust the magnitude of the reward;
[0046] According to the income of each task, calculate the total income of this consensus chain:
[0047] income=y1+y2+…+y thre
[0048] Where thre represents the number of tasks accumulated in the local cache queue when the packing threshold is reached.
[0049] Furthermore, in step S7 and step S11, re-adjusting the packaging threshold according to the revenue value includes:
[0050] Compare the total revenue of this consensus on-chain with the total revenue of the previous consensus on-chain. If the total revenue of this consensus on-chain is greater, the adjustment direction of the packaging threshold this time is the same as the adjustment direction of the packaging threshold last time;
[0051] If the total revenue of this consensus on-chain is smaller, the adjustment direction of the packaging threshold this time will be opposite to the previous adjustment direction of the packaging threshold.
[0052] Furthermore, the step of re-adjusting the packaging threshold according to the revenue value further includes:
[0053] The adjustment range of the packing threshold this time is half of the adjustment range of the packing threshold last time, that is, if the threshold was increased / decreased by n units during the last threshold adjustment, the adjustment range of the threshold this time is n / 2 units.
[0054] The beneficial effects of the present invention are:
[0055] Through edge node cluster division, multiple scheduling nodes are set in each cluster to form an intra-cluster consensus snapshot group, and a scheduling node with large bandwidth and strong computing power is selected from each cluster to form an inter-cluster snapshot consensus group. The system architecture formed in this way is conducive to the parallel processing of tasks with different needs because the working nodes in each cluster can be configured with different functions, and the scheduling information stored in the form of a DAG graph intuitively records the dependencies between tasks, and can achieve efficient concurrent processing of multiple tasks; in addition, when the node information of the state change in the DAG graph is packaged and chained, the present invention determines the packaging timing based on the comparison between the importance weight of the completed tasks cached in the queue and the packaging threshold, and the packaging threshold is adjusted according to the income of the last consensus chain, thereby realizing adaptive adjustment of the packaging interval, thereby improving the consensus throughput of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 This is a diagram of the architecture of a decentralized task scheduling system in an embodiment of the present invention;
[0057] Figure 2 is a structural block diagram of a scheduling node in an embodiment of the present invention;
[0058] Figure 3 is a structural block diagram of a working node with an identity conversion function in an embodiment of the present invention;
[0059] Figure 4 The figure is a flow chart of a decentralized task scheduling method in an embodiment of the present invention. DETAILED DESCRIPTION
[0060] The present invention aims to provide a decentralized task scheduling system and method to improve the performance of concurrent execution of multiple tasks and the throughput of system consensus. The scheduling system consists of a scheduling node and a working node that has completed service deployment, wherein a number of scheduling nodes and working nodes are organized into clusters according to physical space. In a cluster, the scheduling node performs task scheduling on the working nodes it manages according to a high-performance task scheduling strategy, and stores the task scheduling information in the form of a directed acyclic graph (DAG). This is conducive to the local parallel processing of tasks with different requirements. In addition, the system uses blockchain consensus technology to form a snapshot consensus group within a cluster to consensus the execution status of tasks within the group, and different clusters have a scheduling node to form an inter-group snapshot consensus group to consensus the execution status of cross-group tasks on the chain, thereby realizing the serialization and tamper-proof capabilities of task scheduling. In addition, the method adaptively adjusts the packaging threshold of the execution status of the working node by combining the benefits generated by the packaging of historical blocks, thereby reducing the consensus delay and improving the system throughput.
[0061] The scheme of the present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0062] Example
[0063] See also Figure 1 The decentralized task scheduling system provided in this embodiment includes multiple edge node clusters divided according to space. These clusters do not overlap with each other. Each edge node belongs to only one cluster. There are several scheduling nodes and working nodes in each cluster. All scheduling nodes in the edge node cluster form an intra-cluster snapshot consensus group, which is used to consensus the execution status of the tasks in the cluster on the chain. In addition, a scheduling node (a scheduling node with high bandwidth and strong computing power) is selected from each edge node cluster as a super node. While executing the work of the scheduling node, it also forms an inter-cluster snapshot consensus group with super nodes in other edge node clusters to consensus the execution status of cross-cluster tasks on the chain.
[0064] For example, in a system with 1,000 edge nodes evenly distributed in physical space, the edge nodes can be divided into 10 edge node clusters according to physical space, with 100 edge nodes in each cluster. Among them, edge nodes with strong computing, storage, and communication capabilities have the ability to become scheduling nodes and can better complete the work of scheduling nodes. In the initial state of each cluster, several edge nodes with qualified performance are selected as scheduling nodes to manage the remaining edge nodes, and the remaining edge nodes are working nodes. It should be noted that the number of scheduling nodes in different clusters can be the same or different. In a cluster, after the scheduling node is selected, it establishes a connection with the working node and starts to manage the working node. The number of working nodes managed by different scheduling nodes can also be the same or different.
[0065] For the same cluster, all scheduling nodes in the cluster form an intra-cluster consensus group. Then these scheduling nodes will communicate with each other and reach consensus on the execution status of the tasks within the cluster. Each scheduling node in the same cluster will also have a snapshot chain with completely consistent data, which is called the intra-cluster snapshot chain. For different clusters, since each cluster will select a scheduling node with strong computing power and large bandwidth as a super node to participate in the inter-cluster consensus group, these super nodes will also communicate with each other and reach consensus on the execution status of cross-cluster tasks. These super nodes will also have a snapshot chain with completely consistent data, which is called the inter-cluster snapshot chain.
[0066] Next, the specific structure of the scheduling node and the working node is introduced as follows:
[0067] (1) A scheduling node communicates with other scheduling nodes in the cluster through the network, and communicates with the worker nodes it manages through the network. Figure 2 , which specifically include:
[0068] The work node management module is the only channel for the scheduling node and the work node to interact. It is used to maintain and manage the work nodes in the cluster that are connected to the scheduling node, and to issue task execution commands to the corresponding work nodes according to the task scheduling information issued by the task scheduling module.
[0069] The task scheduling module is used to obtain the resource information and service deployment information of each working node managed by the scheduling node by accessing the data storage module, perform task scheduling based on the information, and submit the task scheduling information of the working nodes managed by the scheduling node to the working node management module;
[0070] A data storage module is used to store the resource information and service deployment information of all working nodes managed by the scheduling node, the information of other scheduling nodes in the intra-cluster snapshot consensus group, and historical and real-time generated task scheduling information; if the scheduling node is a super node, the data storage module also stores the information of other super nodes in the inter-cluster snapshot consensus group;
[0071] The consensus module is used to package the task execution status of the working nodes that execute the tasks within the group managed by the scheduling node according to the blocks, reach a consensus with other scheduling nodes in the snapshot consensus group within the group on the packaged block data, and store it as a snapshot chain in a chain structure, and calculate the income of the current consensus on the chain within the group, and adjust the size of the next packaged block according to the income value; if the scheduling node is a super node, the consensus module is also used to package the task execution status of the working nodes that execute cross-group tasks in the cluster to which it belongs, and reach a consensus with other super nodes in the snapshot consensus group between groups on the packaged block data, and store it as a snapshot chain in a chain structure, and calculate the income of the current consensus on the chain between groups, and adjust the size of the next packaged block according to the income value;
[0072] The scheduling node communication module is used to request assistance from other scheduling nodes in the snapshot consensus group within the cluster when the working node managed by the scheduling node cannot complete the task. If all working nodes in the cluster cannot complete the task, they request assistance from the super node in the cluster. The super node in the cluster requests assistance from other super nodes in the snapshot consensus group between clusters through its own scheduling node communication module.
[0073] The fault resistance module is used to select a working node with identity conversion function and closest to the failed and disconnected scheduling node through negotiation with other normal scheduling nodes when the scheduling node determines that a scheduling node in the snapshot consensus group in the group has failed and lost connection. The fault resistance module of the scheduling node responsible for managing the working node sends an identity conversion command to the working node and copies the currently stored snapshot chain in the group to the working node, making it a new scheduling node.
[0074] (2) Worker nodes communicate with the scheduling node responsible for managing them through the network. All worker nodes include a node matching module and a task execution module, while some worker nodes also include an identity conversion module. Figure 3 .
[0075] The node matching module is used to find nearby scheduling nodes that can manage it, establish connections to complete node matching, and maintain heartbeat detection; and, when the working node receives a matching broadcast from other scheduling nodes, it determines whether the matched scheduling node has been abandoned by the snapshot consensus group in the group based on the member information of the current snapshot consensus group in the matching broadcast. If so, it establishes a matching relationship with the scheduling node that sent the matching broadcast;
[0076] The task execution module is used to receive the task execution command issued by the scheduling node responsible for its management, and feed back the task execution result to the scheduling node;
[0077] The identity conversion module is used to convert the identity from a working node to a scheduling node after receiving an identity conversion command issued by the scheduling node it manages, replace the failed scheduling node to join the snapshot consensus group in the group, receive a copy of the snapshot chain in the group, and initiate a matching broadcast of the establishment request to the working nodes nearby, where the matching broadcast carries the member information of the snapshot consensus group in the current group.
[0078] When the above scheduling system is initially established, each working node can search for nearby scheduling nodes that can manage it through broadcasting, and maintain heartbeat detection information after handshake connection. When a scheduling node fails and loses connection, other scheduling nodes in the snapshot consensus group of the cluster to which it belongs will detect the disconnection status of the scheduling node. At this time, these normal scheduling nodes will communicate and negotiate to select a working node with identity conversion function and closest to the scheduling node that fails and loses connection. The scheduling node that manages the working node issues an identity conversion command to convert it to a new scheduling node, and copies the snapshot chain in the cluster saved locally to the new scheduling node. The new scheduling node will initiate a matching broadcast to establish a connection to the nearby working nodes. The matching broadcast is accompanied by the current snapshot consensus group member information in the group. The working node that receives the broadcast will check whether the scheduling node that it has matched has been abandoned according to the snapshot consensus group member information in the current group. If so, it will establish a matching relationship with the new scheduling node. If not, it will ignore the broadcast. After the new scheduling node is established, it can know which tasks have been scheduled but not completed according to the copied snapshot chain, so as to continue to track the execution status of the working node and perform subsequent task scheduling.
[0079] Based on the above scheduling system, this embodiment also provides a decentralized task scheduling method, see Figure 4 , which includes the following implementation process:
[0080] S1. Receive tasks, perform task scheduling, and store the generated task scheduling information in a DAG graph;
[0081] In this step, the user inputs the target requirement to be completed through the client, and the target requirement is sent to a scheduling node that communicates with the client. The scheduling node decomposes the target requirement into multiple "tasks", some of which are parallel and some of which are dependent on each other. The specific decomposition method belongs to the existing technology and will not be repeated here.
[0082] Then, it is necessary to perform high-performance scheduling on these tasks. Since the services deployed by the working nodes in different clusters may be different, and the computing resources and deployed services of different working nodes in the same cluster may also be different, for a certain task, there may be three situations for the execution of its task: (1) It may be completed by the working node managed by the scheduling node, in which case there is no need to cross the scheduling node; (2) There may also be a situation where the working node managed by the scheduling node cannot complete the task due to the lack of deployed services. In this case, it is necessary to cross the scheduling node, but it is still completed within the cluster; (3) There may also be a situation where the working nodes within the cluster cannot complete the task and the working nodes of other clusters are required to complete it. In this case, it is necessary to cross the cluster. In the present invention, the tasks in the above-mentioned situations (1) and (2) are collectively referred to as "intra-group tasks", and the tasks in the situation (3) are individually referred to as "cross-group tasks".
[0083] High-performance scheduling requires that tasks be assigned to working nodes that are capable of completing the task in the shortest time according to the service deployment of the working nodes and the current resource usage. Accordingly, the scheduling node first determines whether the working nodes it manages can complete the task based on the services deployed by the working nodes it manages. If it can, the task is scheduled to the appropriate working node; if none of the working nodes it manages can complete the task, the scheduling node first requests assistance from other scheduling nodes in the consensus group within the group. If none of the working nodes managed by other scheduling nodes in the consensus group within the group can complete the task, the scheduling node requests assistance from scheduling nodes in other clusters through the super node in the cluster.
[0084] The scheduling node can know the current resource usage of each working node it manages, and the scheduling nodes within the cluster can communicate with each other. The scheduling nodes as super nodes between different clusters can also communicate with each other. Therefore, it can predict the time required for the working node that can execute the task from receiving the task to completing the execution, select the working node that can complete the task the fastest, and assign the task to the working node for execution.
[0085] For example, in order to complete a certain target requirement, three tasks (recorded as j1, j2, and j3) need to be executed, and j3 can only be executed after j1 and j2 are completed. At this time, there are two working nodes (recorded as w1 and w2), among which w1 can complete j1 and j3, and w2 can complete j2 and j3, and at this time w1 and w2 have sufficient resources to execute tasks. Then the task scheduler will schedule the tasks as w1-j1 and w2-j2 for parallel execution, and then select the best node (assuming it is w1) from w1 and w2 according to the high-performance task scheduling strategy, and command w1-j3 to execute after the first two tasks are completed.
[0086] After high-performance task scheduling, task scheduling information will be generated, that is, which work node will execute a task. In order to more intuitively record the execution status of tasks and the dependencies between tasks, we store the task scheduling information locally in the form of a DAG graph. Each node in the DAG graph corresponds to a task, and the edges between nodes correspond to the dependencies between tasks. The initial state of each node is "scheduled".
[0087] S2, the working node executes the task, the scheduling node updates the corresponding node status in the DAG graph, and caches the task execution information;
[0088] In this step, according to the task scheduling information recorded in the DAG graph, the corresponding working node in the task scheduling information will receive the task execution command issued by the scheduling node responsible for managing it, and then execute the task, and feedback the execution status to the scheduling node that manages it. The scheduling node that manages the working node updates the node status information of the task in the DAG graph, and updates "scheduled" to "completed".
[0089] And determine the type of task. If it is an intra-group task, cache the intra-group task completion information (such as the task ID and importance weight) in the local intra-group task cache queue, and enter step S3; if it is a cross-group task, send the cross-group task completion information to the super node in the cluster, and the super node caches the cross-group task completion information in the local cross-group task cache queue, and enter step S8. It should be noted that the caching of "task completion information" in this step is only used for the subsequent calculation of cumulative weights to determine the timing of packaging and chaining the corresponding node information in the DAG graph. This information is not consensus-chained, and will be cleared when it meets the timing of packaging and chaining for re-counting.
[0090] S3. Calculate the cumulative weight of the task completion information in the group in the queue to determine whether the set packaging threshold is reached;
[0091] In this step, each scheduling node calculates the cumulative weight of the task completion information of all group tasks in the group cache queue according to the importance weight of the task completion information of each group task in its local group cache queue, and determines whether the cumulative weight reaches the set packaging threshold. If so, execute step S4; otherwise, return to step S3, wait for more task completion information to accumulate in the group task cache queue, and continue to determine whether the cumulative weight reaches the set packaging threshold.
[0092] Among them, the importance weight of the task completion information of a single task in the cache queue is mainly affected by three factors: first, the number m of the post-tasks of the task. The more post-tasks that depend on the task, the more important the task is; second, the task scheduling coefficient req. Compared with tasks that do not need to cross scheduling nodes, tasks that cross scheduling nodes are more important, and tasks that cross clusters are more important; third, the importance of the task itself i, for example, whether the task is an urgent task or an ordinary task.
[0093] Taking all the above into consideration, the importance weight of a single task completion information is calculated as follows:
[0094] importance=(i+m)*req
[0095] Among them, i is the importance of the task itself, m is the number of post-tasks of the task, and req is the scheduling coefficient of the task;
[0096] in,
[0097] According to the above formula, the importance weight of a single task in the task cache queue within the group can be calculated, and the cumulative weight of the task completion information in the queue can be obtained by adding the importance weights of all tasks in the task cache queue within the group. This cumulative weight will reflect the importance of the tasks in the entire queue, and thus reflect whether they need to be packaged in time for consensus on the chain.
[0098] The comparison object of the cumulative weight is the "packaging threshold". When the cumulative weight reaches the packing threshold, it is packed immediately. If it does not reach the threshold, it continues to wait for the cache of the execution status of the task.
[0099] S4: Pack the tasks in the group and send them to other scheduling nodes in the snapshot consensus group in the group;
[0100] In this step, for the scheduling nodes whose cumulative weight reaches the set packaging threshold, the group task information corresponding to the updated DAG graph nodes in the local DAG graph of the scheduling node since the last group task packaging is packaged into blocks, sent to other scheduling nodes in the snapshot consensus group in the group, and the cache queue is cleared. It should be noted that the "group task information" in this step is the information of the DAG graph node, which includes the task information corresponding to the node (task ID, work node information for executing tasks, task dependencies, etc.) and the task execution status image.
[0101] S6. Consensus within the group, storing blocks and forming a snapshot chain within the group;
[0102] In this step, each scheduling node in the snapshot consensus group in the group reaches a consensus on the block. If the consensus is passed, all scheduling nodes in the snapshot consensus group in the group store the block in a chain structure to form a snapshot chain in the group.
[0103] S7. The scheduling node for this block packaging calculates the revenue value generated by the consensus on the chain within the group, and readjusts the packaging threshold according to the revenue value, and returns to step S3;
[0104] In this step, the packing threshold is to be adjusted adaptively. Since the packing threshold determines the timing of packing and chaining, if the packing threshold is too large, it will lead to untimely chaining. If a scheduling node fails, many updated graph node information in the DAG graph cannot be packaged and consensus is uploaded to the chain, and the execution status information of the working node is lost. Then, when the new scheduling node takes over the failed scheduling node, it will have to repeat the scheduling of more tasks, and the working node will also repeat the execution a lot.
[0105] On the contrary, if the packing threshold is too small, it will lead to frequent consensus between scheduling nodes, occupy more network bandwidth, cause network delays, and reduce the processing speed of the system. Therefore, the adjustment of the packing threshold is to strike a balance between avoiding information loss and reducing network delays. By accumulating the weight of task importance, important tasks can be packed and chained as early as possible to reduce the cost of fault resistance.
[0106] In order to adaptively adjust the packaging threshold, we set the adjustment basis based on the "revenue" of this packaging and chaining. The revenue is negatively correlated with the waiting time from completion to packaging and chaining of all completed tasks stored in the cache queue between two clearing intervals. The shorter the waiting time from the task being stored in the cache queue to being packaged and chained, the higher the reward.
[0107] The relationship between the revenue and waiting time of a single task can be expressed by the following function, where y represents the revenue given by a single task, t represents the waiting time from when the task is stored in the cache queue to when it is packaged and uploaded to the chain, k is used to adjust the impact of the waiting time on the revenue, and p is used to adjust the magnitude of the reward:
[0108]
[0109] The total revenue generated by a package can be expressed by the following function, where thre represents the number of tasks accumulated in the cache queue when the threshold is reached:
[0110] income=y1+y2+…+y thre
[0111] Every time a consensus is completed on the chain, the packaging threshold of the task importance weight is adjusted. First, we determine the adjustment direction of the packaging threshold based on the comparison of the total revenue of this packaging calculated above and the revenue of the previous consensus on the chain:
[0112] If the revenue from this group consensus on the chain is greater than the revenue from the previous group consensus on the chain:
[0113] This means that the last adjustment direction of the packing threshold was favorable, so this time the same direction (increase or decrease) is maintained as the last adjustment. That is, if the last adjustment was to increase the threshold, this adjustment is also to increase the threshold; if the last adjustment was to decrease the threshold, this adjustment is also to decrease the threshold. In terms of the adjustment range, in order to avoid oscillation and speed up convergence, we set the current threshold adjustment range to half of the last threshold adjustment range. That is, when the threshold was adjusted last time, the threshold was increased / decreased by n units, so this threshold adjustment is increased or decreased by n / 2 (and not less than 1) units.
[0114] If the revenue from this consensus on-chain is smaller than that from the previous consensus on-chain:
[0115] This means that the last adjustment direction of the packing threshold was unfavorable, so this time the adjustment direction is opposite to the last adjustment, that is, if the last adjustment was to increase the threshold, then this adjustment is to decrease the threshold; if the last adjustment was to decrease the threshold, then this adjustment is to increase the threshold. In terms of the adjustment range, in order to avoid oscillation and speed up convergence, we set the current threshold adjustment range to half of the last threshold adjustment range, that is, when the threshold was increased / decreased by n units in the last threshold adjustment, then this threshold adjustment will decrease or increase by n / 2 (and not less than 1) units.
[0116] For example: In an edge node cluster, scheduling node a manages 10 working nodes in its initial state, and the importance threshold of Finish-Buffer is 100. At a certain moment, scheduling node a generates 100 scheduling information through high-performance task scheduling, and records these 100 scheduling information in DAG format. When working node w completes a task j, w returns the message of task completion to the scheduling node. After receiving it, the scheduling node caches the scheduling information "wj" representing the execution status of the working node into the Finish-Buffer, calculates the importance weight of "wj" and accumulates it. When the accumulated weight exceeds 100, the newer round of scheduling information is packaged into a block in combination with DAG, and scheduling node a sends the block to other scheduling nodes in the snapshot consensus group for consensus on the chain. After the chain is completed, scheduling node a will Calculate the revenue of the scheduling information cached in the Finish-Buffer. Assuming that the revenue is greater than the revenue generated by the last packaging and uploading, and the last threshold adjustment was a threshold increase of 10, then this time the threshold is increased by 5, and the importance threshold becomes 105.
[0117] S8. Calculate the cumulative weight of the cross-group task completion information in the queue to determine whether the set packaging threshold is reached;
[0118] In this step, each super node calculates the cumulative weight of the task completion information of all cross-group tasks in the cross-group task cache queue according to the importance weight of the task completion information of each cross-group task in its own local cross-group task cache queue, and determines whether the cumulative weight reaches the set packaging threshold. If so, execute step S9; otherwise, return to step S8, continue to wait for the cache of the task execution completion status, and determine whether the set packaging threshold is reached.
[0119] The calculation method of the cumulative weight is consistent with the calculation method in step S3.
[0120] S9, cross-group task packaging, and sending to other scheduling nodes of the inter-group snapshot consensus group;
[0121] In this step, for the super nodes whose cumulative weight reaches the set packaging threshold, the cross-group task information corresponding to the updated DAG graph nodes in the local DAG graph of the super node since the last cross-group task packaging is packaged into blocks, sent to other super nodes in the inter-group snapshot consensus group, and the cache queue is cleared. It should be noted that the "cross-group task information" in this step is the information of the DAG graph node, which includes the task information corresponding to the node (task ID, work node information for executing the task, task dependencies, etc.) and the task execution status.
[0122] S10, inter-group consensus, storing blocks and forming an inter-group snapshot chain;
[0123] In this step, all super nodes in the inter-group snapshot consensus group reach a consensus on the block. If the consensus is passed, all super nodes in the inter-group snapshot consensus group store the block in a chain structure to form an inter-group snapshot chain.
[0124] S11. The super node that packages this block calculates the revenue value generated by this cross-group consensus on the chain, and readjusts the packaging threshold according to the revenue value;
[0125] In this step, the super node calculates the revenue value generated by the cross-group consensus on the chain and adjusts the packaging threshold in the same way as in step S7.
[0126] Finally, it should be noted that the above embodiments are only preferred implementations and are not intended to limit the present invention. It should be pointed out that for those skilled in the art, several modifications, equivalent replacements, improvements, etc. can be made without departing from the scope of the present invention and the scope of protection of the claims, and all of these should be included in the protection scope of the present invention.
Claims
1. A decentralized task scheduling system, It is characterized in that It includes multiple edge node clusters divided by space, each edge node cluster includes multiple scheduling nodes and multiple working nodes, all scheduling nodes in the edge node cluster form an intra-cluster snapshot consensus group, and one scheduling node is selected from each edge node cluster as a super node, which, while performing the work of the scheduling node, also forms an inter-cluster snapshot consensus group with super nodes in other edge node clusters; The working node is used to maintain a heartbeat with the scheduling node responsible for managing it, accept the task scheduling of the scheduling node, execute the task and return the result to the scheduling node; and at least part of the working nodes in each edge node cluster have an identity conversion function, and when receiving an identity conversion command, their identity is converted to a scheduling node; The scheduling node is responsible for maintaining and managing the working nodes connected to it in the edge node cluster, scheduling tasks within the group, and packaging the task execution status of the working nodes that execute tasks within the group under its management according to blocks, and consolidating the packaged block data with other scheduling nodes in the snapshot consensus group within the group, calculating the benefits of this consensus on the chain, and adjusting the size of the next packaged block according to the benefit value; and is responsible for resisting failures when other scheduling nodes in the snapshot consensus group within the group fail; The super nodes participating in the inter-cluster snapshot consensus group are also responsible for executing cross-cluster task scheduling, packaging the task execution status of the working nodes that execute cross-cluster tasks in their clusters into blocks, and consolidating the packaged block data with other super nodes in the inter-cluster snapshot consensus group. The benefits of this consensus chain are calculated, and the size of the next packaged block is adjusted according to the benefit value.
2. A decentralized task scheduling system as claimed in claim 1, It is characterized in that The scheduling node includes: The work node management module is the only channel for the scheduling node and the work node to interact. It is used to maintain and manage the work nodes in the cluster that are connected to the scheduling node, and to issue task execution commands to the corresponding work nodes according to the task scheduling information issued by the task scheduling module. The task scheduling module is used to obtain the resource information and service deployment information of each working node managed by the scheduling node by accessing the data storage module, perform task scheduling based on the information, and submit the task scheduling information of the working nodes managed by the scheduling node to the working node management module; A data storage module is used to store the resource information and service deployment information of all working nodes managed by the scheduling node, the information of other scheduling nodes in the intra-cluster snapshot consensus group, and historical and real-time generated task scheduling information; if the scheduling node is a super node, the data storage module also stores the information of other super nodes in the inter-cluster snapshot consensus group; The consensus module is used to package the task execution status of the working nodes that execute the tasks within the group managed by the scheduling node according to the blocks, reach a consensus with other scheduling nodes in the snapshot consensus group within the group on the packaged block data, and store it as a snapshot chain in a chain structure, and calculate the income of the current consensus on the chain within the group, and adjust the size of the next packaged block according to the income value; if the scheduling node is a super node, the consensus module is also used to package the task execution status of the working nodes that execute cross-group tasks in the cluster to which it belongs, and reach a consensus with other super nodes in the snapshot consensus group between groups on the packaged block data, and store it as a snapshot chain in a chain structure, and calculate the income of the current consensus on the chain between groups, and adjust the size of the next packaged block according to the income value; The scheduling node communication module is used to request assistance from other scheduling nodes in the snapshot consensus group within the cluster when the working node managed by the scheduling node cannot complete the task. If all working nodes in the cluster cannot complete the task, they request assistance from the super node in the cluster. The super node in the cluster requests assistance from other super nodes in the snapshot consensus group between clusters through its own scheduling node communication module. The fault resistance module is used to select a working node with identity conversion function and closest to the failed and disconnected scheduling node through negotiation with other normal scheduling nodes when the scheduling node determines that a scheduling node in the snapshot consensus group in the group has failed and lost connection. The fault resistance module of the scheduling node responsible for managing the working node sends an identity conversion command to the working node and copies the currently stored snapshot chain in the group to the working node, making it a new scheduling node.
3. A decentralized task scheduling system as claimed in claim 1 or 2, It is characterized in that The working nodes include: The node matching module is used to find nearby scheduling nodes that can manage it, establish connections to complete node matching, and maintain heartbeat detection; and, when the working node receives a matching broadcast from other scheduling nodes, it determines whether the matched scheduling node has been abandoned by the snapshot consensus group in the group based on the member information of the current snapshot consensus group in the matching broadcast. If so, it establishes a matching relationship with the scheduling node that sent the matching broadcast; The task execution module is used to receive the task execution command issued by the scheduling node responsible for its management, and feed back the task execution result to the scheduling node; The working node with identity conversion function also includes: an identity conversion module, which is used to convert the identity from a working node to a scheduling node after receiving an identity conversion command issued by the scheduling node managed by it, replace the failed scheduling node to join the snapshot consensus group in the group, and receive a copy of the snapshot chain in the group, and initiate a matching broadcast of the establishment request to the working nodes nearby, wherein the matching broadcast carries the member information of the snapshot consensus group in the current group.
4. A decentralized task scheduling method, applied to the decentralized task scheduling system as claimed in any one of claims 1 to 3, It is characterized in that The method comprises the following steps: S1. When a scheduling node in the edge node cluster receives a task, it schedules the task and generates task scheduling information and stores it locally in the form of a DAG graph. Each node in the DAG graph corresponds to a task, and the edges between nodes correspond to the dependencies between tasks. S2. According to the task scheduling information, after the working node responsible for executing the task completes the task, the scheduling node that manages the working node updates the node status information of the task in the DAG graph and determines the type of the task. If it is an intra-group task, the intra-group task completion information is cached in the local intra-group task cache queue, and the process proceeds to step S3; if it is a cross-group task, the cross-group task completion information is sent to the super node in the cluster, and the super node caches the cross-group task completion information in the local cross-group task cache queue, and the process proceeds to step S8; S3, each scheduling node calculates the cumulative weight of the task completion information of all the tasks in the task cache queue according to the importance weight of the task completion information of each task in the local task cache queue, and determines whether the cumulative weight reaches the set packaging threshold. If so, execute step S4, otherwise, return to step S3; S4. For the scheduling node whose cumulative weight reaches the set packing threshold, the task information corresponding to the updated DAG graph nodes in the local DAG graph of the scheduling node since the last group task packing is packed into blocks, and sent to other scheduling nodes in the snapshot consensus group of the group, and the cache queue is cleared; S6. Each scheduling node in the snapshot consensus group in the group reaches a consensus on the block. If the consensus is passed, all scheduling nodes in the snapshot consensus group in the group store the block in a chain structure to form a snapshot chain in the group. S7. The scheduling node for this block packaging calculates the revenue value generated by the consensus on the chain within the group, and readjusts the packaging threshold according to the revenue value, and returns to step S3; S8, each super node calculates the cumulative weight of the task completion information of all cross-group tasks in the cross-group task cache queue according to the importance weight of the task completion information of each cross-group task in its local cross-group task cache queue, and determines whether the cumulative weight reaches the set packaging threshold. If so, execute step S9, otherwise return to step S8; S9. For the super node whose cumulative weight reaches the set packaging threshold, the cross-group task information corresponding to the updated DAG graph nodes in the local DAG graph of the super node since the last cross-group task packaging is packaged into blocks, and sent to other super nodes in the inter-group snapshot consensus group, and the cache queue is cleared; S10. All super nodes in the inter-group snapshot consensus group reach a consensus on the block. If the consensus is passed, all super nodes in the inter-group snapshot consensus group store the block in a chain structure to form an inter-group snapshot chain. S11. The super node that packages the block this time calculates the revenue value generated by the inter-group consensus on the chain, and readjusts the packaging threshold according to the revenue value, and returns to step S8.
5. A decentralized task scheduling method as claimed in claim 4, It is characterized in that In step S1, the task scheduling includes: The scheduling node determines whether the working nodes it manages can complete the task based on the services deployed by the working nodes it manages. If so, it schedules the task to the appropriate working node. If none of the working nodes it manages can complete the task, the scheduling node first requests assistance from other scheduling nodes in the consensus group within the group. If none of the working nodes managed by other scheduling nodes in the consensus group within the group can complete the task, the scheduling node requests assistance from scheduling nodes in other clusters through the super node in the cluster.
6. A decentralized task scheduling method as claimed in claim 4, It is characterized in that The scheduling to the appropriate working node includes: The scheduling node predicts the time required for a working node that can execute the task to complete the task from the time it receives the task to the time it completes the task based on the services deployed by the working nodes it manages and the current resource usage information. It then selects the working node that can complete the task the fastest and assigns the task to the working node for execution.
7. A decentralized task scheduling method as claimed in claim 4, It is characterized in that In step S3, the importance weight of the task completion information of each intra-group task and in step S8, the importance weight of the task completion information of each cross-group task are calculated as follows: importance=(i+m)*req Among them, i is the importance of the task itself, m is the number of post-tasks of the task, and req is the scheduling coefficient of the task; in, 8. A decentralized task scheduling method according to any one of claims 4 to 7, It is characterized in that In step S7, the scheduling node of this block packaging calculates the revenue value generated by the intra-group consensus on the chain, and in step S11, the super node of this block packaging calculates the revenue value generated by the inter-group consensus on the chain, both of which include: Calculate the benefit y of a single task: Among them, t represents the waiting time from when the task is stored in the local cache queue to when it is uploaded to the consensus chain, k is used to adjust the impact of the waiting time on the revenue, and p is used to adjust the magnitude of the reward; According to the income of each task, calculate the total income of this consensus chain: income=y 1 +y 2 +…+and thre Where thre represents the number of tasks accumulated in the local cache queue when the packing threshold is reached.
9. A decentralized task scheduling method as claimed in claim 8, It is characterized in that In step S7 and step S11, re-adjusting the packaging threshold according to the revenue value includes: Compare the total revenue of this consensus on-chain with the total revenue of the previous consensus on-chain. If the total revenue of this consensus on-chain is greater, the adjustment direction of the packaging threshold this time is the same as the adjustment direction of the packaging threshold last time; If the total revenue of this consensus on-chain is smaller, the adjustment direction of the packaging threshold this time will be opposite to the previous adjustment direction of the packaging threshold.
10. A decentralized task scheduling method as claimed in claim 9, It is characterized in that The re-adjusting of the packaging threshold according to the revenue value also includes: The adjustment range of the packing threshold this time is half of the adjustment range of the packing threshold last time, that is, if the threshold was increased / decreased by n units during the last threshold adjustment, the adjustment range of the threshold this time is n / 2 units.
Citation Information
Cited By
Decentralization scheduling system based on dynamic election and consensus algorithm
CN119135411A
A consensus method of a decentralized dispatching system based on dynamic election
CN119135411B
Business co-scheduling method and device suitable for decentralized multi-cluster Internet of Things
CN119676184A
Business collaborative scheduling method and device suitable for decentralized multi-cluster Internet of Things
CN119676184B
