Improved distributed scheduling system and method based on gRPC communication mechanism

By using gRPC communication mechanism and heartbeat packet synchronization, the communication and state synchronization problems of distributed task scheduling systems in complex network environments are solved, enabling flexible deployment and efficient task scheduling, and improving the reliability and efficiency of the system.

CN121000765APending Publication Date: 2025-11-21北京国御网络安全技术有限公司
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511191587.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-25
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

When existing distributed task scheduling systems are deployed in a hybrid manner on public and private networks, the communication mode is fixed, the penetration capability is weak, the state synchronization relies on a strong consistency model, which increases the system complexity, and the detection of lost nodes is lagging, affecting scheduling efficiency and accuracy.

Method used

The gRPC communication mechanism is adopted. Agent nodes actively connect to the Master node and send heartbeat packets to synchronize status at regular intervals through the AES encrypted communication module. The Master node periodically detects lost nodes and reclaims tasks, reducing system complexity and ensuring status consistency and task scheduling reliability.

Benefits of technology

It enables flexible deployment in complex network environments, reduces system complexity and deployment costs, improves the availability, stability and efficiency of the scheduling system, and avoids task backlog and scheduling errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121000765A_ABST
    Figure CN121000765A_ABST
Patent Text Reader

Abstract

The invention discloses an improved distributed scheduling system and method based on a gRPC communication mechanism. The method comprises the following steps: step 1, system initialization and communication establishment; step 2, node state maintenance; step 3, task scheduling and execution; 4, returning a result and updating a state; step 5, performing lost communication detection and task recovery; according to the invention, through a reverse mode that the Agent is actively connected with the Master, the system can be flexibly deployed in multiple environments such as a public network, an intranet and the like; the Agent regularly sends a heartbeat packet synchronization state, additional middleware is not needed, the system complexity and deployment cost are reduced, a high-frequency heartbeat packet synchronizes a node state in real time, it is ensured that the states of the Master and the Agent are consistent, scheduling errors are avoided, and the reliability is improved; the heartbeat of the Agent is periodically detected through the Master, task recovery and redistribution are carried out on the lost nodes, task backlog is avoided, and the availability, stability and efficiency of the system in a complex network environment are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of distributed task scheduling, in particular to an improved distributed scheduling system and method based on a gRPC communication mechanism. BACKGROUND

[0002] With the rapid development of distributed computing technology, multi-node collaborative task scheduling systems are increasingly widely used in the fields of big data processing, distributed service deployment, etc. Efficient node communication and task scheduling mechanism are the core of ensuring the stable operation of such systems. In the prior art, inter-node communication is mostly dependent on HTTP REST interfaces or message queues (such as Kafka, RabbitMQ). Such solutions perform well in scenarios with stable central clusters and clear network structures, but in complex network environments such as mixed public and internal network deployment, the following defects exist: first, the communication mode is fixed and the penetration ability is weak, and the existing solutions often require the master node to actively connect to the slave node, but when the slave node is deployed in the internal network and cannot be passively exposed to the service, it is difficult to establish communication; second, state synchronization relies on a strong consistency model, and some solutions need to introduce additional state synchronization middleware such as Etcd, Zookeeper, etc., increasing the system complexity and deployment cost, and the slave node state feedback has a delay, which may cause the task scheduling state to be inconsistent, affecting the scheduling accuracy and efficiency; third, the detection of lost nodes is lagging, and when the network is unstable or the node is temporarily unavailable, due to the lack of efficient lost node detection and task redistribution mechanism, it is easy to cause the task to be suspended for a long time, affecting the scheduling efficiency. SUMMARY

[0003] The present application aims to provide an improved distributed scheduling system and method based on a gRPC communication mechanism to solve the problems raised in the background art.

[0004] To achieve the above-mentioned purpose, the present application provides the following technical solution: an improved distributed scheduling system based on a gRPC communication mechanism, comprising a Master node, an AES encryption communication module, an Agent node and a database, the Master node establishes data connection with multiple Agent nodes through the AES encryption communication module, and the Master node establishes data connection with the database.

