Self-adaptive optimization method and device for distributed message bus, electronic equipment and storage medium
By acquiring real-time status data of nodes, calculating a comprehensive weight vector, dynamically selecting the lightest-loaded node to undertake tasks, and optimizing data transmission paths based on improved hash algorithms and intelligent routing algorithms, the problems of uneven node load and uneven bandwidth utilization in the distributed message bus are solved, achieving system stability and efficient communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-10
- Publication Date
- 2026-04-14
AI Technical Summary
Existing distributed message buses cannot adaptively adjust node load, resulting in low data communication efficiency, single point of failure risk, and uneven bandwidth utilization.
By acquiring real-time status data of nodes, calculating a comprehensive weight vector, dynamically selecting the lightest-loaded node to undertake tasks, and optimizing data transmission paths based on improved hash algorithms and intelligent routing algorithms, automatic load balancing and bandwidth optimization are achieved.
It enables horizontal scaling and load balancing of nodes, improves data communication efficiency, reduces the risk of single point of failure, optimizes bandwidth utilization, and ensures the stability and reliability of the system in high-concurrency scenarios.
Smart Images

Figure CN121864797A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to an adaptive optimization method, apparatus, electronic device, and storage medium for a distributed message bus. Background Technology
[0002] During the construction of a system bus, the network architecture's data communication routing needs to consider the comprehensive capabilities of the entire system, including data computing power, data storage capacity, and rapid recovery capabilities in the event of a failure. In traditional master-slave architectures, if a single device or cluster is used as the central server, the system suffers from insufficient storage capacity, limited data processing speed, and inadequate computing power to complete calculations reliably and in a timely manner. Furthermore, if the central server fails, the entire system faces the risk of paralysis, creating a single point of failure and forming an isolated system of faults. Therefore, most current scenarios utilize distributed message buses to build data communication routing.
[0003] Currently, similar technologies in distributed message bus research include Apache Cassandra (an open-source distributed non-relational database system), which features a distributed, weakly consistent architecture composed of Amazon's Dynamo and Google's BigTable. However, its network topology cannot adaptively adjust to node load, requiring manual intervention, resulting in low data communication efficiency. Summary of the Invention
[0004] This invention provides an adaptive optimization method, apparatus, electronic device, and storage medium for a distributed message bus, which can solve the problem that existing technologies cannot adaptively adjust node load.
[0005] To address the aforementioned technical problems, embodiments of the present invention provide an adaptive optimization method for a distributed message bus, comprising: Obtain real-time status data for each node; wherein, the real-time status data includes: CPU utilization, energy storage SOC, and network latency; The CPU utilization weight of each node is calculated based on the CPU utilization, the energy storage SOC weight of each node is calculated based on the energy storage SOC, the network latency weight of each node is calculated based on the network latency, and then the real-time comprehensive weight vector of each node is calculated based on the CPU utilization weight, the energy storage SOC weight, and the network latency weight. When a new task arrives, based on the real-time comprehensive weight vector corresponding to each node, the node with the smallest real-time comprehensive weight vector is selected as the node to receive the new task. When a new node joins, it will be used as the new task receiving node when the next new task arrives. When a node leaves, the tasks of the leaving node will be reassigned to the node with the smallest real-time comprehensive weight vector.
[0006] As a preferred embodiment, the nodes include: power generation equipment nodes, key power transmission and transformation equipment nodes, key distribution network equipment nodes, and dispatch center nodes.
[0007] As a preferred approach, the real-time integrated weight vector is calculated according to the following formula: ; in, Let i be the real-time comprehensive weight vector of node i; As a weight for CPU utilization; CPU utilization; The weighting is based on the State of Charge (SOC) of the energy storage system; SOC refers to the battery's state of charge. Network latency weights; This is a network latency index.
[0008] As a preferred option, it also includes: When a routing node needs to send target data to a target node, it generates several feasible data transmission paths as candidate paths based on the location of the current routing node and the target routing node to which the target node belongs. Calculate the comprehensive cost score corresponding to each candidate path, and select the candidate path with the smallest comprehensive cost score as the target path for the current routing node to send target data to the target routing node based on the comprehensive cost score. The current routing node sends the target data to the target routing node according to the target path, and the target routing node forwards the target data to the target node.
[0009] As a preferred option, the comprehensive cost score is calculated according to the following formula: ; in, The comprehensive cost score of candidate path P; This represents the average available bandwidth of all links in candidate path P; Let P be the average transmission delay of the candidate path. The average load of the nodes traversed by candidate path P; For dynamic weights.
[0010] As a preferred embodiment, before the current routing node sends the target data to the target routing node according to the target path, the method further includes: The target data is smoothed according to the following formula: ; in, Let be the target data value after data smoothing at time t; α is the smoothing coefficient. The target data value collected at time t without data smoothing processing; Let t-1 be the target data value after data smoothing.
[0011] Based on the above embodiments, another embodiment of the present invention provides an adaptive optimization device for a distributed message bus, including: a real-time status data acquisition module, a real-time comprehensive weight vector calculation module, a new task acceptance module, and a node addition and exit processing module; The real-time status data acquisition module is used to acquire the real-time status data of each node; wherein, the real-time status data includes: CPU utilization, energy storage SOC, and network latency; The real-time comprehensive weight vector calculation module is used to calculate the CPU utilization weight of each node based on the CPU utilization, calculate the energy storage SOC weight of each node based on the energy storage SOC, calculate the network latency weight of each node based on the network latency, and then calculate the real-time comprehensive weight vector of each node based on the CPU utilization weight, energy storage SOC weight, and network latency weight. The new task receiving module is used to select the node with the smallest real-time comprehensive weight vector as the receiving node of the new task when a new task arrives, based on the real-time comprehensive weight vector corresponding to each node. The node addition and exit processing module is used to, when a new node is added, use the new node as the new task receiving node when the next new task arrives, and when a node exits, reassign the tasks of the exiting node to the node with the smallest real-time comprehensive weight vector.
[0012] As a preferred option, it also includes: a bandwidth optimization module; The bandwidth optimization module is used to generate several feasible data transmission paths as candidate paths based on the location of the current routing node and the target routing node to which the target node belongs when the routing node needs to send target data to a target node. Calculate the comprehensive cost score corresponding to each candidate path, and select the candidate path with the smallest comprehensive cost score as the target path for the current routing node to send target data to the target routing node based on the comprehensive cost score. The current routing node sends the target data to the target routing node according to the target path, and the target routing node forwards the target data to the target node.
[0013] Based on the above embodiments, another embodiment of the present invention provides an electronic device, the device including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the adaptive optimization method of the distributed message bus described in the above embodiments of the invention.
[0014] Based on the above embodiments, another embodiment of the present invention provides a storage medium, the storage medium including a stored computer program, wherein, when the computer program is running, it controls the device where the storage medium is located to execute the adaptive optimization method of the distributed message bus described in the above embodiments of the invention.
[0015] Compared with the prior art, the embodiments of the present invention have the following beneficial effects: The system acquires real-time status data for each node, including CPU utilization, energy storage SOC, and network latency. It calculates the CPU utilization weight for each node based on the CPU utilization, the energy storage SOC weight for each node based on the energy storage SOC, and the network latency weight for each node based on the network latency. Then, it calculates the real-time comprehensive weight vector for each node based on the CPU utilization weight, energy storage SOC weight, and network latency weight. When a new task arrives, the node with the smallest real-time comprehensive weight vector is selected as the receiving node for the new task. When a new node joins, it is used as the receiving node for the next new task. When a node leaves, its tasks are reassigned to the node with the smallest real-time comprehensive weight vector. To address the problem that existing technologies cannot automatically achieve horizontal scaling and load balancing of nodes, this invention calculates the corresponding real-time comprehensive weight vector based on the real-time status data of each node. It can automatically select the node with the smallest real-time comprehensive weight vector as the receiving node for a new task, and automatically redistribute tasks when a node joins or leaves. This enables horizontal scaling and load balancing of nodes and improves data communication efficiency. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating an adaptive optimization method for a distributed message bus according to an embodiment of the present invention. Figure 2 This is an overall architecture diagram of the adaptive optimization process of the present invention; Figure 3 This is a schematic diagram of the overall architecture of the P2P architecture; Figure 4 This is a diagram illustrating the steps involved in establishing relationships between nodes; Figure 5 This is a diagram illustrating the routing relationships between the nodes; Figure 6 This is a diagram illustrating data smoothing. Figure 7 This is a schematic diagram of the routing lines; Figure 8 This is a schematic diagram of the structure of an adaptive optimization device for a distributed message bus provided in an embodiment of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0019] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0020] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0021] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0022] In the description of the embodiments of this application, the terms "multiple" and "several" refer to two or more (including two), similarly, "multiple groups" refer to two or more (including two groups), and "multiple pieces" refer to two or more (including two pieces).
[0023] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0024] Example 1 Please refer to Figure 1 To address the problem of existing technologies being unable to adaptively adjust node load, this invention provides a flowchart of an adaptive optimization method for a distributed message bus. This method starts with a decentralized architecture, employing a pure P2P network topology to achieve a domestically developed distributed message bus architecture technology that dynamically allows nodes to join and leave. It also incorporates research and design in areas such as automatic load balancing based on an improved hash algorithm and bandwidth optimization based on an intelligent routing algorithm to realize the horizontal expansion and bandwidth optimization functions of the domestically developed distributed message bus.
[0025] Please refer to Figure 2 The diagram below shows the overall architecture of the adaptive optimization process of this invention. The adaptive optimization of this invention includes three parts: a domestically developed distributed message bus architecture technology, an automatic load balancing technology based on an improved hash algorithm, and a bandwidth optimization technology based on an intelligent routing algorithm. The specific implementation process is described in detail below: I. Domestic Distributed Message Bus Architecture Technology: (1) The domestically produced distributed message bus architecture technology adopts a pure P2P network topology, with nodes dynamically joining and leaving, realizing a decentralized architecture and eliminating the risk of single point of failure. In the entire distributed bus architecture design process, taking power grid system management as an example, the P2P network architecture design is carried out. The node definitions and classifications are as follows: power generation equipment, as data generation nodes in the P2P architecture, realizes real-time broadcast of power generation, voltage frequency and other data; key transmission and transformation equipment, as key routing nodes in the architecture, realizes data transmission path optimization and ensures low-latency communication; key distribution network equipment, as edge computing nodes in the architecture; and dispatch center nodes, as super nodes in the architecture (optional, and with encrypted channels). Among them, the super node is an optional enhancement component in this architecture, usually played by resource-rich and stable equipment (such as dispatch center servers). Its main functions include: providing initial network guidance for newly joined nodes, maintaining a global system view to support advanced monitoring and management functions, and serving as a security trust anchor. It should be emphasized that the super node is optional and does not participate in the core message routing and load balancing data path. The core P2P communication, load balancing, and intelligent routing functions are all distributed and completed by ordinary nodes. Therefore, the existence or failure of super nodes will not affect the decentralized nature and high availability of the system's core business.
[0026] Please refer to Figure 3 This is a schematic diagram of the overall P2P architecture. In a P2P architecture, nodes can communicate with each other and establish relationships. Even if one device at any level fails, other devices can continue to operate normally through other links. When a new node joins, it establishes a connection with other nodes and can then communicate normally with all devices in the architecture. Please refer to... Figure 4 This is a schematic diagram illustrating the steps involved in establishing relationships between nodes.
[0027] Once a stable relationship is established, the entire system architecture is successfully built. This solves the single point of failure problem inherent in traditional architectures that rely on a central node or cluster. Next, based on this architecture, the load of all nodes and links is automatically distributed to ensure automatic load balancing.
[0028] II. Automatic load balancing technology based on improved hash algorithm: Based on the decentralized power grid architecture design described above, there are dynamic issues such as nodes joining or leaving at any time. For example, a photovoltaic power station might shut down on rainy days and then restart on sunny days; and there are also problems such as large differences in the computing power of equipment. Traditional consistent hashing methods lack complete topology awareness capabilities. Therefore, this invention designs an improved hashing algorithm that achieves specific functions through multi-dimensional weight evaluation and elastic virtual node allocation, focusing on dynamic weight calculation and elastic virtual node allocation. The specific steps include the following: S1. Obtain the real-time status data of each node; wherein, the real-time status data includes: CPU utilization, energy storage SOC, and network latency; Preferably, the nodes include: power generation equipment nodes, key power transmission and transformation equipment nodes, key distribution network equipment nodes, and dispatch center nodes.
[0029] S2. Calculate the CPU utilization weight of each node based on the CPU utilization, calculate the energy storage SOC weight of each node based on the energy storage SOC, calculate the network latency weight of each node based on the network latency, and then calculate the real-time comprehensive weight vector of each node based on the CPU utilization weight, energy storage SOC weight, and network latency weight. Preferably, the real-time integrated weight vector is calculated according to the following formula: ; in, Let i be the real-time comprehensive weight vector of node i; As a weight for CPU utilization; CPU utilization; The weighting is based on the State of Charge (SOC) of the energy storage system; SOC refers to the battery's state of charge. Network latency weights; This is a network latency index.
[0030] Specifically, for step S2 above, a real-time comprehensive weight vector is first generated by combining parameters such as the CPU utilization, energy storage SOC, and network latency of the node. For node i, the calculation formula for its real-time comprehensive weight vector is as shown above.
[0031] The CPU utilization weight, energy storage SOC weight, and network latency weight in the aforementioned real-time integrated weight vector exhibit nonlinear characteristics and instability. Therefore, a Kalman filter framework is used to dynamically adjust the weight coefficients based on the minimum mean square error criterion to adapt to grid fluctuations. The dynamic adjustment relationship is as follows: ; in, It is the weight value at time t (such as node weight, energy allocation weight, etc.). It is the Kalman gain, which controls the strength of the impact of the difference between the actual and predicted values on the weights. These are actual measured values (such as the current load of the node, power output, etc.). This is the predicted value, the expected value predicted by the model (such as load forecasting based on historical data). This algorithm generates a dynamic weight adjustment strategy, updating the weights for the next time step. Based on the current weight Add a correction term. The correction term is based on the error between the actual value and the predicted value, and the update magnitude is adjusted by the gain coefficient K to obtain the following policy conditions.
[0032] ② If the actual value is greater than or equal to the predicted value (the load is higher than expected), then increase the weight to allocate more resources.
[0033] ② If the actual value is less than the predicted value (the load is lower than expected), the weight is reduced to avoid wasting resources.
[0034] and and and The dynamic adjustment relationship is similar, following the same Kalman filter framework and core logic, namely, minimizing the estimation error based on a "prediction-measurement-update" cycle. The dynamic adjustment relationship is as follows: ; in, It is the SOC weight of the energy storage at time t. It is Kalman gain. It is the actual measured value of SOC at time t. This is the predicted SOC value at time t. Using this algorithm, the dynamically adjusted SOC weight for the next time step is obtained, ensuring that the system does not assign important tasks to a storage node that is about to run out of power, thus achieving load balancing of energy states. The following strategy can be derived: ① If the actual value is greater than or equal to the predicted value (the reserves are higher than expected), it means that the node has more energy storage redundancy and can increase the number of tasks.
[0035] ② If the actual value is less than the predicted value (energy storage is lower than expected), it means that the energy storage support capacity of this node has decreased, and the assigned tasks need to be reduced.
[0036] Similarly The dynamic adjustment relationship is as follows: ; It is the network delay weight at time t. It is Kalman gain. It is the actual measured value of the network delay at time t. This is the predicted network latency at time t. Using this algorithm, the dynamically adjusted network latency weight for the next time step is obtained, directing tasks to nodes or paths with better network communication quality, thereby optimizing the overall system's communication efficiency and response speed. The following strategies can be derived: ① If the actual value is greater than or equal to the predicted value (the delay is higher than expected), the communication capability of the node will deteriorate, and data transmission of this node or link can be avoided when selecting a path.
[0037] ② If the actual value is less than the predicted value (the delay is lower than expected), then the network communication of this node is good and it should be used first.
[0038] S3. When a new task arrives, select the node with the smallest real-time comprehensive weight vector as the receiving node of the new task based on the real-time comprehensive weight vector corresponding to each node. Specifically, regarding step S3 above, the present invention can achieve efficient load balancing by coordinating the intelligent decision-making of the control platform with the real-time data stream of the data platform. The weight calculation module of the control platform continuously receives real-time data reported from the nodes of the data platform and dynamically calculates the comprehensive weight vector of each node using Kalman filtering. Next, a dynamic weight list is generated and provided to the load balancing decision module. The topology manager is responsible for managing and maintaining the node list, detecting node additions and removals, and providing the load balancing decision module with a list of available nodes. A multidimensional hash table serves as the supporting database, storing historical data for the load balancing decision module to query. The load balancing decision module uses the weight list and the list of available nodes, based on the minimum weight... The principle is to select the optimal node from the available nodes to assign new tasks.
[0039] S4. When a new node is added, the new node will be used as the new task receiving node when the next new task arrives. When a node leaves, the tasks of the leaving node will be redistributed to the node with the smallest real-time comprehensive weight vector.
[0040] Specifically, for step S4 above, when a new node joins, its initial resources are idle and its weight value is low, so it is quickly included in the candidate and takes over the load, achieving seamless horizontal scaling; when a node leaves or fails, the topology manager removes it from the list, and the load balancing decision module will reassign the tasks on the node to other low-weight nodes, thereby automatically smoothing load fluctuations and ensuring optimal resource utilization.
[0041] In summary, automatic load balancing is ultimately achieved by dynamically adding and removing nodes, resolving the load fluctuation issues caused by dynamic node additions and removals, thereby enabling horizontal scaling of the architecture.
[0042] III. Bandwidth optimization techniques based on intelligent routing algorithms: Preferably, the method further includes: when a routing node needs to send target data to a target node, generating several feasible data transmission paths as candidate paths based on the locations of the current routing node and the target routing node to which the target node belongs; calculating the comprehensive cost score corresponding to each candidate path, and selecting the candidate path with the smallest comprehensive cost score as the target path for the current routing node to send the target data to the target routing node; the current routing node sending the target data to the target routing node according to the target path, and the target routing node forwarding the target data to the target node.
[0043] Preferably, the comprehensive cost score is calculated according to the following formula: ; in, The comprehensive cost score of candidate path P; This represents the average available bandwidth of all links in candidate path P; Let P be the average transmission delay of the candidate path. The average load of the nodes traversed by candidate path P; For dynamic weights.
[0044] Preferably, before the current routing node sends the target data to the target routing node according to the target path, the method further includes: performing data smoothing processing on the target data according to the following formula: ; in, Let be the target data value after data smoothing at time t; α is the smoothing coefficient. The target data value collected at time t without data smoothing processing; Let t-1 be the target data value after data smoothing.
[0045] Specifically, addressing the issues of high bandwidth utilization and slow query response in existing technologies, this paper dynamically adjusts the data transmission path based on the real-time status of nodes in the aforementioned pure P2P architecture (such as CPU load, link bandwidth, network latency, and node weights linked to the improved hash algorithm). This achieves its functionality in two aspects: reducing redundant data transmission between nodes and selecting the optimal transmission path for data of different priorities.
[0046] Firstly, the information synchronization and interaction mechanism is designed based on a pure P2P architecture, with layered information synchronization between devices. Please refer to... Figure 5This is a schematic diagram of the routing relationship between nodes. The key equipment in the power transmission and transformation layer is set as a key routing node, serving as the information aggregation point. It periodically sends "simple status messages" to neighboring nodes. The message information includes key information such as its own CPU utilization, current link bandwidth, and buffer queue length. The power generation equipment in the data layer is a non-routing node, which only reports its status to its own routing node and does not participate in the network-wide broadcast.
[0047] Building upon this foundation, triggering events and conditions for triggering updates are introduced, such as (CPU utilization > 80%) or a sudden drop in link bandwidth (e.g., below a threshold of 10Mbps). In these cases, state changes are proactively pushed to adjacent routing nodes to avoid the lag of periodic synchronization. To remove bandwidth fluctuations at the moment of triggering, a "sliding window filtering" algorithm is introduced to ensure stability at the moment of triggering. In this invention, mean filtering is used to smooth the data. A sliding window A is used, and its value is obtained through a specified calculation method, then output to the current position B of the signal. Please refer to... Figure 6 This is a schematic diagram of data smoothing processing, and its calculation method is defined as follows: ; Here, α is the smoothing coefficient, which ensures the stability of the sensed data. This represents the data value after filtering at time t. It is the result obtained by performing smoothing and other filtering operations on the original data to eliminate noise, instantaneous fluctuations, etc. in the original data, so that the data can better reflect the true trend or state. This refers to the raw data collected at time t, which has not been filtered or processed and may contain fluctuations caused by noise, transient interference, and other factors.
[0048] This represents the filtered data value at time (t - 1), which is the filtering result from the previous time step. It is used to participate in the calculation of the current filtered value, reflecting the historical continuity of the data and helping to achieve smooth processing of the original data. Through the above, the state awareness and information synchronization of the entire network are ultimately achieved.
[0049] Secondly, based on the network state awareness and synchronization results, the optimal path is selected for data transmission / routing. The path optimization process comprehensively considers three factors: bandwidth, latency, and node load. According to the connection relationship between the key routing nodes of power transmission and transformation and other equipment or adjacent equipment nodes, multiple potential transmission paths are generated and defined. Each candidate path is defined as P, and its comprehensive cost is defined as Score(P). The calculation formula is as shown above.
[0050] Through the above calculations, the optimal path is selected from several options for routing and data updates, ultimately achieving bandwidth optimization for the entire network architecture. Please refer to [link / reference needed]. Figure 7 The diagram below illustrates the routing path, and the calculation and route selection process are explained below. Figure 7 Taking the medium-length line as an example, the relevant parameters are set as follows: Line 1: Bandwidth 7, latency 100, node load 20; Line 2: Bandwidth 8, latency 100, node load 30; Line 3: Bandwidth 10, latency 50, node load 20; Line 4: Bandwidth 30, latency 50, node load 10; in, According to the formula Calculations show that the scores for Route 1 are approximately 54, Route 2 is approximately 56, Route 3 is approximately 29, and Route 4 is approximately 27. The conclusion is that Route 4 < Route 3 < Route 1 < Route 2, and Route 4 is ultimately selected for routing.
[0051] The specific process is as follows: all routing nodes periodically send lightweight status messages to their neighboring nodes, while non-routing nodes report their own status to their parent routing nodes. If the status of any routing node changes drastically, it will immediately and proactively push the status change information to its neighboring routing nodes, forming a real-time network state map that records the bandwidth, latency, and load of each potential path to other nodes. When a routing node or non-routing node needs to transmit data, the source node first sends the data to its parent routing node, which generates multiple candidate paths based on the real-time network state. Then, an intelligent routing algorithm is used to calculate a comprehensive cost score (Score(P)) for each path. This score dynamically weighs multiple factors such as bandwidth, latency, and node load, and adjusts the weights according to the data type. Finally, the optimal path with the lowest comprehensive cost is selected for data forwarding.
[0052] By implementing the above-mentioned hierarchical information synchronization (the key equipment for power transmission and transformation aggregates information for routing nodes, while the power generation equipment only reports to its own routing nodes, and network status awareness is achieved by combining event-triggered updates and sliding window filtering), and then constructing a comprehensive path cost model based on factors such as bandwidth, latency, and node load to select the best path (such as selecting line 4 in the example), the bandwidth optimization function is realized, which solves the problems of uneven computational load and bandwidth waste or insufficiency in the traditional bus architecture.
[0053] In summary, this patent, through research on domestic distributed message bus architecture technology, automatic load balancing technology, bandwidth optimization technology, and other aspects, realizes a method for horizontal expansion and bandwidth optimization of domestic distributed message bus, solving problems such as data network security, insufficient equipment capacity and computing power, susceptibility to single points of failure, and weak query capabilities due to insufficient bandwidth.
[0054] Therefore, this invention provides an adaptive optimization method for a distributed message bus. Using a domestically developed distributed message bus method, it addresses national cybersecurity concerns and solves the data network security issues inherent in foreign vendors' private clouds, which prohibit private deployment. Through decentralized design, it studies a pure P2P architecture to achieve dynamic partitioning and seamless horizontal scaling, resolving single points of failure caused by seed nodes and servers, as well as the problems of insufficient storage and computing power in manually controlled devices. Simultaneously, it optimizes bandwidth utilization through load balancing, improving query efficiency and ensuring system stability and reliability in high-concurrency scenarios.
[0055] Specifically, the present invention can achieve the following beneficial effects: (1) It adopts domestic design, supports private deployment, effectively avoids network security risks, and responds to national network security requirements.
[0056] (2) Based on the decentralized design of pure P2P architecture, the single point of failure problem caused by the central server / cluster in the traditional master-slave architecture is eliminated. When a node or link fails, the system can maintain normal operation through other paths.
[0057] (3) By using an improved hash algorithm, combined with multi-dimensional weight evaluation (CPU utilization, energy storage SOC, network latency, etc.) and Kalman filtering to dynamically adjust weights, automatic load balancing is achieved, adapting to differences in node computing power and dynamic changes, and avoiding resource waste or overload.
[0058] (4) Based on the intelligent routing algorithm, the optimal path is selected by hierarchical information synchronization (power transmission and transformation equipment gathers information as routing nodes, and power generation equipment only reports to its own routing nodes), event-triggered updates and sliding window filtering, combined with the path comprehensive cost model (considering bandwidth, delay and node load), thereby reducing redundant data transmission, reducing bandwidth occupation and improving query response speed.
[0059] Example 2 Please refer to Figure 8 This is a schematic diagram of the structure of an adaptive optimization device for a distributed message bus according to an embodiment of the present invention. The device includes: a real-time status data acquisition module, a real-time comprehensive weight vector calculation module, a new task acceptance module, and a node addition and exit processing module. The real-time status data acquisition module is used to acquire the real-time status data of each node; wherein, the real-time status data includes: CPU utilization, energy storage SOC, and network latency; The real-time comprehensive weight vector calculation module is used to calculate the CPU utilization weight of each node based on the CPU utilization, calculate the energy storage SOC weight of each node based on the energy storage SOC, calculate the network latency weight of each node based on the network latency, and then calculate the real-time comprehensive weight vector of each node based on the CPU utilization weight, energy storage SOC weight, and network latency weight. The new task receiving module is used to select the node with the smallest real-time comprehensive weight vector as the receiving node of the new task when a new task arrives, based on the real-time comprehensive weight vector corresponding to each node. The node addition and exit processing module is used to, when a new node is added, use the new node as the new task receiving node when the next new task arrives, and when a node exits, reassign the tasks of the exiting node to the node with the smallest real-time comprehensive weight vector.
[0060] Preferably, it also includes: a bandwidth optimization module; The bandwidth optimization module is used to generate several feasible data transmission paths as candidate paths based on the location of the current routing node and the target routing node to which the target node belongs when the routing node needs to send target data to a target node. Calculate the comprehensive cost score corresponding to each candidate path, and select the candidate path with the smallest comprehensive cost score as the target path for the current routing node to send target data to the target routing node based on the comprehensive cost score. The current routing node sends the target data to the target routing node according to the target path, and the target routing node forwards the target data to the target node.
[0061] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0062] Those skilled in the art will clearly understand that, for convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0063] Example 3 Accordingly, embodiments of the present invention provide an electronic device, the device including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the adaptive optimization method of the distributed message bus described in the above embodiments of the invention.
[0064] The electronic device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The device may include, but is not limited to, a processor and a memory.
[0065] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the device, connecting various parts of the device via various interfaces and lines.
[0066] Example 4 Accordingly, embodiments of the present invention provide a storage medium, the storage medium including a stored computer program, wherein, when the computer program is running, it controls the device where the storage medium is located to execute the adaptive optimization method of the distributed message bus described in the above embodiments of the invention.
[0067] The memory can be used to store the computer program. The processor implements various functions of the device by running or executing the computer program stored in the memory and calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function, etc.; the data storage area may store data created based on the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0068] The storage medium is a computer-readable storage medium, and the computer program is stored in the computer-readable storage medium. When executed by a processor, the computer program can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0069] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. An adaptive optimization method for a distributed message bus, characterized in that, include: Obtain real-time status data for each node; wherein, the real-time status data includes: CPU utilization, energy storage SOC, and network latency; The CPU utilization weight of each node is calculated based on the CPU utilization, the energy storage SOC weight of each node is calculated based on the energy storage SOC, the network latency weight of each node is calculated based on the network latency, and then the real-time comprehensive weight vector of each node is calculated based on the CPU utilization weight, the energy storage SOC weight, and the network latency weight. When a new task arrives, based on the real-time comprehensive weight vector corresponding to each node, the node with the smallest real-time comprehensive weight vector is selected as the node to receive the new task. When a new node joins, it will be used as the new task receiving node when the next new task arrives. When a node leaves, the tasks of the leaving node will be reassigned to the node with the smallest real-time comprehensive weight vector.
2. The adaptive optimization method for a distributed message bus as described in claim 1, characterized in that, The nodes include: power generation equipment nodes, key power transmission and transformation equipment nodes, key distribution network equipment nodes, and dispatch center nodes.
3. The adaptive optimization method for a distributed message bus as described in claim 1, characterized in that, The real-time integrated weight vector is calculated according to the following formula: ; in, Let i be the real-time comprehensive weight vector of node i; As a weight for CPU utilization; CPU utilization; The weighting is based on the State of Charge (SOC) of the energy storage system; SOC refers to the battery's state of charge. Network latency weights; This is a network latency index.
4. The adaptive optimization method for a distributed message bus as described in claim 1, characterized in that, Also includes: When a routing node needs to send target data to a target node, it generates several feasible data transmission paths as candidate paths based on the location of the current routing node and the target routing node to which the target node belongs. Calculate the comprehensive cost score corresponding to each candidate path, and select the candidate path with the smallest comprehensive cost score as the target path for the current routing node to send target data to the target routing node based on the comprehensive cost score. The current routing node sends the target data to the target routing node according to the target path, and the target routing node forwards the target data to the target node.
5. The adaptive optimization method for a distributed message bus as described in claim 4, characterized in that, The overall cost score is calculated using the following formula: ; in, The comprehensive cost score of candidate path P; This represents the average available bandwidth of all links in candidate path P; Let P be the average transmission delay of the candidate path. The average load of the nodes traversed by candidate path P; For dynamic weights.
6. The adaptive optimization method for a distributed message bus as described in claim 5, characterized in that, Before the current routing node sends the target data to the target routing node according to the target path, the process also includes: The target data is smoothed according to the following formula: ; in, Let be the target data value after data smoothing at time t; α is the smoothing coefficient. The target data value collected at time t without data smoothing processing; Let t-1 be the target data value after data smoothing.
7. An adaptive optimization device for a distributed message bus, characterized in that, include: The module includes a real-time status data acquisition module, a real-time comprehensive weight vector calculation module, a new task acceptance module, and a node addition and exit processing module. The real-time status data acquisition module is used to acquire the real-time status data of each node; wherein, the real-time status data includes: CPU utilization, energy storage SOC, and network latency; The real-time comprehensive weight vector calculation module is used to calculate the CPU utilization weight of each node based on the CPU utilization, calculate the energy storage SOC weight of each node based on the energy storage SOC, calculate the network latency weight of each node based on the network latency, and then calculate the real-time comprehensive weight vector of each node based on the CPU utilization weight, energy storage SOC weight, and network latency weight. The new task receiving module is used to select the node with the smallest real-time comprehensive weight vector as the receiving node of the new task when a new task arrives, based on the real-time comprehensive weight vector corresponding to each node. The node addition and exit processing module is used to, when a new node is added, use the new node as the new task receiving node when the next new task arrives, and when a node exits, reassign the tasks of the exiting node to the node with the smallest real-time comprehensive weight vector.
8. The adaptive optimization device for a distributed message bus as described in claim 7, characterized in that, Also includes: Bandwidth optimization module; The bandwidth optimization module is used to generate several feasible data transmission paths as candidate paths based on the location of the current routing node and the target routing node to which the target node belongs when the routing node needs to send target data to a target node. Calculate the comprehensive cost score corresponding to each candidate path, and select the candidate path with the smallest comprehensive cost score as the target path for the current routing node to send target data to the target routing node based on the comprehensive cost score. The current routing node sends the target data to the target routing node according to the target path, and the target routing node forwards the target data to the target node.
9. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the adaptive optimization method for a distributed message bus as described in any one of claims 1 to 6.
10. A storage medium, characterized in that, The storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to perform an adaptive optimization method for a distributed message bus as described in any one of claims 1 to 6.