Multi-agent cluster data distributed synchronization method
By adopting sharding structure, Gossip/SWIM protocol, TCP/UDP protocol and data labeling mechanism in the agent cluster, the problem of difficult for the agent cluster to meet high reliability, real-time and security in the real-time changing environment is achieved. Efficient data synchronization and system scalability.
Patent Information
- Application Number
- CN202411453756.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-14
AI Technical Summary
When facing a real-time changing working environment, existing agent clusters are difficult to meet the high reliability, real-time and security in the data transmission process, and the system is insufficient in scalability and maintainability.
The sharding structure, Gossip/SWIM protocol, TCP/UDP protocol and data labeling mechanism are adopted to realize distributed data synchronization of multi-agent clusters. Specific steps include determining the agent shard structure, using the Gossip/SWIM protocol for status updates and fault detection, using the TCP/UDP protocol for data communication, and achieving data consistency and scalability through incremental synchronization and domain-by-domain synchronization.
It realizes efficient communication and information interaction of multi-agent clusters, ensures real-time information sharing and task coordination, improves the system's reading and writing capabilities and concurrency performance, meets the needs of high reliability, real-time and security, and supports the system's Scalability and maintainability.
Smart Images

Figure CN119449821A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of multi-agent collaborative control, and more specifically, relates to a multi-agent cluster data distributed synchronization method. Background Art
[0002] With the development of technology, the role of intelligent agents in daily life has become increasingly prominent. It can reduce costs and improve work efficiency. More importantly, it can help people complete tasks with high risk factors, thereby reducing the impact on human life. In order to further improve fault tolerance and improve the autonomous coordination ability of intelligent agents, existing intelligent agents all adopt the working mode of intelligent agent clusters. Existing intelligent agent clusters can be mainly divided into centralized control structures and distributed control structures. The centralized control structure is that a main control unit centrally processes the data provided by other intelligent agents and then distributes it to other intelligent agents. The centralized control structure is simple, but the calculation complexity is large, the response speed is slow, and the system has weak anti-interference ability. The working state of the entire system depends on the main control unit. In the distributed control structure, intelligent agents are equal, exchange information with each other, and can autonomously process real-time data. Therefore, for intelligent agent clusters with distributed control structures, if each intelligent agent wants to achieve a global optimal solution, the distributed communication of the cluster is very important.
[0003] In the face of real-time changing working environments, the communication between intelligent clusters needs to meet the requirements of high reliability, real-time and security in the data transmission process. In addition, the intelligent distributed communication system needs to support scalability and maintainability to facilitate the subsequent expansion and maintenance of the system. Therefore, it is of great significance to propose a multi-agent cluster data distributed synchronization method that meets the above requirements. Summary of the invention
[0004] The purpose of the present invention is to provide a distributed synchronization method for multi-agent cluster data, so as to realize efficient communication and information interaction of multi-agent clusters, realize real-time information sharing, and effectively carry out task coordination and decision-making.
[0005] The technical solution for achieving the purpose of the present invention is:
[0006] A multi-agent cluster data distributed synchronization method, comprising the steps of:
[0007] Determine the agent sharding structure;
[0008] Use the Gossip / SWIM protocol to implement status updates and node failure detection in the cluster and determine the list of active agents in the cluster;
[0009] Determine the maximum message length of network transmission according to the network status, and use TCP / UDP protocol for data communication between intelligent agents;
[0010] Use incremental synchronization operations to update data information in the agent cluster;
[0011] The cluster structure and data label mechanism are used to achieve domain-based synchronization.
[0012] Furthermore, the intelligent body sharding structure includes a data router, a metadata storage area, and a sharding and backup storage area. The data router provides external access, receives external requests and transmits them to the metadata storage area. The metadata storage area contains information of all sharding nodes and configuration information of sharding functions. The sharding and backup storage area is a data storage location, and each copy of data contains backup data.
[0013] Furthermore, using the Gossip / SWIM protocol to implement status updates and node failure detection in the cluster specifically includes:
[0014] Each agent in the multi-agent cluster periodically and randomly sends messages to other agents to inquire about the status of other agents and respond to other agents' inquiries. At the same time, the node sending the message obtains data from other nodes to update its local data.
[0015] During the inquiry process, the multi-agent cluster uses the SWIM protocol. A single agent not only sends heartbeat messages to other agents, but also broadcasts the received heartbeat messages again to all other agents. In this way, each agent in the cluster can perceive the state changes and fault conditions of other agents in the cluster.
[0016] Furthermore, determining the list of active agents in the cluster specifically includes: the agent in the cluster randomly selects another agent N1 in the cluster to send a message. If the message is received within a certain period of time, it means that the agent is alive. Otherwise, if the message is not received within a certain period of time, the remaining surviving agents in the multi-agent cluster will be searched for to send a message to the N1 agent. If the message is still not received, the agent will be marked as dead, and the gossip protocol will be used to broadcast the agent status update information to remove it from the list of active agents.
[0017] Furthermore, determining the maximum message length for network transmission according to the network status specifically includes: determining the maximum message length that does not require fragmentation according to the network communication status, if the data to be transmitted is greater than the maximum message length, fragmenting according to the length, and marking the fragments.
[0018] Furthermore, the data communication between agents using TCP / UDP protocol specifically includes:
[0019] First, a confirmation mechanism is set up. When the two parties communicate, after the receiver receives the message, it returns a confirmation message to the sender to express that the data has been received successfully. If no confirmation message is returned, it means that the message was not sent or received successfully, and retransmission is performed;
[0020] Then set up the timeout retransmission and error retransmission mechanisms. Timeout retransmission means that after the sender sends data, it does not receive confirmation information after the set time. Error retransmission means that when the receiver finds that the received message is wrong or there is packet loss, the receiver needs to send a retransmission request message to the sender to get the correct message again.
[0021] Finally, the optimistic locking mechanism is used to add a timestamp to the communication information to record the latest update time of the communication data, and the timestamp is used to determine the correctness of the current operation data. If an agent in the cluster receives multiple update messages sent by the same agent in the cluster at the same time, the latest information will be selected according to the timestamp for update; if an agent in the cluster receives update messages sent by multiple other agents in the cluster at the same time, the latest message sent by each agent will be selected according to the timestamp, and then the latest message of each agent will be merged to obtain the final update information.
[0022] Furthermore, using incremental synchronization operations to update data information in the agent cluster specifically includes: first performing global synchronization to make all data of all agents in the cluster consistent, then tracking incremental changes, using the timestamp mechanism in the communication data to determine whether the data in the cluster has changed, then locating the changed data and transmitting it to the remaining agents in the cluster, and finally merging the target agent into the existing data after receiving the incremental data.
[0023] Furthermore, the use of cluster structure and data label mechanism to achieve domain synchronization specifically includes: setting a cluster structure for multi-agent cluster application scenarios, dividing the multi-agent cluster into a cluster large cluster head, cluster small cluster heads and cluster group members, the cluster large cluster head is used to coordinate the management of the cluster, and the cluster small cluster head is used to manage the nodes within the group; after setting the cluster structure, setting data labels for the required synchronized data, the data labels are divided into global synchronization labels, component synchronization labels, and intra-group synchronization labels. The global synchronization label indicates that the data is synchronized among all multi-agents in the cluster, the component synchronization label indicates that the data is synchronized between the cluster large cluster head and all cluster small cluster heads, and the intra-group synchronization label indicates that the data will be synchronized between the cluster small cluster head and all nodes in its group.
[0024] Furthermore, it also includes: recording all operations performed by the intelligent agent in cluster transmission in a log, and performing persistence and backup operations on the log data.
[0025] Furthermore, it also includes: using container technology and cloud services to containerize the intelligent agent control software, and deploying and managing it through cloud services. When the cluster is initialized, the system time of all intelligent agents in the cluster is synchronized, and the initial timestamp of the initial data is generated based on this time.
[0026] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention adopts a sharding structure to improve the read and write capabilities and concurrency performance of the system; the present invention adopts the Gossip / SWIM protocol for data communication between agents to achieve data synchronization and node fault detection in the cluster; the present invention adopts the TCP / UDP protocol for data communication between agents to reduce the communication overhead between agents, which can better meet the real-time and low latency of cluster communication; the present invention performs pre-processing and post-processing operations on data to achieve consistency and accuracy of communication data; the present invention utilizes a multi-agent cluster structure and a data label mechanism to achieve domain synchronization of multi-agent clusters, which meets the high reliability, real-time and security of data transmission between agent clusters, and supports scalability and maintainability to facilitate subsequent expansion and maintenance of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 This is a flow chart of the multi-agent cluster data distributed synchronization method proposed in the present invention.
[0028] Figure 2 A diagram of the structure for storing agent data.
[0029] Figure 3 This is a schematic diagram of incremental synchronization. DETAILED DESCRIPTION
[0030] The specific implementation of the present invention is described below in conjunction with the accompanying drawings so that those skilled in the art can better understand the present invention. It should be noted that in the following description, when the detailed description of known functions and designs may dilute the main content of the present invention, these descriptions will be omitted here.
[0031] Figure 1 : is a flow chart of the multi-agent cluster data distributed synchronization method proposed by the present invention. Figure 1 As shown, the present invention is directed to a multi-agent cluster, and the specific communication includes the following steps:
[0032] S101: Each agent adopts a sharding structure to improve the system's read and write capabilities and concurrency performance, and can also be expanded more easily. By increasing the number of nodes, the processing capacity of the multi-agent cluster can be linearly improved to meet the requirements of processing massive data. Figure 2As shown in the figure, the intelligent agent data storage structure consists of three parts, namely data routing, metadata storage area and sharding and backup storage area. Data routing provides external access, receives external requests and transmits them to the metadata storage area. The metadata storage area contains information about all shard nodes and configuration information of the sharding function. The sharding and backup storage area is the real data storage location, and each piece of data contains backup data to facilitate recovery when data is lost.
[0033] S102: Use the Gossip / SWIM protocol to implement status updates (data synchronization) and node fault detection in the cluster, and determine the list of active agents in the cluster. Each agent in the multi-agent cluster must periodically and randomly send messages to other agents to inquire about the status of other agents, and will also respond to other agents' inquiries to it. Specifically, data synchronization requires detecting nodes with information changes, and then the node chooses to contact other nodes and send its own information to them, and then other nodes update the latest information. At the same time, the node that sends information will also obtain data from other nodes to update its local data.
[0034] During the inquiry process, the multi-agent cluster uses the SWIM protocol. A single agent will not only send heartbeat messages to other agents, but also broadcast the received heartbeat messages to all other agents again. In this way, each agent in the cluster can quickly perceive the state changes and fault conditions of other agents in the cluster. Specifically, the agents in the cluster will randomly select one of the remaining agents N1 in the cluster to send information. If the message can be received within a certain period of time, it means that the node is alive. On the contrary, if the message is not received within a certain period of time, the remaining surviving agents in the multi-agent cluster will be searched for at this time to send information to the N1 agent. If the message is still not received, the node will be marked as dead, and the node status update information will be broadcast using the gossip protocol to remove it from the list of active nodes.
[0035] S103: Using TCP / UDP protocol for data communication between agents, reducing the communication overhead between agents, can better meet the real-time and low latency of cluster communication. First, determine the maximum message length that does not need to be fragmented according to the network communication status. If the data to be transmitted is greater than the maximum message length, fragment it according to the length, and mark the fragments so that it can confirm its source and order when receiving. When using the UDP protocol, since the UDP protocol cannot guarantee reliability, it is necessary to improve reliability through the following strategies. First, set up a confirmation mechanism. When the two parties communicate, after the receiver receives the message, it needs to return a confirmation message to the sender to express that the data is successfully received. If the confirmation message is not returned, it means that the message is not sent and received successfully, and it needs to be retransmitted. Then set the timeout and error retransmission mechanism. The timeout retransmission means that after the sender sends the data, the confirmation information is not received after the set time, and the error retransmission means that when the receiver finds that the received message is wrong or there is a packet loss, the receiver needs to send a message requesting retransmission to the sender to re-acquire the correct message. Finally, the optimistic locking mechanism is used to ensure the consistency of communication data of the multi-agent cluster in a multi-threaded environment. The update_at timestamp is added to the communication information to record the latest update time of the communication data, and the correctness of the current operation data is determined by the update_at timestamp. If an agent in the cluster receives multiple update messages sent by the same agent in the cluster at the same time, the latest message will be selected according to the timestamp for update. If an agent in the cluster receives update messages sent by multiple other agents in the cluster at the same time, the latest message sent by each agent is selected according to the timestamp, and then the latest message of each agent is merged to obtain the final update information.
[0036] S104: During the data synchronization process, the data is pre-processed and post-processed accordingly to achieve consistency and accuracy of the communication data. The most important of these is the incremental synchronization operation. The incremental synchronization operation is used to update the data information in the multi-agent cluster. Incremental synchronization is to compare the data differences between the old and new communication messages, and then only the changed part of the data needs to be synchronized, thereby reducing the amount of data synchronization transmission and synchronization time. Figure 3 As shown in the figure, the steps of incremental synchronization are as follows: first, perform global synchronization to make all data of all agents in the cluster consistent, then track the incremental changes, use the timestamp mechanism in the communication data to determine whether the data in the cluster has changed, then locate the changed data and transmit it to the remaining agents in the cluster, and finally, after the target agent receives the incremental data, merge it into the existing data to maintain data consistency.
[0037] S105: Use the multi-agent cluster structure and data label mechanism to achieve domain synchronization of multi-agent clusters. Establish a suitable cluster structure for the multi-agent cluster application scenario. The multi-agent cluster can be divided into a cluster head, a cluster head, and a cluster group member. The cluster head is used to manage the cluster in a coordinated manner, and the cluster head is used to manage the nodes in the group. After setting up the cluster structure, set data labels for the required synchronization data. The labels are divided into global synchronization labels, component synchronization labels, and group synchronization labels. Global synchronization label data indicates that the data will be synchronized in all multi-agents in the cluster. Component synchronization label data indicates that the data will be synchronized between the cluster head and all cluster heads. Group synchronization label data indicates that the data will be synchronized between the cluster head and all nodes in its group.
[0038] S106: By establishing a complete log system, it is convenient to troubleshoot data synchronization behavior. It is necessary to record all the operations performed by the agent in the cluster in the log, and finally persist and back up the log data to ensure the stability and reliability of the log system. The log system can improve the ability of the multi-agent cluster to solve problems during the communication process.
[0039] S107: Use container technology and cloud services to containerize the agent control software, and deploy and manage it through cloud services, so that the cluster is scalable. When the cluster is initialized, the system time of all agents in the cluster is synchronized, and the initial timestamp of the initial data is generated based on this time. After that, containerization technology can be used to achieve rapid replication and expansion of agent control tasks, and the number of agent communications in the cluster can be dynamically increased or decreased according to demand.
[0040] This embodiment also provides a computer storage medium, which stores an executable program, and the executable program is executed by a processor to implement the steps of the multi-agent cluster data distributed synchronization method.
[0041] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0042] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A multi-agent cluster data distributed synchronization method, characterized in that: Includes steps: Determine the agent sharding structure; Use the Gossip / SWIM protocol to implement status updates and node failure detection in the cluster and determine the list of active agents in the cluster; Determine the maximum message length of network transmission according to the network status, and use TCP / UDP protocol for data communication between intelligent agents; Use incremental synchronization operations to update data information in the agent cluster; The cluster structure and data label mechanism are used to achieve domain-based synchronization.
2. A multi-agent cluster data distributed synchronization method according to claim 1, characterized in that: The intelligent body sharding structure includes data routing, metadata storage area and sharding and backup storage area. The data routing provides external access, receives external requests and transmits them to the metadata storage area. The metadata storage area contains information of all sharding nodes and configuration information of sharding functions. The sharding and backup storage area is a data storage location, and each copy of data contains backup data.
3. A multi-agent cluster data distributed synchronization method according to claim 1, characterized in that: Using the Gossip / SWIM protocol to implement status updates and node failure detection in the cluster specifically includes: Each agent in the multi-agent cluster periodically and randomly sends messages to other agents to inquire about the status of other agents and respond to other agents' inquiries. At the same time, the node sending the message obtains data from other nodes to update its local data. During the inquiry process, the multi-agent cluster uses the SWIM protocol. A single agent not only sends heartbeat messages to other agents, but also broadcasts the received heartbeat messages again to all other agents. In this way, each agent in the cluster can perceive the state changes and fault conditions of other agents in the cluster.
4. A multi-agent cluster data distributed synchronization method according to claim 3, characterized in that: Determining the list of active agents in the cluster specifically includes: the agent in the cluster randomly selects another agent N1 in the cluster to send a message. If the message is received within a certain period of time, it means that the agent is alive. Otherwise, if the message is not received within a certain period of time, the remaining surviving agents in the multi-agent cluster will be searched for to send a message to the N1 agent. If the message is still not received, the agent will be marked as dead, and the gossip protocol will be used to broadcast the agent status update information to remove it from the list of active agents.
5. A multi-agent cluster data distributed synchronization method according to claim 1, characterized in that: Determining the maximum message length for network transmission according to the network status specifically includes: determining the maximum message length that does not require fragmentation according to the network communication status, if the data to be transmitted is greater than the maximum message length, fragmenting according to the length, and marking the fragments.
6. A multi-agent cluster data distributed synchronization method according to claim 1, characterized in that: The data communication between agents using TCP / UDP protocol specifically includes: First, a confirmation mechanism is set up. When the two parties communicate, after the receiver receives the message, it returns a confirmation message to the sender to express that the data has been received successfully. If no confirmation message is returned, it means that the message was not sent or received successfully, and retransmission is performed; Then set up the timeout retransmission and error retransmission mechanisms. Timeout retransmission means that after the sender sends data, it does not receive confirmation information after the set time. Error retransmission means that when the receiver finds that the received message is wrong or there is packet loss, the receiver needs to send a retransmission request message to the sender to get the correct message again. Finally, the optimistic locking mechanism is used to add a timestamp to the communication information to record the latest update time of the communication data, and the timestamp is used to determine the correctness of the current operation data. If an agent in the cluster receives multiple update messages sent by the same agent in the cluster at the same time, the latest information will be selected according to the timestamp for update; if an agent in the cluster receives update messages sent by multiple other agents in the cluster at the same time, the latest message sent by each agent will be selected according to the timestamp, and then the latest message of each agent will be merged to obtain the final update information.
7. A multi-agent cluster data distributed synchronization method according to claim 1, characterized in that: The use of incremental synchronization operations to update data information in an agent cluster specifically includes: first performing global synchronization to make all data of all agents in the cluster consistent, then tracking incremental changes, using the timestamp mechanism in the communication data to determine whether the data in the cluster has changed, then locating the changed data and transmitting it to the remaining agents in the cluster, and finally merging the target agent into the existing data after receiving the incremental data.
8. A multi-agent cluster data distributed synchronization method according to claim 1, characterized in that: The use of cluster structure and data label mechanism to achieve domain synchronization specifically includes: setting up a cluster structure for multi-agent cluster application scenarios, dividing the multi-agent cluster into a cluster large cluster head, cluster small cluster heads and cluster group members, the cluster large cluster head is used to coordinate the management of the cluster, and the cluster small cluster head is used to manage the nodes within the group; after setting up the cluster structure, setting data labels for the required synchronized data, the data labels are divided into global synchronization labels, component synchronization labels, and intra-group synchronization labels. The global synchronization label indicates that the data is synchronized among all multi-agents in the cluster, the component synchronization label indicates that the data is synchronized between the cluster large cluster head and all cluster small cluster heads, and the intra-group synchronization label indicates that the data will be synchronized between the cluster small cluster head and all nodes in its group.
9. A multi-agent cluster data distributed synchronization method according to claim 1, characterized in that: Also includes: All operations performed by the agent during cluster transmission are recorded in the log, and the log data is persisted and backed up.
10. A multi-agent cluster data distributed synchronization method according to claim 1, characterized in that: Also includes: The agent control software is containerized using container technology and cloud services, and deployed and managed through cloud services. When the cluster is initialized, the system time of all agents in the cluster is synchronized, and the initial timestamp of the initial data is generated based on this time.