[0005] Preferably, the Master node is provided with a gRPC server, and the gRPC server is provided with an authentication interface, a heartbeat synchronization interface, a state maintenance module, a scheduling management module, a task allocation module, a disconnection detection module and a task recovery module. The gRPC server is used to start and listen to the gRPC service, receive the connection request of the Agent node, and provide a remote calling interface. The authentication interface is used to receive the Token reported by the Agent node for identity authentication. The heartbeat synchronization interface is used to receive the state information of the Agent node. The state maintenance module is used to receive and store the heartbeat packet data of the Agent node in real time, and maintain the node state. The scheduling management module is used to plan the whole process of task scheduling. The task allocation module is used to allocate tasks. The disconnection detection module is used to judge whether the Agent node is disconnected. The task recovery module is used to recover the unfinished tasks and put them into the waiting scheduling queue again.

[0006] Preferably, the state maintenance module comprises an authentication unit and a node state synchronization unit. The authentication unit is used to verify the identity of the Agent node. The node state synchronization unit is used to synchronize the node state to the database.

[0007] Preferably, the scheduling management module comprises a task list query unit, a task type screening unit, a task legality verification unit and a permission control unit. The task list query unit is used to query the task list. The task type screening unit is used to screen the task type. The task legality verification unit is used to verify the task legality. The permission control unit is used to compare the Token of the Agent node with the Token of the user to which the task belongs, so as to ensure that the task is only allocated to the Agent node of the legal user.

[0008] Preferably, the task allocation module comprises a task extraction unit, a task packaging unit, a task splitting unit and a task issuing unit. The task extraction unit is used to extract the task type, the task parameter and the target data. The task packaging unit is used to package the task into a safe data structure. The task splitting unit is used to split the large data volume task. The task issuing unit is used to issue the task.

[0009] Preferably, the Agent node is provided with a gRPC client, and the gRPC client is provided with an identity authentication module, a heartbeat reporting module, a task execution engine and a result feedback module. The gRPC client is used to connect the Master node. The identity authentication module is used to report the Token for identity authentication and the node basic information to the Master node. The heartbeat reporting module is used to send the heartbeat packet to the Master node at regular intervals. The task execution engine is used to receive the task issued by the Master node, analyze the task type, parameter and data. The result feedback module is used to feedback the result to the Master node after the task is executed.

[0010] An improved distributed scheduling method based on gRPC communication mechanism, comprising the following steps: step one, system initialization and communication establishment; step two, node state maintenance; step three, task scheduling and execution; step four, result feedback and state update; step five, disconnection detection and task recovery.

[0011] In the above step one, the Master node starts and listens to the gRPC service, and is ready to accept the connection request of the Agent node, and the Agent node initiates the connection request to the Master node actively through gRPC;

[0012] In the above step two, the Agent node connected successfully sends a heartbeat packet to the Master node at regular intervals, and the Master node receives the heartbeat packet and updates the state information of the corresponding Agent node in the database;

[0013] In the above step three, the Master node listens to the state of the Agent node and allocates tasks, and the Agent node receives and executes the tasks;

[0014] In the above step four, after the task execution is completed, the Agent node returns the result to the Master node through gRPC, and the Master node stores the result in the database and updates the state of the Agent node in the database to waiting;

[0015] In the above step five, the Master node detects the last heartbeat time of all Agent nodes at regular intervals, and if the last heartbeat time of the Agent node exceeds the threshold value, the Master node determines that the Agent node has been disconnected, marks the state of the Agent node as close, and puts the unfinished tasks allocated to the Agent node back into the database, waiting for other Agent nodes to request execution; if the disconnected Agent node reconnects to the Master node after the network is restored, the Master node will not process the previous task result, but only allocate new tasks.

[0016] Preferably, in the above step one, the Master node and the Agent node communicate through the AES encryption channel provided by the AES encryption communication module.

