Subscription message sending method and communication system
By querying subscriber information through the global service routing table to determine the optimal transmission path, and combining non-blocking mode and asynchronous message queues to optimize transmission, the latency and unreliability problems of inter-process and cross-machine communication in the power system are solved, achieving efficient and reliable communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies in power systems suffer from problems such as high CPU overhead, high transmission latency, complex system architecture, difficult maintenance, and unreliable cross-node communication in local inter-process communication and cross-machine communication.
The method adopts a subscription message sending approach, which queries the subscriber information through the global service routing table to determine the optimal transmission path, realizing a hybrid approach of local zero-copy and remote transmission. It combines non-blocking mode and asynchronous message queue to optimize the transmission path, ensuring high reliability and high elasticity.
It achieves extreme performance with zero local copy, ensuring high reliability and flexibility in cross-node communication, reducing system latency and complexity, and improving system stability and throughput.
Smart Images

Figure CN121864547A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of communication technology, and in particular to a method and system for sending subscription messages. Background Technology
[0002] Against the backdrop of the digital and intelligent transformation of power systems, data interaction within and between systems exhibits characteristics of massive volume, real-time processing, and high reliability. For example, GOOSE (Generic Object Oriented Substation Event) / SV (Sampled Value) messages between IEDs (Intelligent Electronic Devices) in smart substations, control commands between distribution master stations and substations, and phasor data in WAMS (Wide Area Measurement System A) all place extremely high demands on the real-time performance, reliability, and throughput of communication. To meet these requirements, a unified network communication architecture based on traditional middleware exists, employing a unified network stack to handle all communication. However, for inter-process communication within the same machine, data still needs to undergo a series of processes such as kernel protocol stack processing, serialization / deserialization, and memory copying, resulting in unnecessary CPU overhead and transmission latency, making it difficult to meet the real-time requirements of communication. In another approach, a simple splicing architecture of shared memory and network communication is adopted. In this architecture, the management center is only responsible for simple memory allocation, while the agent module is not responsible for local communication processing. Local communication and cross-machine communication are regarded as two independent processes, which are handled by the application or different agent modules respectively. This not only leads to a complex system architecture and difficult maintenance, but also makes it impossible to dynamically load balance based on the real-time network status in cross-node routing selection, and cannot guarantee the high reliability of cross-node communication. Summary of the Invention
[0003] This disclosure proposes a subscription message sending method and bus to solve or partially solve the above-mentioned problems.
[0004] The first aspect of this disclosure provides a method for sending subscription messages, comprising: obtaining a message for a first topic published by an application process in a first node device; querying information about subscribers of the first topic from a global service routing table of the first node device; determining an optimal transmission path to send the message to the subscriber based on the subscriber information; and notifying a communication proxy module of the first node device to send the message for the first topic to the subscriber through the optimal transmission path.
[0005] A second aspect of this disclosure provides a communication system, comprising: a first node device and a second node device. The first node device is configured with a first application process, a first communication service management center module, a first communication proxy module, and a first shared memory. The second node device is configured with a second application process, a second communication service management center module, a second communication proxy module, and a second shared memory. The first application process is used to publish a topic to the first communication service management center module. The first communication service management center module is used to implement the method described in the first aspect of this disclosure. The first communication proxy module is used to read messages related to the topic from the first shared memory and send the messages to the second node device via the optimal transmission path. The second application process is used to subscribe to messages related to the topic. The second communication proxy module is used to receive the messages and write the messages to the second shared memory. The second communication service management center module is used to notify the second application process to read the messages when it detects messages in the second shared memory.
[0006] The subscription message sending method of this disclosure, when a topic is published, queries the global service routing table of the topic publisher's node device for information on the subscribers of that topic. Based on this information, the optimal transmission path for sending messages to subscribers can be determined. Thus, the optimal transmission path can be determined based on the distribution of local and remote subscribers among the subscribers of the current topic. This realizes service discovery and routing decisions for local and cross-device communication based on the information of message subscribers. While providing extreme performance with zero local copy, it can also ensure high reliability and high flexibility of cross-node communication. Attached Figure Description
[0007] To more clearly illustrate the technical solutions in this disclosure or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0008] Figure 1 A schematic diagram of an exemplary system provided by an embodiment of this disclosure is shown.
[0009] Figure 2 A flowchart illustrating an exemplary subscription message sending method provided in an embodiment of this disclosure is shown.
[0010] Figure 3 A schematic diagram of the structure of an exemplary communication system provided in an embodiment of this disclosure is shown.
[0011] Figure 4A schematic diagram of the hardware structure of an exemplary computer device provided in an embodiment of this disclosure is shown. Detailed Implementation
[0012] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.
[0013] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this disclosure should have the ordinary meaning understood by one of ordinary skill in the art to which this disclosure pertains. The terms "first," "second," and similar terms used in the embodiments of this disclosure do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0014] It is understood that before using the technical solutions of the various embodiments in this disclosure, users will be informed of the type, scope of use, and usage scenarios of the personal information involved in an appropriate manner, and user authorization will be obtained.
[0015] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as electronic devices, applications, servers, or storage media performing the operations of this disclosed technical solution.
[0016] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0017] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0018] Figure 1A schematic diagram of an exemplary system 100 provided in an embodiment of this disclosure is shown.
[0019] like Figure 1 As shown, system 100 may include terminal device 102, terminal device 104, server 106, and database server 108. A medium (e.g., a network) may be included between terminal device 102, terminal device 104, server 106, and database server 108 to provide a communication link. This network may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0020] Various software or applications (APPs) can be installed on terminal devices 102 and 104, such as image processing software or applications, video conferencing software or applications, reading software or applications, video software or applications, social networking software or applications, payment software or applications, web browsers, and instant messaging tools. In some embodiments, these software or applications can be used to send subscription messages.
[0021] The terminal devices 102 and 104 here can be hardware or software. When terminal devices 102 and 104 are hardware, they can be various electronic devices with displays, including but not limited to smartphones, tablets, e-book readers, MP3 players, laptops, and desktop computers (PCs). When terminal devices 102 and 104 are software, they can be installed in the electronic devices listed above. They can be implemented as multiple software programs or software modules (e.g., to provide distributed services) or as a single software program or software module. No specific limitations are made here.
[0022] Server 106 can be a server that provides various services, such as a backend server that supports various applications displayed on terminal devices 102 and 104. Database server 108 can also be a database server that provides various services. It is understood that if server 106 can implement the relevant functions of database server 108, database server 108 may not need to be set up in system 100.
[0023] The server 106 and database server 108 here can be either hardware or software. When they are hardware, they can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When they are software, they can be implemented as multiple software programs or software modules (for example, to provide distributed services), or as a single software program or software module. No specific limitations are made here.
[0024] It should be noted that the subscription message sending method provided in this embodiment can be executed by terminal device 102, terminal device 104, server 106, and database server 108, or interactively executed by the devices in system 100. It should be understood that... Figure 1 The number of terminal devices, servers, and database servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, servers, and database servers can be included.
[0025] As an example scenario, data interaction within and between power systems uses a unified network stack to handle all communication. However, for inter-process communication within the same local system, assuming there are two communicating application processes, 1 and 2, in node device 102 of system 100, the data between them still needs to go through kernel protocol stack processing, serialization / deserialization, and memory copying. Obviously, this leads to unnecessary CPU overhead and transmission latency, making it difficult to meet the real-time requirements of communication. As another example scenario, a simple architecture combining shared memory and network communication is adopted. In this architecture, the management center is only responsible for simple memory allocation, while the proxy module is not responsible for local communication processing. Local communication (such as the communication between application process 1 and application process 2 in the previous example scenario) and cross-machine communication (such as the communication between node device 102, node device 104, and server 106 in system 100) are treated as two independent processes, handled separately by applications or different proxy modules. This not only leads to a complex system architecture and difficult maintenance, but also makes it impossible to dynamically load balance based on the real-time network status in cross-node routing selection, thus failing to guarantee high reliability of cross-node communication.
[0026] In view of this, embodiments of the present disclosure provide a subscription message sending method to solve or partially solve the above-mentioned problems.
[0027] Figure 2 A flowchart illustrating an exemplary subscription message sending method 200 provided in this disclosure embodiment is shown. This method 200 can be used for subscription message sending. Optionally, this method 200 can be... Figure 1 Terminal devices 102 and 104 can be implemented separately, or they can be... Figure 1 This can be implemented using server 106, or more specifically, by a communication service management center module deployed on terminal devices 102, 104, or server 106. Figure 1 The interaction between devices in System 100 is implemented.
[0028] like Figure 2 As shown, the method 200 may further include the following steps.
[0029] In step 202, the message of the first topic published by the application process in the first node device is obtained.
[0030] Optionally, the first node device may deploy various application processes corresponding to different services, a communication service management center module, a communication proxy module, and shared memory. The application processes corresponding to different services are used to publish messages for the topics corresponding to each service. The communication service management center module is used to send the messages for the topics published by each service to the communication proxy module of the first node device, so as to notify the communication proxy module to send the topic messages to the subscribers of that topic. These subscribers may be local application processes (i.e., communication between local processes) or application processes on other nodes (i.e., cross-node communication). The communication proxy module is used to send the topic messages to the subscribers of that topic. The shared memory in the first node device is managed by the communication service management center module on the first node device and is used to store the topic messages published by the first application processes. The shared memory in the second node device is managed by the communication service management center module on the second node device and is used to store the messages subscribed to by the second application processes.
[0031] Optionally, the message for the first topic obtained in step 202 above may be sent by the first process on the first node device to the communication service management center module in the first node device.
[0032] In step 204, the subscriber information for the first topic is queried from the global service routing table of the first node device.
[0033] Optionally, the GSRT (Global Service Routing Table) is the core data structure of the communication service management center module, used to store the status information of all active services in a communication system (which may include multiple node devices). The GSRT can adopt a distributed architecture; in a communication system, each node device's communication service management center module can maintain a copy of the GSRT, and ensure data consistency between copies through a distributed consistency protocol (such as the Raft protocol). Based on this, the configuration of the global service routing table can achieve unified service registration and discovery during communication within or between systems.
[0034] Furthermore, each entry in the global service routing table may contain the following fields: Topic Name: A unique identifier for the service, which can use a hierarchical namespace, such as " / substation A / protection unit / overcurrent signal".
[0035] Data type: A data structure description of the message, used for serialization and deserialization.
[0036] Local publisher: The local PID (Process Identifier) that publishes this topic, applicable only to topics with a local publisher.
[0037] Local subscriber list: A list of local process identifiers that have subscribed to this topic.
[0038] List of remote subscription nodes: A list of remote node identifiers that have subscribed to this topic.
[0039] Quality of Service (QoS) requirements include reliability (e.g., at most once, at least once, exactly once), priority (0-255), and deadline.
[0040] Optionally, based on the architecture of the global service routing table described above, the information of subscribers of the first topic retrieved from the global service routing table may include, for example, the list of local subscribers and / or the list of remote subscription nodes for the first topic.
[0041] In step 206, the optimal transmission path for sending messages to subscribers is determined based on the subscribers' information.
[0042] Optionally, the optimal transmission path can be dynamically selected based on the distribution of subscribers to the first topic. Firstly, the subscriber distribution can include: only local subscribers, only remote subscribers, and both local and remote subscribers. For the first case, the optimal transmission path can be a local zero-copy path, ensuring messages are delivered to local subscribers only via shared memory, without network transmission. For the second case, the optimal transmission path can be a remote transmission path, ensuring messages are sent only to remote subscriber nodes. For the third case, a hybrid transmission path can be used, combining local zero-copy and remote transmission paths.
[0043] In step 208, the communication proxy module of the first node device is notified to send the message of the first topic to the subscribers through the optimal transmission path.
[0044] Optionally, the communication proxy module of the first node device can be notified to send the message of the first topic to the subscriber through the optimal transmission path by issuing a routing instruction to the communication proxy module. The location of the subscriber and the information of the optimal transmission path can be indicated in the routing instruction.
[0045] The subscription message sending method of this disclosure, when a topic is published, queries the global service routing table of the topic publisher's node device for information on the subscribers of that topic. Based on this information, the optimal transmission path for sending messages to subscribers can be determined. Thus, the optimal transmission path can be determined based on the distribution of local and remote subscribers among the subscribers of the current topic. This realizes service discovery and routing decisions for local and cross-device communication based on the information of message subscribers. While providing extreme performance with zero local copy, it can also ensure high reliability and high flexibility of cross-node communication.
[0046] In one or more embodiments of this disclosure, the subscriber information may include: the number of remote subscription nodes and the number of local subscription processes. Based on this, determining the optimal transmission path for sending messages to subscribers may include: The proportion of remote subscribers is calculated based on the number of remote subscription nodes and the number of local subscription processes. R=N r / (N r +N l ); Where, N r Indicates the number of remote subscription nodes, N l R represents the number of local subscription processes, and R represents the proportion of remote subscriptions.
[0047] The type of transmission path is determined based on the proportion of remote subscribers. If the proportion of remote subscribers is zero and the number of local subscription processes is greater than zero, the optimal transmission path is determined to be the local zero-copy path. When the proportion of remote subscribers is zero, it means that there are no remote subscription nodes. The current communication is between application processes on the first node device. Therefore, the local zero-copy path can be used only, so that messages are passed to local subscribers only through shared memory and do not need to be transmitted over the network.
[0048] If the proportion of remote subscribers is 1, the optimal transmission path type is determined to be a remote transmission path; When the remote subscriber ratio is 1, it means that only remote subscription nodes exist and there are no local subscription processes. Messages are only sent to remote subscription nodes through the remote transmission path and are not stored in local shared memory (unless there are local subscribers).
[0049] When the proportion of remote subscribers is greater than 0 and less than 1, the optimal transmission path type is determined to be a hybrid transmission of local zero-copy path and remote transmission path. When the type of optimal transmission path includes remote transmission paths (i.e., when the proportion of remote subscribers is 1 or greater than 0 and less than 1), determine the available communication channels for the remote transmission path. Obtain the quality parameters of available communication channels; Optionally, in one exemplary scenario, the quality parameters of the available communication channel may include channel latency, packet loss rate, bandwidth utilization, and queue depth. In another exemplary scenario, the quality parameters of the available communication channel may include channel latency, packet loss rate, bandwidth utilization, and timeout. The following provides an exemplary description of the process for determining the optimal transmission path based on these quality parameters.
[0050] Based on the QoS requirements corresponding to the first topic, set weighting coefficients for the quality parameters of the available communication channels; Optionally, the communication service management center module can maintain a preset channel quality matrix CQM (Custom Quantization Matrix) and use a weighted scoring algorithm to calculate a quality score for each channel.
[0051] Channel quality scoring formula: For channel i, its overall quality score S i The calculation is as follows: ; Where, ω L ω P ω U ω Q ω is the weighting coefficient. L +ω P +ω U +ω Q =1, Channel delay (the time delay from when a data packet is sent to when it is received). Packet loss rate (the proportion of data packets lost). This refers to bandwidth utilization (the proportion of currently used bandwidth to the total bandwidth). Queue depth (length of the queue of data packets waiting to be transmitted) or This is the timeout period. The weighting coefficient can be dynamically adjusted according to the QoS requirements of the message; for example, based on the QoS of the control command, ω can be increased. P and ω L The weight.
[0052] The quality parameters of each available communication channel are weighted and summed based on the determined weight coefficients to obtain the communication quality score of each available communication channel; In one or more embodiments of this disclosure, the subscriber's information may further include: message timeliness requirements, based on which the optimal transmission path is determined according to the communication quality score, which may include: When the optimal transmission path is a hybrid transmission of local zero-copy path and remote transmission path, the urgency of the message's data timeliness is determined based on the data timeliness requirements in the subscriber's information. If the urgency of the message's data timeliness is less than the preset value, the message is transmitted remotely first; otherwise, the message is transmitted in parallel.
[0053] Optionally, the data timeliness requirement can be obtained from subscriber information retrieved from the global service routing table, where the data timeliness requirement can be represented as T. urgency =T deadline -T current , among which, T deadline T represents the task deadline. current T represents the current time. urgency Indicates the timeliness of the data.
[0054] In one or more embodiments of this disclosure, when the proportion of remote subscribers is greater than 0, a routing instruction is sent to the communication proxy module of the first node device via an asynchronous message queue in non-blocking mode to instruct the communication proxy module to send a message for the first topic using an asynchronous transmission task.
[0055] Non-blocking mode is a technical mode for implementing asynchronous processing in network communication. It does not require creating new threads and responds to asynchronous events such as connection requests by overloading socket event handling functions. This mode receives notification messages and parses parameters through a message dispatch mechanism, calling the corresponding processing function to complete the communication, thus avoiding main thread blocking. Based on non-blocking mode, routing instructions are sent to the communication proxy module of the first node device through an asynchronous message queue. After sending the instruction, the communication service management center module can process other service requests without waiting for the response from the communication proxy module, further improving throughput and reducing communication latency.
[0056] In one or more embodiments of this disclosure, the subscription message sending method may further include: After obtaining the message of the first topic published by the application process in the first node device, update the service information of the first topic to the global service routing table. The service information may include: the data type and QoS requirements of the first topic. Optionally, based on the structure of the global service routing table described above, the service information may further include: a unique identifier for the first topic and the local publisher, i.e., the application process that published the topic.
[0057] It should be noted that each application process in the first node device needs to register with the communication service management center module in the first node device when publishing a topic in order to achieve unified management of services.
[0058] In one or more embodiments of this disclosure, the subscription message sending method may further include: Upon receiving a subscription message for the first topic, the subscription matching degree between the subscriber and the first topic, the service quality requirement satisfaction degree, and the data pattern compatibility score are weighted and summed to obtain the matching degree between the subscriber and the first topic. Optionally, a service matching degree calculation model can be set in the global service routing table to find the most matching service during service discovery. This calculation formula can be used to calculate the matching degree between subscribers and the first topic.
[0059] Let the service request be Req and the service provider be Svc. The formula for calculating the service matching degree is as follows: M=ω T S T +ω Q S Q +ω S S S ; In the above formula, S T The topic relevance score is 1.0 for an exact match and 0.7 for a wildcard match; S Q The QoS requirement satisfaction score assesses the degree of service capability matching. S The data pattern compatibility score can be calculated based on pattern similarity, ω. T ω Q ω S Let ω be the weighting coefficient, satisfying ω T +ω Q +ω S =1.
[0060] Optionally, subscribers to the first topic can be local application processes on the first node device or application processes on other node devices.
[0061] If the match between a subscriber and the first topic is higher than the threshold, the subscriber is determined to be a valid subscriber of the first topic. Update the subscriber list for the first topic in the global service routing table.
[0062] Furthermore, if the valid subscriber is a local application process, then the local application process is added to the list of local subscription processes for the first topic in the global service routing table. For example, the unique identifier of the local application process is added to the list of local subscription processes for the first topic in the global service routing table. If the valid subscriber is a remote subscription node, then the unique identifier of the remote subscription node is added to the list of remote subscription nodes for the first topic in the global service routing table.
[0063] In one or more embodiments of this disclosure, the subscriber information retrieved from the global service routing table may further include service priority and system maximum priority. Based on this, the subscription message sending method of this disclosure may further include: After determining the optimal transmission path to send messages to subscribers based on subscriber information, if the optimal transmission path includes a remote transmission path, calculate the service priority weight corresponding to the first topic based on service priority and the system maximum priority, and optimize the transmission parameters based on the service priority weight to obtain the optimized transmission parameters. For example, service priority weights can be represented as: W p =P / P max Where P is the service priority value (ranging from 0 to 255), P max This is the system's maximum priority value (taken as 255).
[0064] Optionally, the types of transmission parameters may include buffer size, number of retransmissions, and timeout. For example, the optimized transmission parameters can be calculated based on the following formula.
[0065] Buffer size: B size =B base (1+W p ); Among them, B size For dynamically adjustable buffer size, B base Based on the buffer size, W p Service priority weights.
[0066] Number of retransmissions: N retry =N base + N W p ; N retry N represents the maximum number of retransmissions. base Based on the number of retransmissions, N is the increment for adjusting the number of retransmissions, W p Service priority weights.
[0067] Timeout period: T timeout =T base (1+1 / (W p +ε)); T timeout T is the transmission timeout period. base The base timeout time, ε is a small constant to prevent division by zero, W p Service priority weights.
[0068] In one or more embodiments of this disclosure, notifying the communication proxy module of the first node device to send the message of the first topic to the subscribers via the optimal transmission path may include: A routing instruction is sent to the communication proxy module of the first node device. The routing instruction includes: the target node device corresponding to the subscriber, the optimal transmission path, and the optimized transmission parameters.
[0069] In one or more embodiments of this disclosure, the global service routing table records and continuously updates metadata of local services and remote services. This metadata includes: topic identifiers, such as topic name, data type, local publisher identifier, such as application process identifier of topic publisher, local subscriber identifier, such as application process identifier of topic subscriber, remote subscription node address, and service quality requirement indicators.
[0070] It should be noted that both local processes and remote services need to register with the communication service management center module deployed on their respective devices to publish and subscribe to services. Based on this, after receiving the registration or subscription message, the communication service management center module can trigger the update of the global service routing table in the module.
[0071] This disclosure also provides a communication system. Figure 3 This illustration shows a schematic diagram of an exemplary communication system provided in an embodiment of the present disclosure. This communication system can be applied to power systems, such as... Figure 3 As shown, the communication system 300 includes: First node device 32 and second node device 34, the first node device 32 is a message publisher and the second node device 34 is a message subscriber. The first node device 32 is deployed with first application process 3221, first application process 3222 and first application process 3223, first communication service management center module 324, first communication proxy module 326 and first shared memory 328. The second node device is deployed with second application process 3421, second application process 3422 and second application process 3423, second communication service management center module 344, second communication proxy module 346 and second shared memory 348.
[0072] The first application process is used to publish topics to the first communication service management center module 324.
[0073] The first communication service management center module 324 is used to execute the subscription message sending method of one or more embodiments of this disclosure.
[0074] The first communication proxy module 326 is used to read messages about the topic from the first shared memory 328 and send the messages to the second node device through the optimal transmission path; The second application process is used to subscribe to messages for the topic; The second communication proxy module 346 is used to receive the message and write the message into the second shared memory 348; The second communication service management center module 344 is used to notify the second application process to read the message when the message is detected in the second shared memory 348.
[0075] In one or more embodiments of this disclosure, both the first communication service management center module and the second communication service management center module maintain a global service routing table. The global service routing tables between the first and second communication service management center modules are kept consistent through a distributed consensus protocol, such as the Raft protocol. Optionally, the communication system of this disclosure may further include multiple node devices in addition to the first and second node devices. Each node device has the same module deployed on it, and each node device's communication service management center module maintains a copy of the global service routing table. The consistency of data between the copies is ensured through a distributed consensus protocol.
[0076] The subscription message sending method of this disclosure can be applied to power systems, specifically to the intelligent message bus of a power system, and further used for data interaction within and between systems. The following, in conjunction with the structure of the aforementioned communication system, further explains the interaction process between the message publisher and message subscriber in the subscription message sending method of this disclosure.
[0077] The following example illustrates the subscription message sending method of this disclosure embodiment by taking the example of node 1 (an example of the first node device mentioned above) sending a power load control command (an example of the first topic mentioned above) to node 2 (an example of the second node device mentioned above) for cross-node communication.
[0078] The load control process of node 1 (an example of the first application process mentioned above) first registers the service with the local communication service management center module and publishes the topic " / load control / partition A / load reduction command". The local communication service management center module enters the service information into the global service routing table. The entered information can contain data of type "control command" and QoS requirement of highest reliability (priority P=255).
[0079] When the load execution process of node 2 (an example of the second node device mentioned above) subscribes to this topic, the local communication service management center module of node 1 performs a service matching degree calculation: M=ω T S T +ω Q S Q +ω S S S ; The weighting coefficient is set to ω. T =0.5、ω Q =0.3、ω S =0.2. Based on the above formula, the matching degree M = 0.95 is calculated. Assuming the threshold is set to 0.5, this matching degree is greater than the threshold, confirming that node 2 is a valid subscriber to the topic " / load control / partition A / load reduction command", and updating the list of remote subscriber nodes for this topic in GSRT.
[0080] When the load control process publishes a load control message, the local communication service management center module of node 1 queries the GSRT to obtain the subscriber distribution information: the number of local subscription processes N. l =0 and remote subscription node N r =1, calculate the remote subscription ratio: R=N r / (N r +N=)=1 / (1+0); According to the communication path determination method in the subscription message sending method of this disclosure embodiment, since R=1, the system selects a pure remote transmission path. Then, transmission parameter optimization is performed: Service priority weight: W p =P / P max =255 / 255=1; Buffer size: B size =B base (1+W p ) = 4KB × (1 + 1) = 8KB; Number of retransmissions: N retry =N base + N W p =3 + 3 × 1 = 6; Timeout period: T timeout =T base (1+1 / (W p +ε))=1000ms×(1+1 / 1.01)≈1990ms; The local communication service management center module of node 1 executes a channel quality assessment algorithm to select the best channel from the three available channels: Assume the channel quality parameters are: Channel 1: Channel latency L1=15ms, packet loss rate P1=0.01, bandwidth utilization U1=0.6, queue depth Q1=10; Channel 2: Latency L2=10ms, Packet loss rate P2=0.02, Bandwidth utilization U2=0.7, Queue depth Q2=15; Based on the QoS requirements of the control command (an example message for the above topic), set the weighting factor ω. L =0.4、ω P =0.4、ω U =0.1、ω Q =0.1. Calculate the channel quality score:
[0081] Select the optimal channel: CH optimal =argmax i (S i =Channel 1.
[0082] The local communication service management center module sends a routing instruction to the communication agent module of node 1. The instruction includes the target node (node 2), the preferred channel (channel 1), and the optimized transmission parameters (8KB buffer, 6 retransmissions, and 1990ms timeout).
[0083] The communication proxy module of node 1 reads messages from local shared memory and sends them to node 2 through channel 1.
[0084] After receiving the message, the communication agent module of node 2 writes it to the local shared memory. After the local communication service management center module of node 2 detects the new data, it notifies the process PROC2 (the second application process mentioned above) in node 2 to read it, thus completing the entire cross-node transmission process.
[0085] The entire process is coordinated and scheduled by the communication service management center modules at both ends of Node 1 and Node 2, balancing local efficiency with network intelligence. Furthermore, quantitative calculations ensure highly reliable and low-latency transmission of power control commands.
[0086] The following example illustrates the subscription message sending method of this disclosure embodiment by taking the asynchronous transmission of power load control commands between node 1 and node 2 as an example.
[0087] The load control process (PROC1) on node 1 publishes messages to the topic " / load control / partition A / load reduction command" in an asynchronous, non-blocking manner. PROC1 returns immediately after writing the message to local shared memory, without waiting for the transmission result. The communication service management center module on node 1 detects the arrival of new messages in local shared memory through an event listening mechanism and automatically triggers subsequent processing procedures.
[0088] The communication service management center module on node 1 asynchronously queries the global service routing table and identifies a remote subscriber (node 2) for this topic. It immediately generates a transmission command through the path decision engine and sends the routing command to the communication proxy module on node 1 via an asynchronous message queue. This process uses a non-blocking mode, allowing the communication service management center module to handle other service requests immediately after sending the command, without waiting for a response from the communication proxy module.
[0089] After receiving the routing instruction, the communication proxy module on node 1 starts an asynchronous transmission task to asynchronously read message data from the shared memory on node 1.
[0090] The message is distributed to node 2 through a multi-channel parallel transmission mechanism.
[0091] Using a non-blocking I / O mode, the communication proxy module can handle other message forwarding tasks simultaneously during transmission.
[0092] The communication proxy module of node 2 receives messages asynchronously through an event-driven architecture. Upon detecting the arrival of network data, it immediately writes the message to local shared memory. The entire process does not block the processing of other network connections.
[0093] The communication service management center module of Node 2 detects updates to topic data in shared memory through a background monitoring thread and sends a data ready signal to the local subscriber PROC2 using an asynchronous notification mechanism. PROC2 reads the message from shared memory at an appropriate scheduling time, achieving eventual consistency delivery. The entire transmission link adopts a fully asynchronous design, and the various components are decoupled through event-driven mechanisms and message queues, which can effectively improve system throughput and concurrent processing capabilities, ensuring the stable operation of the power system under high load conditions.
[0094] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
[0095] One or more embodiments of this disclosure also provide a non-volatile computer-readable storage medium containing a computer program that, when executed by one or more processors, causes the one or more processors to perform a subscription message sending method according to one or more embodiments of this disclosure.
[0096] This disclosure also provides a computer program product, including one or more computer programs, which, when executed by one or more processors, implement the subscription message sending method of one or more embodiments of this disclosure.
[0097] It should be noted that the method of this disclosure embodiment can be executed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method of this disclosure embodiment, and the multiple devices will interact with each other to complete the method described.
[0098] It should be noted that the above description describes some embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0099] For ease of description, the above computer devices are described in terms of function, divided into various modules. Of course, in implementing this disclosure, the functions of each module can be implemented in one or more software and / or hardware.
[0100] The computer device described in the above embodiments is used to implement the corresponding subscription message sending method in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0101] This disclosure also provides a computer device for implementing the above-described subscription message sending method. Figure 4 A schematic diagram of the hardware structure of an exemplary computer device 400 provided in an embodiment of this disclosure is shown. The computer device 400 can be used to implement... Figure 1 Server 106 can also be used to implement Figure 1 Node devices 102 and 104. In some scenarios, this computer device 400 can also be used to implement... Figure 1 Database server 108.
[0102] like Figure 4 As shown, the computer device 400 may include: a processor 402, a memory 404, a network interface 406, a peripheral interface 408, and a bus 410. The processor 402, memory 404, network interface 406, and peripheral interface 408 are interconnected within the computer device 400 via the bus 410.
[0103] Processor 402 may be a central processing unit (CPU), image processor, neural network processor (NPU), microcontroller (MCU), programmable logic device, digital signal processor (DSP), application-specific integrated circuit (ASIC), or one or more integrated circuits. Processor 402 can be used to perform functions related to the techniques described in this disclosure. In some embodiments, processor 402 may also include multiple processors integrated as a single logic component. For example, such as... Figure 4 As shown, processor 402 may include multiple processors 402a, 402b and 402c.
[0104] Memory 404 can be configured to store data (e.g., instructions, computer code, etc.). Figure 4 As shown, the data stored in memory 404 may include program instructions (e.g., one or more programs for implementing the subscription message sending method of this disclosure) and data to be processed (e.g., the memory may store configuration files of other modules, etc.). Processor 402 may also access the program instructions and data stored in memory 404 and execute the program instructions to operate on the data to be processed. Memory 404 may include volatile or non-volatile storage devices. In some embodiments, memory 404 may include random access memory (RAM), read-only memory (ROM), optical disk, magnetic disk, hard disk, solid-state drive (SSD), flash memory, memory stick, etc.
[0105] Network interface 406 can be configured to provide communication with other external devices to computer device 400 via a network. This network can be any wired or wireless network capable of transmitting and receiving data. For example, the network can be a wired network, a local wireless network (e.g., Bluetooth, WiFi, Near Field Communication (NFC), etc.), a cellular network, the Internet, or a combination thereof. It is understood that the type of network is not limited to the specific examples described above.
[0106] Peripheral interface 408 can be configured to connect computer device 400 to one or more peripheral devices to enable information input and output. For example, peripheral devices may include input devices such as keyboard, mouse, touchpad, touch screen, microphone, and various sensors, as well as output devices such as monitor, speaker, vibrator, and indicator lights.
[0107] Bus 410 can be configured to transfer information between various components of computer device 400 (e.g., processor 402, memory 404, network interface 406, and peripheral interface 408), such as internal buses (e.g., processor-memory bus), external buses (USB port, PCI-E bus), etc.
[0108] It should be noted that although the architecture of the computer device 400 described above only shows the processor 402, memory 404, network interface 406, peripheral interface 408, and bus 410, in specific implementations, the architecture of the computer device 400 may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the architecture of the computer device 400 described above may only include the components necessary for implementing the embodiments of this disclosure, and does not necessarily include all the components shown in the figures.
[0109] Based on the same inventive concept, corresponding to any of the above embodiments, this disclosure also provides a non-volatile computer-readable storage medium containing a computer program, which, when executed by one or more processors, causes the one or more processors to perform the subscription message sending method.
[0110] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0111] The computer program stored in the storage medium of the above embodiments is used to cause the one or more processors to execute the subscription message sending method as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0112] Based on the same inventive concept, corresponding to the subscription message sending method in any of the above embodiments, this disclosure also provides a computer program product, which includes one or more computer programs. In some embodiments, the one or more computer programs are executable by one or more processors to cause the one or more processors to perform the subscription message sending method. Corresponding to the execution entity for each step in each embodiment of the subscription message sending method, the processor executing the corresponding step may belong to the corresponding execution entity.
[0113] The computer program product of the above embodiments is used to cause the processor to execute the subscription message sending method as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0114] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this disclosure (including the claims) is limited to these examples; within the framework of this disclosure, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this disclosure as described above, which are not provided in detail for the sake of brevity.
[0115] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this disclosure, the provided drawings may or may not show well-known power / ground connections to integrated circuit (IC) chips and other components. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this disclosure, and this also takes into account the fact that the details of implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this disclosure will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this disclosure, it will be apparent to those skilled in the art that the embodiments of this disclosure can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0116] Although this disclosure has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0117] This disclosure is intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for sending subscription messages, characterized in that, include: Retrieve the message of the first topic published by the application process in the first node device; Retrieve the subscriber information for the first topic from the global service routing table of the first node device; The optimal transmission path for sending the message to the subscriber is determined based on the subscriber's information; The communication proxy module of the first node device is notified to send the message of the first topic to the subscriber through the optimal transmission path.
2. The method according to claim 1, characterized in that, The subscriber information includes: the number of remote subscription nodes and the number of local subscription processes. Based on this subscriber information, the optimal transmission path for sending the message to the subscriber is determined, including: The proportion of remote subscribers is calculated based on the number of remote subscription nodes and the number of local subscription processes. The type of transmission path is determined based on the proportion of remote subscribers. If the proportion of remote subscribers is 0 and the number of local subscription processes is greater than 0, the optimal transmission path is determined to be the local zero-copy path. If the proportion of remote subscribers is 1, the type of the optimal transmission path is determined to be a remote transmission path; When the proportion of remote subscribers is greater than 0 and less than 1, the type of the optimal transmission path is determined to be a hybrid transmission of local zero-copy path and remote transmission path; When the optimal transmission path type includes a remote transmission path, determine the available communication channels for the remote transmission path; Obtain the quality parameters of the available communication channels; Based on the Quality of Service (QoS) requirements corresponding to the first topic, set weighting coefficients for the quality parameters; The quality parameters of each available communication channel are weighted and summed based on the weighting coefficients to obtain the communication quality score of each available communication channel. The optimal communication channel is determined based on the communication quality score.
3. The method according to claim 2, characterized in that, The subscriber information also includes: the timeliness requirements of the message data, and determining the optimal transmission path based on the communication quality score, including: When the optimal transmission path is a hybrid transmission of local zero-copy path and remote transmission path, the urgency of the message's data timeliness is determined according to the data timeliness requirement. If the urgency of the data timeliness is less than the preset value, the message is preferentially transmitted remotely; otherwise, the message is transmitted in parallel.
4. The method according to claim 1, characterized in that, The method further includes: After obtaining the message of the first topic published by the application process in the first node device, the service information of the first topic is updated to the global service routing table. The service information includes: the data type and QoS requirements of the first topic.
5. The method according to claim 1, characterized in that, The method further includes: Upon receiving a subscription message for the first topic, the subscription degree between the subscriber and the first topic is obtained by weighted summation of the topic matching degree, service quality requirement satisfaction degree, and data pattern compatibility score. If the matching degree between the subscriber and the first topic is higher than the threshold, then the subscriber is determined to be a valid subscriber of the first topic; Update the subscriber list for the first topic in the global service routing table.
6. The method according to claim 1, characterized in that, The subscriber's message also includes: service priority and system maximum priority; the method further includes: After determining the optimal transmission path to send the message to the subscriber based on the subscriber's information, if the optimal transmission path includes a remote transmission path, the service priority weight corresponding to the first topic is calculated based on the service priority and the system's maximum priority, and the transmission parameters are optimized based on the service priority weight to obtain the optimized transmission parameters. The notification to the communication proxy module of the first node device to send the message of the first topic to the subscriber through the optimal transmission path includes: A routing instruction is sent to the communication proxy module of the first node device, wherein the routing instruction includes: the target node device corresponding to the subscriber, the optimal transmission path, and the optimized transmission parameters.
7. The method according to claim 6, characterized in that, When the proportion of remote subscribers is greater than 0, the routing instruction is sent to the communication proxy module of the first node device through an asynchronous message queue in non-blocking mode, so as to instruct the communication proxy module to send the message of the first topic based on the asynchronous transmission task.
8. The method according to any one of claims 1 to 7, characterized in that, The global service routing table records and continuously updates the metadata of local and remote services. The metadata includes: topic identifier, data type, local publisher identifier, local subscriber identifier, remote subscription node address, and service quality requirement indicators.
9. A communication system, characterized in that, include: A first node device and a second node device, wherein the first node device is equipped with a first application process, a first communication service management center module, a first communication proxy module, and a first shared memory, and the second node device is equipped with a second application process, a second communication service management center module, a second communication proxy module, and a second shared memory; The first application process is used to publish topics to the first communication service management center module; The first communication service management center module is used to execute the method according to any one of claims 1 to 8; The first communication proxy module is used to read messages about the topic from the first shared memory and send the messages to the second node device through the optimal transmission path; The second application process is used to subscribe to messages for the topic; The second communication proxy module is used to receive the message and write the message into the second shared memory; The second communication service management center module is used to notify the second application process to read the message when the message in the second shared memory is detected.
10. The system according to claim 9, characterized in that, Both the first communication service management center module and the second communication service management center module maintain a global service routing table, and the global service routing tables between the first communication service management center module and the second communication service management center module are kept consistent through a distributed consistency protocol.