Block chain load balancing method and electronic equipment
By calculating node load and average load in the blockchain network, identifying nodes to be transferred and receiving nodes, and calculating the cost based on the performance of the load transfer link, load transfer between nodes is achieved, solving the problem of unbalanced node load and improving the stability and reliability of the network.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-03-10
AI Technical Summary
The uneven load distribution among nodes in existing blockchain networks leads to network instability. Existing load balancing solutions lack a global perspective, which means the load imbalance problem persists.
By acquiring the load of each node in the blockchain network, calculating the average load, identifying the nodes to be transferred and the receiving nodes, calculating the node load transfer cost based on the load transfer link performance, and setting a total load transfer cost threshold, load transfer between nodes can be achieved.
It improves the operational stability and reliability of the blockchain network, avoids processing delays and transaction blockages caused by overloaded nodes, and reduces the impact of single points of failure on the network.
Smart Images

Figure CN121644568A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of blockchains, and particularly relates to a blockchain load balancing method and an electronic device. BACKGROUND
[0002] In a consortium blockchain network, when the loads of blockchain nodes are unbalanced, some nodes may be in an overloading state for a long time, while other nodes have a low load, which will bring a series of adverse effects to the operation of the entire blockchain network. The existing blockchain load balancing scheme is to determine whether to respond / receive a blockchain synchronization request based on the current load of a node, which is a load balancing from the perspective of a node and does not have a global perspective, resulting in the problem of load imbalance even after load transfer, thereby causing the operation of the blockchain network to be unstable. SUMMARY
[0003] The present application aims to provide a blockchain load balancing method and an electronic device to improve the stability of the operation of a blockchain network to some extent.
[0004] Other characteristics and advantages of the present application will become apparent from the following detailed description, or will be learned by practice of the present application.
[0005] According to an aspect of an embodiment of the present application, a blockchain load balancing method is provided, comprising: obtaining the load of each node in a blockchain network and calculating the average load of the blockchain network; determining, according to the load of each node and the average load, a to-be-transferred node in the blockchain network that needs to transfer load and a receiving node that can receive load; calculating the node load transfer cost between the to-be-transferred node and the receiving node according to the performance of a load transfer link between the to-be-transferred node and the receiving node; when the total load transfer cost is lower than a cost threshold, determining a target receiving node corresponding to the to-be-transferred node, and performing load transfer on the to-be-transferred node and the target receiving node; wherein the total load transfer cost comprises the sum of the node load transfer costs between each to-be-transferred node and its corresponding receiving node when performing one round of load balancing on the blockchain network.
[0006] According to an aspect of an embodiment of the present application, a blockchain load balancing device is provided, comprising: a load calculation module configured to obtain the load of each node in a blockchain network and calculate the average load of the blockchain network; The node determination module is used to determine, based on the load of each node and the average load, the nodes to be transferred and the receiving nodes in the blockchain network that can receive the load. The cost calculation module is used to calculate the node load transfer cost between the node to be transferred and the receiving node based on the performance of the load transfer link between the node to be transferred and the receiving node. The transfer module is used to determine the target receiving node corresponding to the node to be transferred when the total load transfer cost is lower than the cost threshold, and to perform load transfer between the node to be transferred and the target receiving node; wherein, the total load transfer cost includes the sum of the node load transfer costs between each node to be transferred and its corresponding receiving node when performing a round of load balancing for the blockchain network.
[0007] According to one aspect of the embodiments of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the blockchain load balancing method as described in the above technical solutions.
[0008] According to one aspect of the embodiments of this application, an electronic device is provided, the electronic device comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor executes the executable instructions to cause the electronic device to perform a blockchain load balancing method as described in the above technical solutions.
[0009] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the blockchain load balancing method as described in the above technical solutions.
[0010] In the technical solution provided in this application embodiment, the load of each node in the blockchain network is obtained, and the average load of the blockchain network is calculated; based on the load of each node and the average load, the nodes to be transferred and the receiving nodes that can receive the load are determined; based on the performance of the load transfer link between the nodes to be transferred and the receiving nodes, the node load transfer cost between the nodes to be transferred and the receiving nodes is calculated; when the total load transfer cost is lower than the cost threshold, the target receiving node corresponding to the node to be transferred is determined, and the load transfer is performed between the node to be transferred and the target receiving node; wherein, the total load transfer cost includes the sum of the node load transfer costs between each node to be transferred and its corresponding receiving node when performing a round of load balancing for the blockchain network. This application's technical solution accurately identifies high-load nodes to be transferred and low-load receiving nodes by using node load and average load, avoiding problems such as high processing latency and slow transaction packaging due to overload of some nodes. It introduces node load transfer costs and sets a total network cost threshold as a constraint condition for transfer decisions, ensuring that the load transfer operation does not generate excessive additional overhead for the network as a whole, and also ensuring that the node group after load balancing will not experience downtime, transaction blocking, or other failures due to overload of individual nodes. This effectively reduces the impact of single-point failures on the entire network, thereby improving the long-term operational stability and reliability of the blockchain system.
[0011] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0012] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0013] Figure 1 An exemplary system architecture block diagram illustrating the application of the technical solution of this application is shown schematically.
[0014] Figure 2 A flowchart illustrating a blockchain load balancing method provided in one embodiment of this application is shown.
[0015] Figure 3 A schematic diagram of the architecture of a blockchain network applying the technical solution of this application is shown.
[0016] Figure 4 A flowchart illustrating a blockchain load balancing method provided in one embodiment of this application is shown.
[0017] Figure 5 A schematic diagram of a blockchain network topology provided in one embodiment of this application is shown.
[0018] Figure 6 A flowchart illustrating a blockchain load balancing method provided in one embodiment of this application is shown.
[0019] Figure 7 A schematic block diagram of the blockchain load balancing device provided in the embodiments of this application is shown.
[0020] Figure 8 A schematic diagram of a computer system architecture suitable for implementing the embodiments of this application is shown. Detailed Implementation
[0021] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0022] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0023] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0024] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0025] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0026] It is understood that in the specific implementation of this application, customer information (such as transaction information, reconciliation data) and other related data are involved. When the above embodiments of this application are applied to specific products or technologies, customer permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0027] Figure 1 An exemplary system architecture block diagram illustrating the application of the technical solution of this application is shown schematically.
[0028] like Figure 1 As shown, the system architecture 100 may include terminal devices 110, a network 120, and a server 130. Terminal devices 110 may include smartphones, tablets, laptops, smart voice interaction devices, smart home appliances, in-vehicle terminals, etc. Server 130 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Network 120 may be a communication medium of various connection types capable of providing a communication link between terminal devices 110 and server 130, such as a wired communication link or a wireless communication link.
[0029] Depending on the implementation requirements, the system architecture in this application embodiment can have any number of terminal devices, networks, and servers. For example, server 130 can be a server group composed of multiple server devices.
[0030] Both the aforementioned terminal device 110 and server 130 can be nodes in a blockchain network. Nodes in a blockchain network can be divided into master nodes and slave nodes, and the technical solution of this application is executed by the master node in the blockchain network. The consensus mechanism and node admission rules of the master node blockchain determine this; for example, the master node can be the master node of the current formula round.
[0031] The blockchain load balancing method provided in this application will be described in detail below with reference to specific implementation methods.
[0032] Figure 2A flowchart illustrating a blockchain load balancing method provided in one embodiment of this application is shown. Figure 2 As shown, the blockchain load balancing method provided in this embodiment includes steps 210 to 240, as detailed below: Step 210: Obtain the load of each node in the blockchain network and calculate the average load of the blockchain network.
[0033] Specifically, the process iterates through all nodes in the blockchain network, collecting real-time load data for each node. Quantification of load can include metrics such as CPU utilization, memory usage, transaction processing queue length, and block packaging pressure. Based on the load data from all nodes, the average load of the entire blockchain network is calculated using an arithmetic or weighted average method.
[0034] Key features: Quantitative load data is used as the basis for decision-making, avoiding the bias of subjective judgment of node load status; the average load is used as the "benchmark threshold" for subsequent node classification, providing an objective basis for the division of nodes to be transferred and receiving nodes.
[0035] Figure 3 A schematic diagram of the architecture of a blockchain network applying the technical solution of this application is shown.
[0036] like Figure 3 As shown, the blockchain network includes multiple blockchain nodes. In addition to the conventional consensus module, ledger storage module, and smart contract engine, each node can also be equipped with a load status monitoring module and a load transfer execution module.
[0037] Figure 3 The blockchain network shown can be modeled as a graph G=(V, E). Vertices V={v1,v2,v3,...,vn} in graph G represent n blockchain nodes in the network. Each vertex vi has a real-time updated load vector Li. This load vector can be a multi-dimensional value, such as Li=(Ci,Mi,Ni), where Ci represents CPU utilization, Mi represents memory usage, and Ni represents the length of the pending transaction queue. To simplify calculations, the multi-dimensional vector can also be reduced to a single scalar load value Li through weighted averaging or other methods. This application does not limit the specific calculation method of the load value; any quantitative indicator that can characterize the busyness of a node can be used as the node's load. Edges E in graph G represent direct communication links between nodes. Edges can be assigned weights w(i,j) to represent the network latency or bandwidth between nodes vi and vj, which serves as one of the influencing factors when subsequently calculating load balancing costs.
[0038] In one embodiment, the master node broadcasts a "load information request" message to all (or designated) slave nodes in the blockchain network. Upon receiving the request, the load status monitoring module on each slave node obtains its own real-time load vector Li, confirms it with a signature, and replies to the master node. After collecting replies from more than a certain proportion (e.g., 2 / 3, i.e., a custom majority of nodes in the current blockchain network) or after a timeout, the master node constructs a global load mapping table Map_L={v1:L1,v2:L2,...} for the blockchain network at the current moment, where "vi:Li" indicates that the load of node vi is Li.
[0039] Average load of nodes in a blockchain network It can be represented as:
[0040] in, This represents the real-time load of node i. This indicates the number of nodes in the blockchain network.
[0041] Step 220: Based on the load and average load of each node, determine the nodes in the blockchain network that need to transfer load and the receiving nodes that can receive load.
[0042] Specifically, nodes that need to transfer load are denoted as nodes to be transferred, and nodes capable of receiving load are denoted as receiving nodes. Generally, if a node's load is too high, that node needs to transfer load outwards; conversely, if a node's load is low, that node can receive load transferred from other nodes. Based on this, the load of each node can be compared with its average load. If a node's load is greater than its average load, that node is considered a node to be transferred, also known as an overloaded node; if a node's load is less than or equal to its average load, that node is considered a receiving node, also known as a lightly loaded node. This process identifies all nodes with loads higher than their average load. The overloaded node set Vover and all loads below The application uses a differentiated node classification strategy to accurately distinguish between "overloaded nodes" and "lightly loaded nodes" in the network, ensuring the directionality and targeting of load transfer and avoiding ineffective load migration operations.
[0043] Step 230: Calculate the node load transfer cost between the node to be transferred and the receiving node based on the performance of the load transfer link between the node to be transferred and the receiving node.
[0044] Specifically, for any node to be transferred and any receiving node, a load transfer node pair can be formed. For each node to be transferred and receiving node, the performance of the load transfer link between them is analyzed. The performance of the transfer link can be evaluated based on data such as the number of nodes traversed from the node to be transferred to the receiving node, network latency, bandwidth, the capacity of the receiving node, and the amount of load transferred out by the node to be transferred. Based on the link performance parameters, the cost required to transfer a unit of load between the node pair is calculated. The quantification dimensions of the transfer cost can include communication latency cost, bandwidth occupancy cost, node state synchronization cost, etc.
[0045] By introducing a cost accounting mechanism that correlates link performance, the overhead of load transfer is bound to the actual state of the link, thus avoiding the selection of poor-performing links for transfer and resulting in additional network losses.
[0046] Step 240: When the total load transfer cost is determined to be lower than the cost threshold, the target receiving node corresponding to the node to be transferred is selected, and load transfer is performed between the node to be transferred and the target receiving node; wherein, the total load transfer cost includes the sum of the node load transfer costs between each node to be transferred and its corresponding receiving node when performing a round of load balancing for the blockchain network.
[0047] Specifically, the total load balancing cost refers to the sum of the load balancing costs of each node in a single round of load balancing. For example, the nodes to be transferred include A and B, and the receiving nodes include C and D. Here, it is assumed that no other additional nodes are introduced between the load balancing node pairs. The set of node pairs involved in a single round of load balancing can include (A, C) and (B, D), or it can be (A, D) and (B, C). It should be noted that, for the sake of demonstration, an example of overlapping transfer is not introduced here. In actual applications, overlapping transfer can be included. Overlapping transfer refers to different nodes to be transferred transferring load to the same receiving node, or the same node to be transferred transferring load to different receiving nodes, such as A and B both transferring load to C.
[0048] In a blockchain network, C ij Let C be the node load transfer cost when transferring load from node i to node j. If the load transfer is performed according to the strategy (A, C) or (B, D), then the total load transfer cost is C. AC +C BD If load balancing is performed according to strategies (A, D) and (B, C), then the total load balancing cost is C. AD +C BCAs can be seen, the total load balancing cost of the network varies when node pairs (nodes to be transferred and different receiving nodes) are formed for load balancing. In this embodiment, when the total load balancing cost is lower than a cost threshold, the receiving node matched with each node to be transferred is designated as the target receiving node for that node, and load balancing is performed between the node to be transferred and the target receiving node, thereby achieving one round of load balancing in the blockchain network. In this way, load balancing can be considered from the perspective of the global transfer cost of the blockchain network, ensuring that load balancing not only considers the nodes themselves but also the overall integrity of the blockchain network. This prevents the receiving node from becoming overloaded after load balancing, resulting in better overall network load balancing and increased network stability and reliability.
[0049] In the technical solution provided in this application embodiment, the load of each node in the blockchain network is obtained, and the average load of the blockchain network is calculated; based on the load of each node and the average load, the nodes to be transferred and the receiving nodes that can receive the load are determined; based on the performance of the load transfer link between the nodes to be transferred and the receiving nodes, the node load transfer cost between the nodes to be transferred and the receiving nodes is calculated; when the total load transfer cost is lower than the cost threshold, the target receiving node corresponding to the node to be transferred is determined, and the load transfer is performed between the node to be transferred and the target receiving node; wherein, the total load transfer cost includes the sum of the node load transfer costs between each node to be transferred and its corresponding receiving node when performing a round of load balancing for the blockchain network. This application's technical solution accurately identifies high-load nodes to be transferred and low-load receiving nodes by using node load and average load, avoiding problems such as high processing latency and slow transaction packaging due to overload of some nodes. It introduces node load transfer costs and sets a total network cost threshold as a constraint condition for transfer decisions, ensuring that the load transfer operation does not generate excessive additional overhead for the network as a whole, and also ensuring that the node group after load balancing will not experience downtime, transaction blocking, or other failures due to overload of individual nodes. This effectively reduces the impact of single-point failures on the entire network, thereby improving the long-term operational stability and reliability of the blockchain system.
[0050] Figure 4 A flowchart illustrating a blockchain load balancing method provided in one embodiment of this application is shown. Figure 4 As shown, the blockchain load balancing method provided in this embodiment includes steps 410 to 460, as detailed below: Step 410: Obtain the load of each node in the blockchain network and calculate the average load of the blockchain network.
[0051] Step 420: Based on the load and average load of each node, determine the nodes in the blockchain network that need to transfer load and the receiving nodes that can receive load.
[0052] Steps 410-420 are the same as steps 210-220 mentioned above, and will not be repeated here.
[0053] In one embodiment, prior to step 410, the master node may trigger a load balancing operation in any of the following ways: 1. Periodic triggering: For example, the master node automatically starts a load balancing process every K blocks processed or every T minutes.
[0054] 2. Threshold Trigger: The master node continuously monitors the brief load information reported by each node. When the standard deviation or Gini coefficient of the network load exceeds the preset threshold σ_trigger, it indicates that the network load imbalance has worsened, and the load balancing process is triggered, proceeding to step 410.
[0055] 3. Command Trigger: Manually triggered by a network administrator sending a command through a specific interface.
[0056] To avoid conflicts between multiple load balancing operations, the master node checks for an existing load balancing session before initiating the process. If an existing session exists, the current trigger will be ignored or queued.
[0057] Step 430: Calculate the load transfer coefficient based on the performance of the load transfer link.
[0058] Step 440: Calculate the load transfer amount between the node to be transferred and the receiving node based on the load difference between them and the performance of the load transfer link.
[0059] Step 450: Based on the product of the load transfer coefficient and the load transfer amount, obtain the node load transfer cost between the node to be transferred and the receiving node.
[0060] In one embodiment, the node load transfer cost when transferring load from node i to node j can be expressed as: The calculation method is as follows:
[0061] in, It is the load transfer amount from node i to node j; This is the load transfer factor, which reflects the communication overhead between nodes.
[0062] Load transfer factor The load transfer link's performance parameters, such as network bandwidth and latency, are calculated. In one embodiment, a dynamic network quality factor corresponding to the load transfer link is first calculated based on the network latency and bandwidth between the node to be transferred and the receiving node. Then, the reciprocal of the sum of the dynamic network quality factor and preset parameters is used as the load transfer coefficient. For example, the load transfer coefficient... It is expressed as follows:
[0063] in, This is a dynamic network quality factor, calculated based on network latency and network bandwidth. This is a preset parameter, which is configurable data. It can be seen that the load transfer coefficient... With dynamic network quality factor There is a negative correlation: the lower the latency and the higher the bandwidth of the load transfer link, the smaller the load transfer coefficient, meaning the shorter the network distance and the lower the corresponding node transfer cost. Therefore, it will be prioritized as the final transfer path. Dynamic Network Quality Factor The specific calculation process will be described later.
[0064] Load transfer amount The load transfer amount is calculated based on the load difference between the node to be transferred and the receiving node, as well as the performance of the load transfer link. The load difference between the node to be transferred and the receiving node reflects how much more load the node to be transferred has compared to the receiving node. To avoid excessive load on the receiving node after load transfer, the load difference between the two is used as the calculation benchmark for load transfer. This benchmark is adjusted based on the performance of the load transfer link to obtain a suitable range of load transfer amount.
[0065] In one embodiment, the load transfer amount is calculated as follows: based on the topology of the blockchain network, a blockchain network topology factor is calculated between the node to be transferred and the receiving node; based on the network latency and network bandwidth between the node to be transferred and the receiving node, a dynamic network quality factor corresponding to the load transfer link is calculated; based on the available capacity of the receiving node, a dynamic target capacity factor between the node to be transferred and the receiving node is calculated; based on the blockchain network topology factor, the dynamic network quality factor, and the dynamic target capacity factor, a load diffusion coefficient is calculated; and based on the product of the load difference between the node to be transferred and the receiving node and the load diffusion coefficient, the load transfer amount between the node to be transferred and the receiving node is obtained.
[0066] Specifically, the blockchain network topology factor reflects changes in the blockchain network topology, i.e., changes in the connection relationships between nodes. The dynamic network quality factor reflects the data transmission quality of the blockchain network. The dynamic target capacity factor reflects the load-bearing capacity of the receiving node. Based on these three factors, a load diffusion coefficient is calculated, and then the load transfer amount is obtained by multiplying the load diffusion coefficient by the load difference. This ensures that the calculation process for the load transfer amount comprehensively considers the load transfer capacity from the transferring node to the receiving node, as well as the overall load transfer capacity of the blockchain network, thus keeping the calculated load transfer amount within a reasonable range and making the load transfer more accurate.
[0067] In one embodiment, the blockchain network topology factor between the node to be transferred i and the receiving node j The calculation process includes: determining the maximum value between the degree of the node to be transferred and the degree of the receiving node based on the topology of the blockchain network; and using the reciprocal of the sum of the maximum value and the set value as the blockchain network topology factor.
[0068] Blockchain network topology factor The degree of the node is used for calculation. This calculation needs to be repeated whenever the blockchain network topology changes. Blockchain network topology factor. The calculation formula is as follows:
[0069] The degree of a node represents the number of edges it is connected to, which is equivalent to how many other nodes the node is connected to. Let i be the degree of node i. Given the degree of node j, take the maximum of the two values, sum it with a set value of 1, and then inversely calculate the result to obtain the blockchain network topology factor. .
[0070] In one embodiment, the dynamic network quality factor j between the node to be transferred i and the receiving node is... The calculation process includes: normalizing the network latency between the node to be transferred and the receiving node based on the current maximum latency of the blockchain network to obtain the normalized latency; normalizing the network bandwidth between the node to be transferred and the receiving node based on the current maximum bandwidth of the blockchain network to obtain the normalized bandwidth; and fusing the normalized latency and normalized bandwidth to obtain the dynamic network quality factor corresponding to the load transfer link.
[0071] Specifically, dynamic network quality factor Used to measure the quality of the communication link from node i to node j. It is determined by both latency and bandwidth. A low-latency, high-bandwidth link is a better transfer path. First, data normalization is performed. While collecting load information, the master node can also obtain real-time network parameters between nodes through methods such as probe packets. Let... , These represent the current maximum latency and current maximum bandwidth, preset or detected in the network, respectively. The normalized latency is then processed. and normalized bandwidth Calculate using the following formulas respectively:
[0072]
[0073] in, This represents the network latency from node i to node j. This represents the network bandwidth from node i to node j. Dynamic network quality factor. It can be defined as a weighted combination of the two:
[0074] in It is a preset weight parameter used to adjust the importance of latency and bandwidth according to business characteristics.
[0075] In one embodiment, the dynamic target capacity factor j between the node to be transferred i and the receiving node is... The calculation process includes: obtaining the dynamic target capacity factor based on the ratio of the available capacity of the receiving node to the total capacity of the receiving nodes.
[0076] The overall processing capacity of each node It is calculated based on the node's hardware configuration (number of CPU cores × weight + memory size × weight). The available capacity of node j is calculated as follows:
[0077] in, It is the load that node j has carried at time t, that is, the current load (or the real-time load of the node). This represents the available capacity (or remaining processing capacity) of node j at time t. This represents the total node capacity (or upper limit of overall processing capacity) of node j. Dynamic target capacity factor. It is represented by the ratio of available capacity to node capacity, and is calculated as follows:
[0078] In one embodiment, the total number of nodes is... The calculation involves abstracting the node's hardware resources into two dimensions: computing resources and storage resources. The scalar value is obtained through weighted summation, calculated using the following formula:
[0079] in, This represents the number of physical CPU cores (in units) of node j. Indicates the physical memory size of node j (in GB); and These are the weighting coefficients for CPU and memory resources, used to normalize the units and set the importance of the corresponding resources. They can be adjusted according to business characteristics.
[0080] In one embodiment, the node's real-time load The calculation is as follows: This represents the total weighted resources occupied by node j at time t, calculated as follows:
[0081] in, and These represent the CPU utilization and memory utilization at time t, respectively, and are within the range [0,1]. They can be collected via system commands.
[0082] In one embodiment, the load diffusion coefficient The calculation includes: weighting and summing the blockchain network topology factor, dynamic network quality factor, and dynamic target capacity factor to obtain the weighting factor; and fusing the normalization factor corresponding to the node to be transferred with the weighting factor to obtain the load diffusion coefficient.
[0083] In a blockchain network, the load capacity of a blockchain node depends not only on the node's degree, but also on the quality and capability of the node's connections. Therefore, calculating the load diffusion coefficient is crucial. First, the three factors mentioned above are summed with weights. Then, the weighted sum is combined with the normalization factor, and the calculation is as follows:
[0084] in, , , These are the corresponding weighting coefficients, which are configurable parameters of the system. ; It is a normalization factor that ensures the nodes The sum of the load proportions transferred to all its adjacent nodes remains within a reasonable range.
[0085] In the k-th iteration, the load transferred from node i to node j is equal to the product of the load diffusion coefficient and the load difference between the two nodes, i.e. , Let be the load of node i in the k-th iteration. Let be the load of node j in the k-th iteration.
[0086] Step 460: When the total load transfer cost is determined to be lower than the cost threshold, the target receiving node corresponding to the node to be transferred is selected, and load transfer is performed between the node to be transferred and the target receiving node; wherein, the total load transfer cost includes the sum of the node load transfer costs between each node to be transferred and its corresponding receiving node when performing a round of load balancing for the blockchain network.
[0087] Specifically, the overall load balancing of the blockchain network is modeled as a minimum-cost maximum-flow problem. The goal is to minimize the total load balancing cost while satisfying node capacity constraints.
[0088] Therefore, when the minimum total load transfer cost is found, the matching relationship between the node to be transferred and the receiving node is determined, and that receiving node becomes the target receiving node for the node to be transferred to finally perform the load transfer.
[0089] During load balancing, the master node generates a transfer instruction, which consists of a series of triples {(v_src, v_dest, amount), ...}, where v_src is the source node (the node to be transferred), v_dest is the target node (the target receiving node), and amount is the suggested load to be transferred. The master node then sends the calculated transfer instruction to the relevant source and target nodes. The node's load balancing execution module is responsible for parsing and executing this instruction.
[0090] In one embodiment, load balancing can be implemented by redirecting transaction requests. Specifically, the source node v_src can directly redirect some of its newly received client transaction requests to the target node v_dest via the network layer.
[0091] In one embodiment, load balancing can be implemented by migrating computational tasks. In certain scenarios, if the execution of a smart contract is interruptible and transferable, the state of a long-running computational task can be serialized and sent to the target node for continued execution.
[0092] In one embodiment, load balancing can be implemented by transferring ownership of a data shard. For blockchains employing sharding technology, load balancing can manifest as migrating the management rights and read / write service responsibilities of a data shard from the source node to the target node.
[0093] In the technical solution provided in this embodiment, the product of a load transfer coefficient (related to link performance) and the load transfer amount is introduced to calculate the node transfer cost. This binds link performance (such as communication latency, bandwidth, and topology) with the actual amount of transferred data, achieving refined measurement of the cost. Simultaneously, by constraining the total transfer cost threshold, the overall overhead of a round of load balancing is ensured to be controllable, avoiding network resource waste caused by poor link performance or unreasonable transfer amounts. This ensures that the benefits of load balancing operations outweigh the costs, improving the long-term operational stability of the blockchain network.
[0094] In one embodiment of this application, after load balancing between the node to be transferred and the target receiving node, the technical solution further includes: when the convergence condition is not met, returning to the step of obtaining the load of each node in the blockchain network and calculating the average load of the blockchain network. That is, when the convergence condition is not met, the master node can repeatedly execute the above steps 410-460 to perform multi-round iterative load balancing processing. For example, after one round of load balancing is completed, the system can wait for a stabilization period and then re-enter step 410, forming a closed-loop control system. When the convergence algorithm detects that the convergence condition is met, the master node can pause the load balancing process until it is triggered again.
[0095] After each iteration, the current load of each node in the network is updated. The load of node i in iteration k+1 can be calculated using the following formula:
[0096] in This represents the load value of node i in the (k+1)th iteration. This represents the adaptive load diffusion coefficient. Based on this dynamic load balancing algorithm, blockchain nodes will distribute the load towards the average load after each iteration. convergence.
[0097] The above load transfer process utilizes transfer costs The function ensures that the load is transferred with the "minimum network cost" in each iteration. However, the system needs to determine whether global balance has been achieved after multiple rounds of "minimum network cost transfer". Therefore, the system can perform multiple iterations and stop load balancing when the convergence condition is met.
[0098] In one embodiment, the convergence condition may be: the average load change in the most recent w iterations is less than a first stability threshold, and the load balance of the blockchain network after the k-th iteration is less than the balance threshold; wherein, the average load change in the most recent w iterations includes the average of the load changes in two adjacent iterations in the most recent w iterations; the k-th iteration is located after the most recent w iterations, and the load balance characterizes the magnitude of the difference between the node load in the blockchain network and the average load of the blockchain network.
[0099] The most recent *w* iterations can be determined by setting a sliding window, where the window length is the iteration number *w*. For example, setting the window length to 3 means calculating the changes in the most recent 3 iterations. Load balance reflects the magnitude of load fluctuation and can characterize the difference between the node load in the blockchain network and the average load of the blockchain network. The load balance after the *k*th iteration... It can be represented as:
[0100] in It is the load value of node i in the kth round. It is the global average load. It is a unitless numerical value, and the closer it is to 0, the more balanced the load on the blockchain network. In other words, the smaller the load balance value, the more balanced the network load, and the smaller the difference between the load of nodes in the network and the average load of the blockchain network.
[0101] The average load change over the most recent w iterations refers to the average load change over the most recent w iterations. The load change is calculated based on the difference in load between two adjacent iterations, indicating whether the overall network load has stabilized and is no longer experiencing drastic changes. The load change corresponding to the kth iteration... The calculation is as follows:
[0102] Where n is the total number of nodes. The closer a value is to 0, the smaller the system load variation, meaning it is already sufficiently stable.
[0103] The average load change in the most recent w iterations can be expressed as: .
[0104] When the average load change over the most recent w iterations is less than a first stability threshold, and the load balance of the blockchain network after the k-th iteration is less than a balance threshold, it indicates that the load balance has reached an ideal state, and the system is sufficiently balanced and stable. This convergence condition can be expressed as: ( ) in, The balance threshold is a very small positive number (e.g., 0.001), representing the maximum acceptable load variation coefficient. The first stability threshold (e.g., 0.0001) represents the upper limit of the average rate of change of the system state over a window period. It is an AND operator.
[0105] In one embodiment, the convergence condition can be: the average load change over the most recent w iterations is less than a second stability threshold; the second stability threshold is less than the first stability threshold. This situation indicates that load balancing can no longer be optimized, the system's balance has not changed significantly in the most recent window period, but has not reached the ideal load balancing level. This convergence condition can be expressed as: (
[0106] in It is the second stability threshold, which is less than the first stability threshold. It is a very small positive number (e.g., 1e-6) and represents the stagnation threshold. This condition ensures that the iteration ends as early as possible when the load balancing benefit is very low.
[0107] In one embodiment, the convergence condition may be: the rate of change of load balance of multiple consecutive blockchain networks is less than the equilibrium stability threshold; wherein, the rate of change of load balance of the blockchain network includes the difference in load balance of the blockchain networks corresponding to two adjacent iterations.
[0108] Specifically, regarding the question of whether further iteration is needed, it can be determined through the balance degree. The rate of improvement is used to determine the degree of balance. The rate of improvement, i.e., the rate of change in load balance. The calculation method is as follows:
[0109] like If the load balance change rate is very small in multiple consecutive iterations, meaning that the load balance change rate of multiple consecutive blockchain networks is less than the equilibrium stability threshold, it indicates that even if the system is not balanced enough, the algorithm can no longer make the blockchain network load more balanced. At this point, iteration can be stopped to avoid wasting resources.
[0110] In one embodiment, the convergence condition may be: the number of iterations reaches a preset number. That is... ,in, The maximum number of iterations is preset. If the current iteration k reaches the maximum number of iterations, the load balancing iteration will be terminated.
[0111] Simply judging convergence by whether the global load variance is less than a certain preset value cannot cover the problems of the load balancing algorithm fluctuating around the threshold and the slow change of the load of each node in the blockchain network when it approaches the convergence threshold. This embodiment, through the design of the above convergence conditions, can accurately determine whether the network is balanced as a whole and whether load balancing needs to continue, thereby accurately stopping the load balancing process and improving the accuracy of load balancing.
[0112] The implementation process of the technical solution of this application will be illustrated below with a specific embodiment. Figure 5 A schematic diagram of a blockchain network topology provided in one embodiment of this application is shown. Figure 6 A flowchart illustrating a blockchain load balancing method provided in one embodiment of this application is shown. Figure 6 As shown, the method includes the following steps: S1. Triggering Phase. Initialize the blockchain network, construct the topology graph G=(V, E), calculate the initial load value Li for each node, elect a Leader node, and determine if the load balancing cycle has been reached. Each node in the blockchain network maintains load information data for all nodes in the entire system. Each round of load balancing is initiated by the Leader node elected in the consensus of that round in the consortium blockchain. The latest load data of the current node is carried in the synchronization request to ensure that each node can obtain the real-time dynamic load balancing data of the system. Assume the blockchain cluster consists of 8 nodes, and the network topology is as follows... Figure 5 As shown. After the blockchain network starts, it reads the initial dynamic load balancing threshold and then begins the dynamic load balancing process.
[0113] S2. Global Load Information Collection. The master node collects load information from all nodes and calculates the average load. The consensus cluster master node initiates a load balancing request. After receiving the request, all nodes in the blockchain obtain the load data of all nodes in the current system. Assuming the initial load L = And by calculating the average load of the current cluster .
[0114] S3. Construct a load balancing mapping Map_L={v1:L1,v2:L2,...}.
[0115] S4. Calculate the load shifting plan. The master node, based on the global load mapping table Map_L and the network graph model G, executes an optimization algorithm to generate a load shifting plan. Calculation objective: Calculate the average network load. Identify all loads higher than [previous load]. The overloaded node set Vover and all loads below The set of lightly loaded nodes is Vunder. Optimization problem modeling: This problem can be modeled as a minimum-cost maximum flow problem. The objective is to minimize the total load shifting cost while satisfying node capacity constraints.
[0116] S5, Perform optimization iterations .
[0117] S6. When the maximum value has not been reached in the number of iterations, i.e. Update the load on each node.
[0118] The load on node i in the (k+1)th iteration can be calculated using the following formula:
[0119] Calculate transfer costs Check the convergence condition; if the convergence condition is not met, check the stability. This involves checking whether the average load change over the most recent w iterations is less than the first stability threshold. If not, then check whether the load change has stagnated. The criterion is whether the average load change in the most recent w iterations is less than the second stability threshold. If so, convergence has been achieved, and the optimization ends.
[0120] S7. Generate load balancing instructions. The master node distributes instructions to each node, each node executes load balancing, verifies the completion of the load balancing, and updates the network topology status.
[0121] Due to the dynamic load balancing adaptive scaling factor and network quality factor and dynamic target capacity factor Related, and the values are relatively dynamic. To facilitate calculation and understanding of the core load balancing algorithm, we assume here... In the coefficients, Parameters and The parameter weight is 0, and The value is set to 1, meaning that the adaptive load balancing coefficient cij is only related to the degree of the node.
[0122] Taking the first round of load balancing as an example, at this time k=1, the load calculation of node A: the maximum degree of node A and node B is 3, and the coefficient can be obtained. The value equals 0.25. After the first iteration, the load on node A is: 25.0 - 0.25(25 - 15) = 22.5. That is, node A needs to transfer 2.5 units of load to node B.
[0123] Load calculation for node B: The maximum degree of both node B and node A is 3, so the coefficient can be obtained. The coefficient is equal to 0.25; the maximum degree of nodes B and D is 3, so the coefficient can be obtained. The coefficient is equal to 0.25; the maximum degree of nodes B and F is 4, so the coefficient can be obtained. It equals 0.2. After the first iteration, the load of node B is: 15.0 - (0.25 × (15 - 25) + 0.25 × (15.0 - 15.0) + 0.25 × (15.0 - 15.0)) = 17.5.
[0124] Load calculation for node C: Since the maximum degree of nodes C and D is 2, the coefficient can be obtained. Equal to 1 / 3, the maximum degree of nodes C and E is 2, and the coefficient can be obtained. It equals 1 / 3. After the first iteration, the load of node C is: 15.0 - (1 / 3 × (15 - 15) + 1 / 3 × (15 - 15) + ) = 15.
[0125] After the first round of iterations, the load data for each node is: l1= .
[0126] The iterative process is repeated until the convergence condition is met, at which point the iterative execution of dynamic load balancing stops. Table 1 below lists... Figure 5 The load balancing process of the blockchain network shown: Table 1
[0127] This application proposes a load balancing scheme for inter-node load transfer. It uses a graph model to model nodes, node load, and load transfer in a blockchain network, defining the load balancing problem for each node in the blockchain network based on the amount of load that needs to be transferred. Dynamic load balancing is initiated by the Leader node in the current consensus round of the blockchain network, and then each node in the network performs multiple rounds of dynamic load adjustment to bring the load of all nodes in the blockchain network to a preset balanced state. This solves the problems of uneven load in the blockchain network reducing overall performance and high load on a single node causing node failure.
[0128] It should be noted that although the steps of the method in this application are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0129] The following describes an apparatus embodiment of this application, which can be used to execute the blockchain load balancing method in the above embodiments of this application. Figure 7 A schematic block diagram of a blockchain load balancing device provided in an embodiment of this application is shown. Figure 7 As shown, the blockchain load balancing device provided in this application embodiment includes: The load calculation module 710 is used to obtain the load of each node in the blockchain network and calculate the average load of the blockchain network. The node determination module 720 is used to determine, based on the load of each node and the average load, the nodes to be transferred and the receiving nodes in the blockchain network that can receive the load. The cost calculation module 730 is used to calculate the node load transfer cost between the node to be transferred and the receiving node based on the performance of the load transfer link between the node to be transferred and the receiving node. The transfer module 740 is used to determine the target receiving node corresponding to the node to be transferred when the total load transfer cost is lower than the cost threshold, and to perform load transfer between the node to be transferred and the target receiving node; wherein, the total load transfer cost includes the sum of the node load transfer costs between each node to be transferred and its corresponding receiving node when performing a round of load balancing for the blockchain network.
[0130] In one embodiment of this application, the cost calculation module 730 includes: A coefficient calculation unit is used to calculate the load transfer coefficient based on the performance of the load transfer link. The load transfer calculation unit is used to calculate the load transfer amount between the node to be transferred and the receiving node based on the load difference between the node to be transferred and the receiving node, and the performance of the load transfer link. The cost calculation unit is used to obtain the node load transfer cost between the node to be transferred and the receiving node based on the product of the load transfer coefficient and the load transfer amount.
[0131] In one embodiment of this application, the coefficient calculation unit is specifically used for: Calculate the dynamic network quality factor corresponding to the load transfer link based on the network latency and network bandwidth between the node to be transferred and the receiving node; The reciprocal of the sum of the dynamic network quality factor and the preset parameters is used as the load transfer coefficient.
[0132] In one embodiment of this application, the transfer amount calculation unit is specifically used for: Based on the topology of the blockchain network, calculate the blockchain network topology factor between the node to be transferred and the receiving node; Calculate the dynamic network quality factor corresponding to the load transfer link based on the network latency and network bandwidth between the node to be transferred and the receiving node; Calculate the dynamic target capacity factor between the node to be transferred and the receiving node based on the available capacity of the receiving node; Calculate the load diffusion coefficient based on the blockchain network topology factor, the dynamic network quality factor, and the dynamic target capacity factor; The load transfer amount between the node to be transferred and the receiving node is obtained by multiplying the load difference between them by the load diffusion coefficient.
[0133] In one embodiment of this application, the transfer amount calculation unit is specifically used for: Based on the current maximum latency of the blockchain network, the network latency between the node to be transferred and the receiving node is normalized to obtain the normalized latency. Based on the current maximum bandwidth of the blockchain network, the network bandwidth between the node to be transferred and the receiving node is normalized to obtain the normalized bandwidth. By combining the normalized delay and the normalized bandwidth, the dynamic network quality factor corresponding to the load transfer link is obtained.
[0134] In one embodiment of this application, the transfer amount calculation unit is specifically used for: Based on the topology of the blockchain network, determine the maximum value between the degree of the node to be transferred and the degree of the receiving node; The reciprocal of the sum of the maximum value and the set value is used as the topology factor of the blockchain network.
[0135] In one embodiment of this application, the transfer amount calculation unit is specifically used for: The dynamic target capacity factor is obtained by the ratio of the available capacity of the receiving node to the total capacity of the receiving node.
[0136] In one embodiment of this application, the transfer amount calculation unit is specifically used for: The weighted factor is obtained by weighting and summing the blockchain network topology factor, the dynamic network quality factor, and the dynamic target capacity factor. The load diffusion coefficient is obtained by fusing the normalization factor corresponding to the node to be transferred with the weighting factor.
[0137] In one embodiment of this application, the apparatus further includes an iteration module, specifically used for: If the convergence condition is not met, return to the steps of obtaining the load of each node in the blockchain network and calculating the average load of the blockchain network. The convergence condition includes at least one of the following: The average load change in the most recent w iterations is less than a first stability threshold, and the load balance of the blockchain network after the k-th iteration is less than the balance threshold; wherein, the average load change in the most recent w iterations includes the average of the load changes in two adjacent iterations in the most recent w iterations; the k-th iteration is located after the most recent w iterations, and the load balance characterizes the magnitude of the difference between the node load in the blockchain network and the average load of the blockchain network; The average load change in the most recent w iterations is less than the second stability threshold; the second stability threshold is less than the first stability threshold. The load balance change rate of multiple consecutive blockchain networks is less than the load balance stability threshold; wherein, the load balance change rate of the blockchain network includes the load balance difference between two adjacent iterations of the blockchain network. The preset number of iterations has been reached.
[0138] The specific details of the blockchain load balancing device provided in the various embodiments of this application have been described in detail in the corresponding method embodiments, and will not be repeated here.
[0139] Figure 8 A schematic block diagram of a computer system architecture for implementing an electronic device according to embodiments of the present application is shown.
[0140] It should be noted that, Figure 8 The computer system 800 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0141] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 802 or programs loaded from storage section 808 into random access memory (RAM). The RAM 803 also stores various programs and data required for system operation. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output interface 805 (I / O interface) is also connected to the bus 804.
[0142] The following components are connected to the input / output interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a local area network card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 810 as needed so that computer programs read from it can be installed into the storage section 808 as needed.
[0143] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit 801, it performs various functions defined in the system of this application.
[0144] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0145] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0146] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0147] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0148] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0149] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A blockchain load balancing method, characterized in that, The method comprises: obtaining the load of each node in the blockchain network, and calculating the average load of the blockchain network; determining the to-be-migrated node that needs to transfer the load and the receiving node that can receive the load in the blockchain network according to the load of each node and the average load; calculating the node load transfer cost between the to-be-migrated node and the receiving node according to the performance of the load transfer link between the to-be-migrated node and the receiving node; determining the target receiving node corresponding to the to-be-migrated node when the total load transfer cost is lower than the cost threshold, and performing load transfer between the to-be-migrated node and the target receiving node; wherein the total load transfer cost includes the sum of the node load transfer costs between each to-be-migrated node and its corresponding receiving node when performing one round of load balancing on the blockchain network. 2.The method of claim 1, wherein, The method comprises: calculating the node load transfer cost between the to-be-migrated node and the receiving node according to the performance of the load transfer link between the to-be-migrated node and the receiving node, comprising: calculating the load transfer coefficient according to the performance of the load transfer link; calculating the load transfer amount between the to-be-migrated node and the receiving node according to the load difference between the to-be-migrated node and the receiving node and the performance of the load transfer link; 3.The method of claim 2, wherein, obtaining the node load transfer cost between the to-be-migrated node and the receiving node according to the product of the load transfer coefficient and the load transfer amount. The method comprises: calculating the load transfer coefficient according to the performance of the load transfer link, comprising: 4.The method of claim 2, wherein, calculating the dynamic network quality factor corresponding to the load transfer link according to the network delay and network bandwidth between the to-be-migrated node and the receiving node; taking the inverse of the sum of the dynamic network quality factor and a preset parameter as the load transfer coefficient. The method comprises: calculating the load transfer amount between the to-be-migrated node and the receiving node according to the load difference between the to-be-migrated node and the receiving node and the performance of the load transfer link, comprising: calculating the blockchain network topology factor between the to-be-migrated node and the receiving node according to the topology structure of the blockchain network; calculating the dynamic network quality factor corresponding to the load transfer link according to the network delay and network bandwidth between the to-be-migrated node and the receiving node; 5. The blockchain load balancing method of claim 3 or 4, wherein, calculating the dynamic target capacity factor between the to-be-migrated node and the receiving node according to the available capacity of the receiving node; calculating the load diffusion coefficient according to the blockchain network topology factor, the dynamic network quality factor, and the dynamic target capacity factor; obtaining the load transfer amount between the to-be-migrated node and the receiving node based on the product of the load difference between the to-be-migrated node and the receiving node and the load diffusion coefficient. The method comprises: calculating the dynamic network quality factor corresponding to the load transfer link according to the network delay and network bandwidth between the to-be-migrated node and the receiving node, comprising: normalizing the network delay between the to-be-migrated node and the receiving node based on the current maximum delay of the blockchain network to obtain a normalized delay; normalize bandwidth between the to-be-migrated node and the receiving node according to a current maximum bandwidth of the blockchain network to obtain a normalized bandwidth; fuse the normalized delay and the normalized bandwidth to obtain a dynamic network quality factor corresponding to the load migration link.
6. The blockchain load balancing method of claim 4, wherein, According to the topology structure of the blockchain network, a blockchain network topology factor between the to-be-migrated node and the receiving node is calculated, including: According to the topology structure of the blockchain network, the maximum value of the degree of the to-be-migrated node and the degree of the receiving node is determined; The reciprocal of the sum of the maximum value and a set value is taken as the blockchain network topology factor.
7. The blockchain load balancing method of claim 4, wherein, According to the available capacity of the receiving node, a dynamic target capacity factor between the to-be-migrated node and the receiving node is calculated, including: According to the ratio of the available capacity of the receiving node to the total capacity of the receiving node, the dynamic target capacity factor is obtained.
8. The blockchain load balancing method of claim 4, wherein, According to the blockchain network topology factor, the dynamic network quality factor and the dynamic target capacity factor, a load diffusion coefficient is calculated, including: The blockchain network topology factor, the dynamic network quality factor and the dynamic target capacity factor are weighted and summed to obtain a weighted factor; The normalized factor corresponding to the to-be-migrated node is fused with the weighted factor to obtain the load diffusion coefficient.
9. The blockchain load balancing method of claim 1, wherein, After the load is transferred from the to-be-migrated node to the target receiving node, the method further includes: When the convergence condition is not reached, returning to execute the steps of acquiring the load of each node in the blockchain network and calculating the average load of the blockchain network; The convergence condition includes at least one of the following: The average load change amount of the last w iterations is less than a first stability threshold, and the load balance degree of the blockchain network after the kth iteration is less than a balance degree threshold; wherein the average load change amount of the last w iterations includes the average of the load change amounts of adjacent two iterations in the last w iterations; the kth iteration is located after the last w iterations, and the load balance degree represents the size of the difference between the node load and the average load of the blockchain network; The average load change amount of the last w iterations is less than a second stability threshold; the second stability threshold is less than the first stability threshold; The load balance degree change rate of the blockchain network is less than a balance stability threshold; wherein the load balance degree change rate of the blockchain network includes the difference value of the load balance degrees corresponding to adjacent two iterations; The number of iterations reaches a preset number.
10. An electronic device, comprising: including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the executable instructions to implement the blockchain load balancing method according to any one of claims 1 to 9.