[0017] Preferably, in the above step two, the heartbeat packet carries node state and machine state information.

[0018] Preferably, in the third step, specifically: when the Master node detects that the state of the Agent node is waiting, the Master node obtains the unprocessed assets from the database and distributes the corresponding task to the Agent node, and stores the distribution record to the database; after the Agent node receives the task, the state is updated from waiting to running, and the Agent node starts to execute the task, and during the execution, the Agent node still sends the heartbeat packet of the current state to the Master node periodically.

[0019] Compared with the prior art, the beneficial effects of the present application are: the reverse mode of the Agent actively connecting the Master makes the system flexible to deploy in multiple environments such as public networks and intranets; the Agent sends the heartbeat packet to synchronize the state periodically, without additional middleware, which reduces the system complexity and deployment cost, the high-frequency heartbeat packet synchronizes the node state in real time, ensures that the Master and the Agent are consistent in state, avoids scheduling errors, and improves reliability; through the periodic detection of the Master on the Agent heartbeat, the task is recycled and redistributed for the lost node, avoiding task backlog, and significantly improving the availability, stability and efficiency of the system in complex network environment. BRIEF DESCRIPTION OF DRAWINGS

[0020] Figure 1 It is a deployment architecture diagram of the Master node and the Agent node of the present application;

[0021] Figure 2 It is a software interface diagram of the Master node monitoring the state of the Agent node;

[0022] Figure 3 It is a flowchart of the Master node obtaining the state of the Agent node and distributing the task;

[0023] Figure 4 It is a flowchart of the Agent node returning the result to the Master node;

[0024] Figure 5 It is a flowchart of the Agent node waiting for the Master node to distribute the task;

[0025] Figure 6 It is a flowchart of the Master node of the present application detecting the disconnection of the Agent node;

[0026] Figure 7 It is a system structure block diagram of the present application;

[0027] Figure 8 It is a gRPC server structure block diagram of the present application;

[0028] Figure 9Structure block diagram of gRPC client of the present application;

[0029] Figure 10 Flow chart of the method of the present application.

[0030] In the figure: 1, Master node; 11, gRPC server; 111, identity authentication interface; 112, heartbeat synchronization interface; 113, state maintenance module; 1131, identity authentication unit; 1132, node state synchronization unit; 114, scheduling management module; 1141, task list query unit; 1142, task type screening unit; 1143, task legality verification unit; 1144, permission control unit; 115, task allocation module; 1151, task extraction unit; 1152, task packaging unit; 1153, task splitting unit; 1154, task issuing unit; 116, disconnection detection module; 117, task recovery module; 2, AES encryption communication module; 3, Agent node; 31, gRPC client; 311, identity authentication module; 312, heartbeat reporting module; 313, task execution engine; 314, result feedback module; 4, database. DETAILED DESCRIPTION

