A sidecar mode communication method and communication system based on divide-and-conquer idea
By adopting the sidecar mode communication method based on the idea of partitioning and governance in industrial-level systems, using the message bus for peer-to-peer connection between devices, the problems of communication complexity and inefficiency in the prior art are solved, and high-performance and high-reliability communication effects are achieved.
Patent Information
- Application Number
- CN202411607690.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-12
AI Technical Summary
When the prior art realizes inter-process communication in industrial-grade systems, there are problems such as large number of connections, large network overhead, large memory usage and complex code implementation, resulting in low development efficiency and difficult to guarantee communication quality.
The sidecar mode communication method based on the idea of division and governance is adopted. By setting up independent main business processes and message bus service processes on the device host, the message bus is used for point-to-point or many-to-many communication, peer-to-peer connection is realized, and the reliability of nodes is improved through autonomous methods.
It realizes peer-to-peer connections between devices, reduces network communication complexity, improves communication performance and reliability, supports redundant network switching, and ensures communication quality and development efficiency.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and in particular to a sidecar mode communication method and a communication system based on a divide-and-conquer concept. Background Art
[0002] At present, there are a large number of physical nodes in the power system and other fields, such as servers, workstations, etc., and a large number of distributed programs are deployed on each physical node, and there are a lot of interactive requirements between programs. Industrial-grade systems require high reliability and real-time performance. There are usually two ways for communication between programs:
[0003] 1. Process-level peer-to-peer network solution
[0004] The message bus of this method only has a dynamic library and no service. Each process that calls the message bus dynamic library contains a complete peer node. Since there are multiple peer nodes in a machine, the port numbers of the Routers in the peer nodes must be different. The dynamic port plus dynamic discovery method is adopted. After all peer nodes are discovered, they are interconnected and the subscription information is synchronized.
[0005] Although the code implementation of this method is relatively simple, it has the following disadvantages:
[0006] 1. A large number of connections. In the ISCS system, each machine runs a large number of processes, each domain has many machines, and there are many domains across the board, which may completely reach the upper limit of the operating system resources;
[0007] 2. High network overhead, including node discovery, presence detection, group information synchronization, etc.
[0008] 3. Large memory usage. Each peer node contains the node information and subscription information of the entire peer cluster;
[0009] 4. When using UDP broadcast discovery, if the network cable of the machine is unplugged, the broadcast will not be available, and the local nodes cannot be discovered. If the Gossip protocol is used for discovery, due to the large number of nodes, the network overhead is large and the convergence speed is slow.
[0010] 2. Process-level peer-to-peer network solution with directory service
[0011] In this method, each machine sets up a directory service, which is responsible for node discovery, node information management, subscription information management, etc. The directory service between machines adopts peer-to-peer networking. The application that calls the message bus dynamic library registers with the directory service of the local machine and logs out when exiting. During this period, existence detection is performed. When the application sends a message, the message bus dynamic library queries the message target address information, such as IP, port, subscription information, etc., and then connects and sends.
[0012] Although this method centralizes node discovery, node information management, subscription information management, etc., and reduces memory and network overhead to a certain extent, even if the network cable is not plugged in, the node discovery in the local machine is not affected. However, it has the following disadvantages:
[0013] 1. The code implementation will be very complicated. For example, whether the application side caches node information and subscription information. If it does not cache, it will query the directory service before each send, which will be inefficient. If it caches, ensuring the consistency of information is a difficult problem to overcome;
[0014] 2. The number of connections is still large, and the resource limit of the operating system may still be reached;
[0015] 3. Directory services need to synchronize not only subscription information but also application process node information of each machine;
[0016] 4. The stability of the directory service is crucial.
[0017] Combining the above two solutions, since each application realizes the interaction requirements by itself, the existing technology is complex to implement, the development efficiency is low, and the quality is uneven, making it difficult to ensure the communication quality. Therefore, a reusable communication method that meets the above requirements is very necessary. Summary of the invention
[0018] In order to solve the problems in the prior art, the present invention provides a sidecar mode communication method based on the divide-and-conquer idea, and also provides a communication system using the sidecar mode communication method based on the divide-and-conquer idea.
[0019] The sidecar mode communication method based on the divide-and-conquer concept of the present invention is applied to communication between device hosts. The device hosts include a first device host and a second device host that communicate with each other. The first device host and the second device host are respectively provided with a main business process that is independent of each other and a message bus service process for communicating with an external device host. The main business process communicates with the message bus service process in a sidecar mode. The main business process is used to process various applications of the device. The message bus service processes of the first device host and the second device host communicate with each other through a message bus. The sidecar mode communication method of the first device host is:
[0020] S1: A new application business process goes online and sends business messages to the general application message library;
[0021] S2: Send messages to the message bus service process through the general application module;
[0022] S3: The message bus service process queries the bus basic library. If there is no management message for this application, it requests this application to subscribe to the message and then register with the bus service.
[0023] S4: After the bus service of the local device successfully processes the information of the new application, it sends the information to one or more second device hosts in the bus network formed with the local device via the message bus, so that the bus services of all the second device hosts have the information of the new application;
[0024] S5: The new application interacts with the second device host in the bus network through the bus service to send and receive information.
[0025] Furthermore, there are multiple second device hosts, and the first device host and multiple second device hosts communicate with each other through a message bus. The first device host and multiple second device hosts form a bus network, and each device host is a network node in the bus network.
[0026] Furthermore, the processing method of the message bus service process is:
[0027] A1: The first device host comes online and drives the process in the local machine. The local process registers the relevant subscription messages of the process with the bus service;
[0028] A2: After receiving the service message sent by the local service process, the bus service determines whether the destination node of the message is the service node of the second device host or the local service node. If it is a local message, the inter-process communication mode is adopted, and the message interaction with the destination process is performed using shared memory. If it is the second device host node, a TCP connection is established and a byte stream is sent to the destination node.
[0029] A3: After receiving the message, the message bus service process of the destination node determines whether there is a subscription match for the service. If yes, the service message is sent to the destination process; if not, the message is ignored.
[0030] Furthermore, in step A2, when it is determined to be a local message, it is determined whether there is a subscription match for the service. If yes, an inter-process communication mode is adopted to interact with the destination process using shared memory. If not, the message is ignored.
[0031] Furthermore, the device host is also provided with a service node and a disaster recovery node for realizing distributed autonomy, and both the service node and the disaster recovery node are provided with a message bus service process which is mutually connected through a message bus. The autonomy method of the device host is:
[0032] B1: When the device starts, the bus service, node management service and process management service are started at the same time;
[0033] B2: After the bus service is started, it sends heartbeat information to the node management service. In addition, during the operation of the device host, the node management service regularly checks and determines the heartbeat of each process to determine whether the message bus service process exists. If so, the master-slave switching interface of the message bus service process is called. If not, the bus service is restarted through the process management service.
[0034] Furthermore, it also includes step B3: when the business node receives business data, it sends a copy to the disaster recovery node through the bus service as backup data; the disaster recovery node will regularly check the health status message of the host. When the health status message is not received within a certain interval, or the received health status message is abnormal, the disaster recovery node is upgraded to a host node that communicates with the second device host, and communicates with the second device host.
[0035] Furthermore, when the message bus communication between the business node and the disaster recovery node is blocked, the disaster recovery node is promoted to a host node, and there are two master nodes with the original host node. Then, the processing method of the business node and the disaster recovery node is as follows: each node management service makes a dual master decision based on the received health status of the other node and its own node health status, and selects the child node with better health as the host node, and the other as the backup node.
[0036] The present invention also provides a sidecar mode communication system based on the divide-and-conquer concept, comprising a plurality of device hosts, each of which communicates using the sidecar mode communication method based on the divide-and-conquer concept.
[0037] Compared with the prior art, the present invention has the following beneficial effects: the present invention provides a machine-level peer-to-peer network solution through a message bus service, which is more suitable for actual industrial scenarios. The performance and stability of the decentralized message bus service process are crucial. The present invention is based on the divide-and-conquer concept, each machine manages itself, and utilizes the deployment and use of the bus service in the sidecar mode, thereby realizing peer-to-peer connection between devices;
[0038] Through the message bus, a simple and reliable process-to-process (local or cross-machine) interaction method is provided for business applications, shielding the complexity of network communication and supporting point-to-point and many-to-many communication;
[0039] The nodes of the present invention are connected in a peer-to-peer manner, but unlike the process-level peer-to-peer connection on the market, the present invention adopts a machine-level peer-to-peer network solution, with a bus agent on each node, and a unified port for interaction between nodes, avoiding multi-ports at the process level, which is difficult to maintain and occupies system resources, resulting in high overhead;
[0040] In actual network transmission, messages will only be transmitted to members who have subscribed to the message topic, without causing unnecessary network load. If a message has no subscribers, it will not be actually transmitted, which can effectively improve data transmission performance and reduce network consumption;
[0041] The present invention can support a large number of main body connections, HMI services of the main business process, alarm services, etc., and only interact with the bus service when necessary to deliver messages to the corresponding destination process. According to such an architecture, when the main business application is abnormal, it will not affect the bus service. As long as the bus service is normal, the normal communication between the two device hosts can be guaranteed;
[0042] In normal big data industrial scenarios, it is necessary to ensure that the nodes function normally. The present invention improves the reliability of node operation and data reliability through an autonomous method. When any site is in a network island (disconnected from other sites), the monitoring system of this site can still be guaranteed to be normal. The present invention supports redundant network switching. The caller does not need to select a network, and the message bus will deliver the message as much as possible. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the present invention or the solutions in the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0044] Figure 1 It is a schematic diagram of the topological structure of the present invention;
[0045] Figure 2 This is a schematic diagram of communication between the first device host and the second device host of the present invention;
[0046] Figure 3 This is a flow chart of the sidecar mode communication method of the present invention;
[0047] Figure 4 A schematic diagram of a service node communication method according to the present invention;
[0048] Figure 5 Schematic diagram of the autonomous method of the device host of the present invention. DETAILED DESCRIPTION
[0049] Unless otherwise defined, all technical and scientific terms used in the present invention have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs; the terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention; the terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present invention or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0050] Reference to "embodiments" in the present invention means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it mutually exclusive, independent, or alternative to other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in the present invention may be combined with other embodiments.
[0051] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.
[0052] like Figure 1 As shown, the sidecar mode communication method based on the divide-and-conquer concept of the present invention is applied to communication between device hosts. The present invention is applied to a power system, including multiple workstation nodes, and a bus service process is deployed on each host according to the configuration.
[0053] The workstation nodes communicate with each other through the message bus, and all the workstation nodes form a bus network. Preferably, in addition to a host node, each node in this example also has a backup node, which has the same function as the host node. When the host node is abnormal, the backup node is upgraded to the host node, which improves the reliability of node operation and data reliability.
[0054] like Figure 2As shown, the device hosts in this example include a first device host and a second device host that communicate with each other. In this example, the number of second device hosts can be one or more, and each device host is a network node in the bus network. Each machine host runs a message bus service process as a Broker. The process is divided into the front end (local end) and the back end (between machines). The front end communication uses the Router socket of Zero MQ, which is responsible for interacting with the local process. The back end uses peer nodes, and the machines form a peer network. The bus basic library only communicates with the local message bus service process, uses the Dealer socket, and does not contain peer nodes. The application calls the dynamic library to send the message to the local service process, and the service process then sends the message to the message bus service process or the local application of the target machine according to the target address of the message.
[0055] like Figure 3 The sidecar mode communication method of the first device host of the present invention is:
[0056] S1: A new application business process goes online and sends business messages to the general application message library (general API library);
[0057] S2: Send messages to the message bus service process through the general application module;
[0058] S3: The message bus service process queries the bus basic library. If there is no management message for this application, it requests this application to subscribe to the message and then register with the bus service.
[0059] S4: After the bus service of the local device successfully processes the information of the new application, it sends it to one or more second device hosts in the bus network formed with it through the message bus, so that the bus services of all the second device hosts have the information of the new application, so that the new application can send and receive messages in the bus network;
[0060] S5: The new application interacts with the second device host in the bus network through the bus service to send and receive information.
[0061] The working process of the second device host of the present invention is the same as that of the first device host, and will not be repeated here. The message bus service process of the present invention is an independent application process, and only performs the infrastructure function of the message bus, and is not affected by the application process of the main business. The HMI service, alarm service, etc. of the main business process will only interact with the bus service when necessary to deliver messages to the corresponding destination process. According to the architecture of the present invention, when the application of the main business is abnormal, it will not affect the bus service. As long as the bus service is normal, normal communication between the two device hosts can be guaranteed.
[0062] like Figure 4As shown, the machine-level peer-to-peer network of the present invention can effectively improve the communication performance of the device, and the specific processing method is:
[0063] A1: The first device host comes online and drives the process in the local machine. The local process registers the relevant subscription messages of the process with the bus service;
[0064] A2: After the bus service receives the business message sent by the local business service process A, it determines whether the node where the destination address of the message is located is the business node of the second device host or the local business node. If it is a local message, the inter-process communication mode is adopted, and the shared memory is used to interact with the destination process. In the power system, the local node generally directly issues control, and the business service and FES service (with control function) achieve low-latency control through the inter-process communication mode of the bus service.
[0065] If it is a second device host node, a TCP connection is established, and the compressed message is sent to the destination node in the TCP communication mode using a byte stream in the proto format;
[0066] A3: After receiving the message, the message bus service process of the destination node determines whether there is a subscription match for the service. If yes, the service message is sent to the destination process; if not, the message is ignored.
[0067] In step A2, when it is determined to be a local message, it is determined whether there is a subscription match for the service. If yes, the inter-process communication mode is adopted to exchange messages with the destination process through shared memory. If not, the message is ignored.
[0068] From the above process, it can be seen that in actual network transmission, it will only be transmitted to members who have subscribed to the message topic, which will not cause unnecessary network load. If a message has no subscribers, it will not be actually transmitted, which can effectively improve data transmission performance and reduce network consumption.
[0069] like Figure 5 As shown, each device host of the present invention is configured with a host node (also called a business node) and a backup node (also called a disaster recovery node). The business node and the disaster recovery node are both provided with a message bus service process which is mutually connected via a message bus. Through the conversion between the host node and the backup node, the self-healing and autonomy of the device host are realized, thereby improving the reliability of the device host.
[0070] The autonomous method of the device host is:
[0071] B1: Device startup, start the platform system of the device host and the related service processes of the platform system. The related service processes include node management service and process management service. When the platform system is started with one click, these two management services will also be started;
[0072] B2: After the bus service is started, it sends heartbeat information to the node management service. In addition, during the operation of the device host, the node management service regularly checks and determines the heartbeat of each process to determine whether the message bus service process exists. If so, the master-slave switching interface of the message bus service process is called. If not, the bus service is restarted through the process management service to ensure the self-healing of the bus service node on this machine.
[0073] Furthermore, in normal big data industrial scenarios, it is necessary to ensure that the nodes function normally, so the primary and standby nodes will form a logical business node to provide functional services in the system. Similarly, if the message bus of the entire platform system is to be used normally, the bus service of each logical business node must provide normal functions.
[0074] The present invention also includes:
[0075] Step B3: When receiving business data, the business node sends a copy of the backup data to the disaster recovery node through the bus service; the disaster recovery node will regularly check the health status message of the host (in this example, the keep alive mechanism of TCP is used). When the health status message is not received within a certain interval, or the received health status message is abnormal, the disaster recovery node is upgraded to a host node that communicates with the second device host and communicates with the second device host.
[0076] Preferably, when the message bus communication between the business node and the disaster recovery node is blocked, the disaster recovery node is promoted to a host node and has two master nodes with the original host node. The processing method of the business node and the disaster recovery node is as follows: each node management service makes a dual master decision based on the received health status of the other node and its own node health status, and selects the child node with better health as the host node and the other as the backup node, thereby ensuring that the logical business node has only one host node and maintaining normal operation of communication.
[0077] The present invention also provides a sidecar mode communication system based on the divide-and-conquer concept, comprising a plurality of device hosts, each of which communicates using the sidecar mode communication method based on the divide-and-conquer concept.
[0078] In summary, the present invention provides a machine-level peer-to-peer network solution for application services within and between devices through the communication mode of the message bus. This solution is a simpler and more reliable way of interaction between processes (local or cross-machine), which can shield the complexity of network communication. The present invention is based on the divide-and-conquer idea, each machine manages itself, and uses the deployment and use of bus services in the sidecar mode to achieve peer-to-peer connection between devices.
[0079] The present invention has the following innovations and advantages:
[0080] 1. Support point-to-point and many-to-many communication;
[0081] 2. Support message routing, shield network nodes (also provide the function of sending specific nodes), which can be realized by publishing and subscribing, and the implementation method is simple and convenient;
[0082] 3. Support redundant network (usually dual network) switching. The caller does not need to select a network, and the message bus will deliver the message as much as possible;
[0083] 4. Provide message atomicity. A message is either delivered in full or not received. No part of a message will be received.
[0084] 5. Have high performance, including providing high throughput (collection point), low latency (control point), low CPU and memory usage, etc. to meet the needs of energy storage business;
[0085] 6. High reliability. For example, when any site is in a network island (disconnected from other workstation nodes), the monitoring system of the site can still be guaranteed to be normal;
[0086] 7. Distributed message bus, not using centralized mode, improves disaster recovery capability;
[0087] 8. The connection between nodes is peer-to-peer, but different from the process-level peer-to-peer connection on the market, this bus adopts a machine-level peer-to-peer network solution. There is a bus agent on each node, and the nodes interact with each other through a unified port, avoiding the problem of multiple ports at the process level, which is difficult to maintain, occupies system resources, and increases overhead.
[0088] The specific implementation modes described above are preferred implementation modes of the present invention, and are not intended to limit the specific implementation scope of the present invention. The scope of the present invention includes but is not limited to the specific implementation modes, and all equivalent changes made according to the present invention are within the protection scope of the present invention.
Claims
1. A sidecar mode communication method based on the divide-and-conquer concept, applied to communication between device hosts, characterized in that: The device host includes a first device host and a second device host that communicate with each other. The first device host and the second device host are respectively provided with a main business process that is independent of each other and a message bus service process for communicating with an external device host. The main business process and the message bus service process communicate in a sidecar mode. The main business process is used to process various applications of the device. The message bus service processes of the first device host and the second device host communicate with each other through a message bus. The sidecar mode communication method of the first device host is: S1: A new application business process goes online and sends business messages to the general application message library; S2: Send messages to the message bus service process through the general application module; S3: The message bus service process queries the bus basic library. If there is no management message for this application, it requests this application to subscribe to the message and then register with the bus service. S4: After the bus service of the local device successfully processes the information of the new application, it sends the information to one or more second device hosts in the bus network formed with the local device via the message bus, so that the bus services of all the second device hosts have the information of the new application; S5: The new application interacts with the second device host in the bus network through the bus service to send and receive information. The device host is also provided with a service node and a disaster recovery node for realizing distributed autonomy. The service node and the disaster recovery node are both provided with a message bus service process which is mutually connected through a message bus. The autonomy method of the device host is: B1: When the device starts, the bus service, node management service and process management service are started at the same time; B2: After the bus service is started, it sends heartbeat information to the node management service. In addition, during the operation of the device host, the node management service regularly checks and determines the heartbeat of each process to determine whether the message bus service process exists. If so, the active / standby switching interface of the message bus service process is called. If not, the bus service is restarted through the process management service. When the message bus communication between the business node and the disaster recovery node is blocked, the disaster recovery node is promoted to a host node, and there are two master nodes with the original host node. The processing method of the business node and the disaster recovery node is as follows: the respective node management services make a dual-master decision based on the received health status of the other node and their own node health status, and select the child node with better health as the host node, and the other as the backup node.
2. The sidecar mode communication method based on the divide-and-conquer concept according to claim 1 is characterized in that: There are multiple second device hosts, and the first device host and multiple second device hosts communicate with each other through a message bus. The first device host and multiple second device hosts form a bus network, and each device host is a network node in the bus network.
3. The sidecar mode communication method based on the divide-and-conquer concept according to claim 1 is characterized in that: The processing method of the message bus service process is: A1: The first device host comes online and drives the process in the local machine. The local process registers the relevant subscription messages of the process with the bus service; A2: After receiving the service message sent by the local service process, the bus service determines whether the destination node of the message is the service node of the second device host or the local service node. If it is a local message, the inter-process communication mode is adopted to exchange messages with the destination process through shared memory. If it is the second device host node, a TCP connection is established to send a byte stream to the destination node. A3: After receiving the message, the message bus service process of the destination node determines whether there is a subscription match for the service. If yes, the service message is sent to the destination process; if not, the message is ignored.
4. The sidecar mode communication method based on the divide-and-conquer concept according to claim 3 is characterized in that: In step A2, when it is determined to be a local message, it is determined whether there is a subscription match for the service. If yes, an inter-process communication mode is adopted to use shared memory to interact with the destination process. If not, the message is ignored.
5. The sidecar mode communication method based on the divide-and-conquer concept according to any one of claims 1 to 4, characterized in that: It also includes step B3: when the business node receives business data, it sends a copy to the disaster recovery node through the bus service as backup data; the disaster recovery node will regularly check the health status message of the host. When the health status message is not received within a certain interval, or the received health status message is abnormal, the disaster recovery node is upgraded to a host node that communicates with the second device host and communicates with the second device host.
6. A sidecar mode communication system based on the divide-and-conquer concept, characterized in that: It includes several device hosts, each of which communicates using the sidecar mode communication method based on the divide-and-conquer idea as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Reconstructible distributed software bus
CN105335221A
Message processing method and device based on message middleware and storage medium
CN114385374A