[0031] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0032] Please refer to the accompanying drawings Figure 1 -Appendix Figure 9The application provides an embodiment: an improved distributed scheduling system based on a gRPC communication mechanism, which comprises a Master node 1, an AES encryption communication module 2, an Agent node 3 and a database 4, the Master node 1 establishes data connection with multiple Agent nodes 3 through the AES encryption communication module 2, and the Master node 1 establishes data connection with the database 4; the Master node 1 is provided with a gRPC server 11, the gRPC server 11 is provided with an identity authentication interface 111, a heartbeat synchronization interface 112, a state maintenance module 113, a scheduling management module 114, a task allocation module 115, a disconnection detection module 116 and a task recovery module 117, the gRPC server 11 is used for starting and listening to a gRPC service, receiving a connection request of the Agent node 3, providing a remote calling interface, the identity authentication interface 111 is used for receiving a Token reported by the Agent node 3 for identity authentication, the heartbeat synchronization interface 112 is used for receiving state information of the Agent node 3, the state maintenance module 113 is used for receiving and storing heartbeat packet data of the Agent node 3 in real time, and maintaining the state of the node, the scheduling management module 114 is used for overall planning of a whole process of task scheduling, the task allocation module 115 is used for allocating tasks, the disconnection detection module 116 is used for judging whether the Agent node 3 is disconnected, and the task recovery module 117 is used for recovering incomplete tasks and reinserting the incomplete tasks into a to-be-scheduled queue; the state maintenance module 113 comprises an identity authentication unit 1131 and a node state synchronization unit 1132, the identity authentication unit 1131 is used for verifying the identity of the Agent node 3, and the node state synchronization unit 1132 is used for synchronizing the state of the node to the database 4; the scheduling management module 114 comprises a task list query unit 1141, a task type screening unit 1142, a task legality verification unit 1143 and a permission control unit 1144, the task list query unit 1141 is used for querying a task list, the task type screening unit 1142 is used for screening a task type, the task legality verification unit 1143 is used for verifying the legality of a task, and the permission control unit 1144 is used for comparing a Token of the Agent node 3 with a Token of a user to which the task belongs, so that the task is only allocated to the Agent node 3 of a legal user; the task allocation module 115 comprises a task extraction unit 1151, a task packaging unit 1152, a task splitting unit 1153 and a task issuing unit 1154, the task extraction unit 1151 is used for extracting a task type, a task parameter and target data, the task packaging unit 1152 is used for packaging the task into a safe data structure, the task splitting unit 1153 is used for splitting a large amount of data, and the task issuing unit 1154 is used for issuing the task.The agent node 3 is provided with a gRPC client 31, the gRPC client 31 is provided with an identity authentication module 311, a heartbeat reporting module 312, a task execution engine 313 and a result returning module 314, the gRPC client 31 is used for connecting the master node 1, the identity authentication module 311 is used for reporting Token and node basic information for identity authentication to the master node 1, the heartbeat reporting module 312 is used for sending a heartbeat packet to the master node 1 at regular time intervals, the task execution engine 313 is used for receiving a task issued by the master node 1, analyzing the task type, parameters and data, and the result returning module 314 is used for returning the result to the master node 1 after the task is executed.

[0033] Please refer to the accompanying Figure 10 An embodiment provided by the application: an improved distributed scheduling method based on a gRPC communication mechanism, comprising the following steps: step one, system initialization and communication establishment; step two, node state maintenance; step three, task scheduling and execution; step four, result returning and state updating; step five, disconnection detection and task recovery.

[0034] In the above step one, the master node 1 starts and listens to the gRPC service, and is ready to accept the connection request of the agent node 3, and the agent node 3 initiates the connection request to the master node 1 actively through the gRPC; wherein, the master node 1 and the agent node 3 communicate through the AES encryption channel provided by the AES encryption communication module 2.

[0035] In the above step two, the agent node 3 connected successfully sends a heartbeat packet to the master node 1 at regular time intervals, and the master node 1 receives the heartbeat packet and updates the state information of the corresponding agent node 3 in the database 4; wherein, the heartbeat packet carries node state and machine state information.

[0036] In the above step three, the master node 1 listens to the state of the agent node 3 and allocates tasks, and the agent node 3 receives and executes the tasks, specifically: when the master node 1 detects that the state of the agent node 3 is waiting, the master node 1 obtains the unprocessed assets from the database 4, and issues the corresponding task to the agent node 3, and stores the issuing record to the database 4; after the agent node 3 receives the task, the state is updated from waiting to running, and the agent node 3 starts to execute the task, and during the execution, the agent node 3 still sends the heartbeat packet of the current state to the master node 1 at regular time intervals.

[0037] In the above step four, after the task is completed, the Agent node 3 returns the result to the Master node 1 through gRPC, the Master node 1 stores the result in the database 4, and updates the state of the Agent node 3 in the database 4 to waiting;

[0038] In the above step five, the Master node 1 detects the last heartbeat time of all Agent nodes 3, if the last heartbeat time of the Agent node 3 exceeds the threshold value compared with the current time, the Master node 1 determines that the Agent node 3 has been disconnected, marks the state of the Agent node 3 as close, and puts the unfinished task assigned to the Agent node 3 back to the database 4 to wait for other Agent nodes 3 to request execution; if the disconnected Agent node 3 reconnects to the Master node 1 after the network is restored, the Master node 1 does not process the previous task result, and only assigns a new task.

[0039] Based on the above, the advantages of the present application are that when the application is used, first, system initialization is performed, the gRPC server 11 of the Master node 1 is started and listens to a specified TCP port, and the identity authentication interface 111 and the heartbeat synchronization interface 112 are registered; the Agent node 3 obtains system environment information, the initialization state is waiting, and initiatively initiates connection to the gRPC server 11 through the gRPC client 31, the identity authentication module 311 reports the Token, node state, CPU, memory and other basic information of itself to the state maintenance module 113 through the identity authentication interface 111, the state maintenance module 113 compares the Token reported by the Agent node 3 with the local record to verify whether the identity is legal, if the verification fails, the connection is refused; if the verification succeeds, whether the Agent node 3 is connected for the first time is checked, if it is connected for the first time, the IP address, CPU, memory and initial state are recorded; if it is not connected for the first time, the resource information and the current state are updated; if the first connection fails, the Agent node 3 retries at most twice; after the connection is successfully established, the heartbeat packet is periodically sent to the Master node 1 by the heartbeat reporting module 312, the heartbeat packet contains the current state such as waiting, running, resource usage, task scanning result and other running data, in the state maintenance module 113, the identity authentication unit 1131 is responsible for verifying the Agent identity, the node state synchronization unit 1132 synchronizes the node information to the database 4 to realize real-time state management; when the state of an Agent node 3 is marked as waiting in the heartbeat packet, the scheduling management module 114 starts the scheduling process: the task list query unit 1141 queries the task list configured by the current user to obtain the tasks to be processed, the task type filtering unit 1142 filters the tasks that do not need to be executed by the Agent node 3, for example, for the task of the type of online collection, since it does not need to rely on the Agent node 3 for execution, the task type filtering unit 1142 will automatically filter such tasks, for the task type that needs to be executed by the Agent node 3, the task legality verification unit 1143 verifies the task format and uniqueness, checks whether the task type and data format in the task configuration meet the expected standard, for example, whether the parameter format is correct, whether the task ID is unique, etc., to ensure that the task is correct before being issued, and at the same time, the permission control unit 1144 matches the Token to ensure that the task is allocated in accordance with the regulations, that is, the Token reported by the Agent node 3 is matched with the Token of the user to which the task belongs to ensure that the task can only be executed by the Agent node 3 owned by the legal user, for example, if the task is created by user A, only the Agent node 3 verified by the Token of user A is allowed to execute the task, if the Agent node 3 belongs to user B, even if it is in an idle state, it will not be assigned the task of user A, thereby avoiding cross-user resource interference;After the check passes, the task allocation module 115 intervenes, the task extraction unit 1151 extracts the qualified task, and the task packaging unit 1152 performs secure packaging, the task distribution unit 1154 distributes the packaged task to the target Agent node 3 through the gRPC channel, synchronously writes the task distribution record to the database 4, and updates the Agent node 3 state to running; for a task with a large amount of data, for example, the number of resource entries to be processed in the task exceeds twenty, the task splitting unit 1153 will split the task: on the one hand, the task can be split into multiple sub-tasks and distributed to multiple Agent nodes 3 to improve concurrent processing capability; on the other hand, the task can also be segmented and distributed to the same Agent node 3 in batches to control the single execution pressure and realize dynamic load adjustment; when an Agent node 3 marks its own state as running in the heartbeat packet, the Master node 1 updates the running state, system resource information such as CPU and memory usage, and the latest heartbeat synchronization timestamp of the node in the database 4 according to the data in the heartbeat packet; after the Agent node 3 receives the task, the task execution engine 313 analyzes the task type, loads the task data and task parameters, and starts task execution, and updates the state to running, and the execution state is fed back in real time through the heartbeat packet; after the execution is completed, the result return module 314 returns the result with the heartbeat packet, the Master node 1 updates the task state and resets the Agent node 3 state to waiting; during system operation, the disconnection detection module 116 regularly checks the last heartbeat time of the Agent node 3, and when it is detected that the last heartbeat time of a certain Agent node 3 has exceeded the threshold from the current time, it is considered that the node has been disconnected or abnormally, and its state is marked as close, and it is removed from the schedulable node list to prevent it from continuing to be assigned tasks; the task recovery module 117 re-puts the unfinished tasks of the disconnected Agent node 3 into the task queue for scheduling, waits for other Agent nodes 3 in the waiting state to receive, or triggers the scheduling process again after the Agent node 3 is online again and resumes heartbeat reporting, to ensure that the task does not stay; wherein, gRPC (general remote procedure call, gRPC Remote Procedure Call), CPU (central processing unit, Central Processing Unit), TCP (transmission control protocol, Transmission Control Protocol), AES (advanced encryption standard, Advanced Encryption Standard), running indicates that it is currently in task execution, waiting indicates that it is currently idle, and Token is a token for identity authentication.

[0040] It will be apparent to those skilled in the art that the application is not limited to the details of the above-exemplified embodiments and that the present application can be implemented in other particular forms without departing from the spirit or essential characteristics of the present application. The embodiments should therefore be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the above description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. No reference signs in the claims should be considered as limiting the scope of the claims with respect to the figures of the patent document.

Claims

1. An improved distributed scheduling system based on gRPC communication mechanism, comprising a Master node (1), an AES encryption communication module (2), an Agent node (3) and a database (4), characterized in that: The Master node (1) establishes a data connection with a plurality of Agent nodes (3) through an AES encryption communication module (2), and the Master node (1) establishes a data connection with a database (4).

2. The improved distributed scheduling system based on gRPC communication mechanism according to claim 1, characterized in that: The Master node (1) is provided with a gRPC server (11), the gRPC server (11) is provided with an identity authentication interface (111), a heartbeat synchronization interface (112), a state maintenance module (113), a scheduling management module (114), a task allocation module (115), a disconnection detection module (116) and a task recovery module (117), the gRPC server (11) is used to start and listen to the gRPC service, receive the connection request of the Agent node (3), provide a remote call interface, the identity authentication interface (111) is used to receive the Token reported by the Agent node (3) for identity authentication, the heartbeat synchronization interface (112) is used to receive the state information of the Agent node (3), the state maintenance module (113) is used to receive and store the heartbeat packet data of the Agent node (3) in real time, maintain the node state, the scheduling management module (114) is used to plan the whole process of task scheduling, the task allocation module (115) is used to allocate tasks, the disconnection detection module (116) is used to judge whether the Agent node (3) is disconnected, and the task recovery module (117) is used to recover the unfinished tasks and re-enter the waiting scheduling queue.

3. The improved distributed scheduling system based on gRPC communication mechanism according to claim 2, characterized in that: The state maintenance module (113) includes an identity authentication unit (1131) and a node state synchronization unit (1132), the identity authentication unit (1131) is used to verify the identity of the Agent node (3), and the node state synchronization unit (1132) is used to synchronize the node state to the database (4).

4. The improved distributed scheduling system based on gRPC communication mechanism according to claim 2, characterized in that: The scheduling management module (114) includes a task list query unit (1141), a task type screening unit (1142), a task legality verification unit (1143) and a permission control unit (1144), the task list query unit (1141) is used to query the task list, the task type screening unit (1142) is used to screen the task type, the task legality verification unit (1143) is used to verify the task legality, and the permission control unit (1144) is used to compare the Token of the Agent node (3) with the Token of the user to which the task belongs, so that the task is only allocated to the Agent node (3) of the legal user.

5. The improved distributed scheduling system based on gRPC communication mechanism according to claim 2, characterized in that: The task allocation module (115) includes a task extraction unit (1151), a task packaging unit (1152), a task splitting unit (1153) and a task issuing unit (1154), the task extraction unit (1151) is used to extract the task type, the task parameter and the target data, the task packaging unit (1152) is used to package the task into a safe data structure, the task splitting unit (1153) is used to split the large data volume task, and the task issuing unit (1154) is used to issue the task.

6. The improved distributed scheduling system based on gRPC communication mechanism according to claim 1, characterized in that: The Agent node (3) is provided with a gRPC client (31), the gRPC client (31) is provided with an identity authentication module (311), a heartbeat reporting module (312), a task execution engine (313) and a result returning module (314), the gRPC client (31) is used for connecting the Master node (1), the identity authentication module (311) is used for reporting Token for identity authentication and node basic information to the Master node (1), the heartbeat reporting module (312) is used for sending a heartbeat packet to the Master node (1) at regular intervals, the task execution engine (313) is used for receiving a task issued by the Master node (1), analyzing the task type, parameters and data, and the result returning module (314) is used for returning the result to the Master node (1) after the task execution is completed.

7. An improved distributed scheduling method based on a gRPC communication mechanism, comprising the following steps: step one, system initialization and communication establishment; step two, node state maintenance; step three, task scheduling and execution; step four, result returning and state updating; step five, disconnection detection and task recovery; characterized in that: In step one, the Master node (1) starts and listens to the gRPC service, prepares to accept the connection request of the Agent node (3), and the Agent node (3) initiates the connection request to the Master node (1) actively through the gRPC; In step two, the Agent node (3) that has successfully connected sends a heartbeat packet to the Master node (1) at regular intervals, and the Master node (1) receives the heartbeat packet and updates the state information of the corresponding Agent node (3) in the database (4); In step three, the Master node (1) listens to the state of the Agent node (3) and assigns tasks, and the Agent node (3) receives and executes the tasks; In step four, after the task execution is completed, the Agent node (3) returns the result to the Master node (1) through the gRPC, the Master node (1) stores the result in the database (4), and updates the state of the Agent node (3) in the database (4) to waiting; In step five, the Master node (1) detects the last heartbeat time of all Agent nodes (3) at regular intervals, if the last heartbeat time of the Agent node (3) exceeds the threshold value compared with the current time, the Master node (1) determines that the Agent node (3) has been disconnected, marks the state of the Agent node (3) as close, and puts the unfinished tasks assigned to the Agent node (3) back into the database (4) to wait for other Agent nodes (3) to request execution; if the disconnected Agent node (3) reconnects to the Master node (1) after the network is restored, the Master node (1) does not process the previous task result, but only assigns new tasks.

8. The improved distributed scheduling method based on gRPC communication mechanism according to claim 7, characterized in that: In the step one, the Master node (1) and the Agent node (3) communicate through the AES encryption channel provided by the AES encryption communication module (2).

9. The improved distributed scheduling method based on gRPC communication mechanism according to claim 7, characterized in that: In the step two, the heartbeat packet carries the node state and the machine state information.

10. The improved distributed scheduling method based on gRPC communication mechanism according to claim 7, characterized in that: In the step three, specifically, when the Master node (1) detects that the state of the Agent node (3) is waiting, the Master node (1) obtains the unprocessed assets from the database (4) and issues the corresponding task to the Agent node (3), and stores the issuing record to the database (4); after the Agent node (3) receives the task, the state is updated from waiting to running, and the Agent node (3) starts to execute the task, and during the execution, the Agent node (3) still sends the heartbeat packet of the current state to the Master node (1) periodically.

Citation Information

Patent Citations

  • Optimization method and device based on various computing engine governance

    CN117667410A

  • Design method of gRPC-based information acquisition system

    CN117687809A

  • Heterogeneous server supervision method

    CN119484326A

  • Distributed processing method and system

    CN120448100A