[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN113157457B - Block chain slicing load balancing method and device - Google Patents

Block chain slicing load balancing method and device Download PDF

Info

Publication number
CN113157457B
CN113157457B CN202110486438.5A CN202110486438A CN113157457B CN 113157457 B CN113157457 B CN 113157457B CN 202110486438 A CN202110486438 A CN 202110486438A CN 113157457 B CN113157457 B CN 113157457B
Authority
CN
China
Prior art keywords
node
transaction
verification
blockchain
load
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110486438.5A
Other languages
Chinese (zh)
Other versions
CN113157457A (en
Inventor
王绍刚
马国祥
郑三宝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC, ICBC Technology Co Ltd filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110486438.5A priority Critical patent/CN113157457B/en
Publication of CN113157457A publication Critical patent/CN113157457A/en
Application granted granted Critical
Publication of CN113157457B publication Critical patent/CN113157457B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • G06F9/5088Techniques for rebalancing the load in a distributed system involving task migration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5044Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering hardware capabilities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a block chain segmentation load balancing method and device, which can also be used in the financial field, and the method comprises the following steps: determining the load state of each fragment according to the unprocessed transaction quantity of each fragment in the blockchain after transaction verification is executed; determining node ratings of all nodes according to the hardware performance of all nodes in all the fragments after verification transaction is executed, transaction processing time and transaction verification results; performing partition node reassignment operation according to the load state of each partition and the node rating of each node in each partition, executing transaction verification operation on unprocessed transactions in the partition after the partition node reassignment operation is completed, and packing and chaining micro-area blocks generated correspondingly after the transaction verification operation is completed; the application can effectively improve the load balance of each block chain fragment and improve the block chain verification transaction efficiency.

Description

Block chain slicing load balancing method and device
Technical Field
The application relates to the field of blockchains and also can be used in the field of finance, in particular to a blockchain slicing load balancing method and device.
Background
The blockchain technology initiates challenges to the traditional trust system by virtue of the decentralization advantage and the cryptography support, changes the value sharing mode and promotes the conversion from the information internet to the value internet. However, there are many unresolved problems with current blockchain technology. The three of decentralization, security and scalability cannot be satisfied simultaneously, and are therefore called impossible triangles of the blockchain. Bitcoin, ethereum and other public chains are mature in the aspects of decentralization and safety, but have a substantial breakthrough in expandability, so that the current block chain infrastructure cannot meet the requirements of large-scale application. For this reason, researchers have proposed a variety of blockchain expansion schemes for fragmentation, DAG, state channel, side chain, etc. The partitioning technology well solves the problem of capacity expansion under the condition of not reducing the degree of decentralization, and has good application prospect.
The inventor finds that the current stage slicing technology is still in a starting and exploring stage, and a plurality of problems still need to be solved. For example, in blockchain shards, if a certain shard is congested and generates a lot of transaction information, the load of each shard is unbalanced, thus reducing the transaction throughput of the blockchain system. Whereas existing sharding schemes typically randomly allocate nodes into different shards. Such a random allocation strategy ignores the performance differences among the nodes, resulting in a larger performance difference among the different slices in the blockchain, and if the processing capacity of a slice with a larger load is poor, congestion can occur, resulting in a reduction in the transaction throughput of the whole blockchain system.
Disclosure of Invention
Aiming at the problems in the prior art, the application provides a block chain fragment load balancing method and device, which can effectively improve the load balancing of each block chain fragment and improve the block chain verification transaction efficiency.
In order to solve at least one of the problems, the application provides the following technical scheme:
In a first aspect, the present application provides a blockchain partition load balancing method, including:
Determining the load state of each fragment according to the unprocessed transaction quantity of each fragment in the blockchain after transaction verification is executed;
determining node ratings of all nodes according to the hardware performance of all nodes in all the fragments after verification transaction is executed, transaction processing time and transaction verification results;
And performing partition node reassignment operation according to the load state of each partition and the node rating of each node in each partition, executing transaction verification operation on unprocessed transactions in the partition after the partition node reassignment operation is completed, and packing and chaining the micro-area blocks generated correspondingly after the transaction verification operation is completed.
Further, the performing a partition node reassignment operation according to the load status of each partition and the node rating of each node in each partition includes:
And reassigning the nodes with the node ratings exceeding the rating threshold to the fragments with the load states exceeding the load threshold, and randomly selecting one node with the node ratings exceeding the rating threshold as a master node of the fragments, wherein the master node is used for collecting transaction verification results of other nodes in the fragments.
Further, the method further comprises the following steps:
judging whether unprocessed transactions exist after the blockchain shards execute transaction verification aiming at the same transaction task;
if not, the corresponding generated micro-blocks are packaged and uplink, otherwise, whether the number of times of executing transaction verification by the fragments aiming at the same transaction task exceeds an operation threshold value is judged, and if yes, the verification of the unprocessed transaction is abandoned.
Further, before the operation of performing the partition node reassignment according to the load status of each partition and the node rating of each node in each partition, the method includes:
and monitoring whether a micro-block of the block chain is newly added with the block packing uplink, and if so, triggering the block node reassignment operation of each block.
In a second aspect, the present application provides a blockchain slice load balancing apparatus, comprising:
The system comprises a block chain, a block load determining module and a block load determining module, wherein the block chain is used for carrying out transaction verification on each block in the block chain;
the node rating determining module is used for determining the node rating of each node according to the hardware performance of each node in each fragment after executing verification transaction, the transaction processing time and the transaction verification result;
The system comprises a sliced node reassignment module, a sliced node reassignment module and a packet forwarding module, wherein the sliced node reassignment module is used for carrying out sliced node reassignment operation according to the load state of each slice and the node rating of each node in each slice, executing transaction verification operation on unprocessed transactions in the slices after the sliced node reassignment operation is completed, and packing and chaining micro-area blocks generated correspondingly after the transaction verification operation is completed.
Further, the slicing node reassignment module includes:
The load balancing processing unit is used for redistributing the nodes with the node ratings exceeding the rating threshold value into the fragments with the load states exceeding the load threshold value, and randomly selecting one node with the node ratings exceeding the rating threshold value as a master node of the fragments, wherein the master node is used for collecting transaction verification results of other nodes in the fragments.
Further, the method further comprises the following steps:
The unprocessed transaction judging unit is used for judging whether unprocessed transactions exist after the blockchain shards execute transaction verification aiming at the same transaction task;
and the unprocessed transaction operation unit is used for packing and linking the corresponding generated micro-blocks if the unprocessed transaction does not exist after the blockchain fragments execute the transaction verification aiming at the same transaction task, otherwise, judging whether the times of executing the transaction verification aiming at the same transaction task by the fragments exceeds an operation threshold value, and if so, discarding the verification of the unprocessed transaction.
Further, the method further comprises the following steps:
and the reassignment triggering unit is used for monitoring whether the micro-block of the block chain is newly added with the block packing uplink, and if yes, triggering the reassignment operation of the block nodes of each block.
In a third aspect, the present application provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the blockchain slicing load balancing method when executing the program.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the blockchain shard load balancing method.
According to the technical scheme, the application provides the block chain slice load balancing method and the block chain slice load balancing device, the nodes are rated according to the hardware performance, the processing transaction time and the transaction verification result of each node in each slice of the block chain, then the load state of each slice is determined according to the unprocessed transaction quantity of each slice in the block chain after the transaction verification is executed, in the next round of transaction verification, the high-performance node is distributed to the slice with larger load, the performance of the slice is improved, the verification transaction efficiency of the slice is accelerated, the problem of unbalanced load of each slice is solved, and the slices reach a relatively balanced state through the reassignment operation of the slice nodes.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a block chain partition load balancing method according to an embodiment of the present application;
FIG. 2 is a second flow chart of a block chain partition load balancing method according to an embodiment of the present application;
FIG. 3 is a block chain slice load balancing apparatus according to one embodiment of the present application;
FIG. 4 is a second block diagram of a block chain slice load balancing apparatus in accordance with an embodiment of the present application;
FIG. 5 is a third block diagram of a block chain partition load balancing apparatus in accordance with an embodiment of the present application;
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Considering that the current stage slicing technology is still in the starting and exploring stage, many problems still need to be solved. For example, in blockchain shards, if a certain shard is congested and generates a lot of transaction information, the load of each shard is unbalanced, thus reducing the transaction throughput of the blockchain system. Whereas existing sharding schemes typically randomly allocate nodes into different shards. The application provides a block chain partition load balancing method and a device, which are used for ranking nodes through the hardware performance, transaction processing time and transaction verification results of each node in each block chain partition, determining the load state of each partition according to the unprocessed transaction quantity of each partition after transaction verification in the block chain, distributing a high-performance node to the partition with larger load in the next transaction verification, improving the performance of the partition, accelerating the transaction verification efficiency of the partition, solving the problem of unbalanced load of each partition, and enabling each partition to reach a relatively balanced state through the reassignment operation of the partition node.
In order to effectively improve the load balance of each partition of a blockchain and improve the verification transaction efficiency of the blockchain, the application provides an embodiment of a blockchain partition load balancing method, referring to fig. 1, wherein the blockchain partition load balancing method specifically comprises the following contents:
Step S101: and determining the load state of each fragment according to the unprocessed transaction quantity of each fragment in the blockchain after transaction verification is executed.
Optionally, after the transaction is allocated to a given blockchain segment according to the mapping rule, the verification node allocated to the segment performs transaction verification on the transaction, where the master node in the segment is configured to collect verification results of other nodes in the segment, and package the results to send the results to a DS node (i.e., DS committee) for processing.
Step S102: and determining the node rating of each node according to the hardware performance of each node in each fragment after executing verification transaction, the transaction processing time and the transaction verification result.
Optionally, after node transaction verification, the application can obtain the corresponding score according to the hardware performance of each node, the processing transaction time and the transaction verification result.
Specifically, the node rating of the present application may be based on the following four principles:
(1) The higher the hardware performance of a node, the higher the score obtained.
(2) A higher score may be obtained when one node confirms a transaction faster than the other nodes in the shard.
(3) The score for transaction verification can be obtained only when the results of each node verification transaction agree with the results of the sharding consensus.
(4) The faster the micro-tile is generated in each tile, the higher the score obtained by the nodes in that tile. score1=k 1*n*C+k2*M+k3*D+k4 ×t
In the formula 1, k2, k3 and k4 are weight parameters of each index, and are used for reflecting the influence degree of different types of services on each index, in an actual scene, k needs to be set to a reasonable weight according to the service type provided by a node. In the application, the service mainly provided by the node is transaction processing and transaction verification, and the requirements on computing capacity and network bandwidth are high. K in the present application can be set as: k1, k2, k3, k4= 0.3,0.2,0.1,0.4.
Meanwhile, in addition to the hardware performance of the node, the rate at which the node verifies the transaction needs to be considered, and a score is obtained each time a node verifies a transaction. In the invention, the performance of the node can also be measured by scoring the transaction verification behavior of the node. In the present invention, a score is obtained each time a node verifies a transaction. The score that a node obtains in generating a micro-tile is calculated by equation 2:
Where TX is the number of transactions verified in the micro block. t tx=trecv-tsend, which is the time it takes for the node to verify the τ tx th transaction. Where t send is the time when the master node within the segment sends the transaction to the segment members, and t recv is the time when the master node receives the reply message after consensus by other nodes in the segment. When a master node within a tile generates a micro-tile, these two parameters are recorded in the micro-tile. τ tx is a decision parameter that is used to determine whether a node can score. When the result of node transaction verification and the final result are the same, the parameter value is 1, otherwise, the parameter value is 0. This parameter ensures that the node derives the correct transaction verification result in order to obtain a score to verify that transaction. Refers to the average time that all nodes in the slice process the t tx th transaction, calculated by equation 3, where |S| is the size of the slice, indicating how many nodes are in the slice.
In addition, the DS node of the present application may further adjust the node rating of each node according to the time generated by the micro-tile of the partition after collecting the score of each node, for example, adjust the node rating of the node according to the time generated by each partition after collecting the node ratings and micro-tiles sent by the master node of all the partitions. The adjustment method is as shown in formula 4, and the adjustment result is the final score of each node (corresponding node rating):
Specifically, the score of the node is corrected according to the time t block of each slice for generating the micro-block and the average time AVG (t block) of all the slices for generating the micro-block, then the final score of each node is added to the local, and after each round of verification is finished, the next round of node allocation is performed according to the score condition of all the nodes and the load condition of each slice.
Step S103: and performing partition node reassignment operation according to the load state of each partition and the node rating of each node in each partition, executing transaction verification operation on unprocessed transactions in the partition after the partition node reassignment operation is completed, and packing and chaining the micro-area blocks generated correspondingly after the transaction verification operation is completed.
Optionally, after the transaction is distributed to a given segment according to the mapping rule, the verification node distributed to the segment verifies the transaction, the master node in the segment collects verification results of other nodes in the segment, packages the results and sends the results to the DS node for processing, the DS node calculates load conditions in each segment according to the first-round verification transaction results and the unprocessed transaction number of each segment, and then continues to perform transaction verification on unprocessed transactions in the segment in a multi-round mode, and each round distributes nodes according to the performance of the node. After verification, the DS node gathers the micro-tiles of each tile, verifies them and packages them into the final tile (i.e., the tile connected to the blockchain) and joins the blockchain.
Specifically, node reassignment operation is performed according to the node score obtained after each round of verification and the conditions of each piece of load: so that more heavily loaded slices can be allocated to higher performing nodes. Meanwhile, the application can also randomly select one node from the nodes with the score higher than the average score as the master node in the sharding.
Specifically, in the multi-round verification scheme of the application, the load in the segment depends on the number of unprocessed transactions of the segment after each round of verification, and is calculated by equation 5:
ShardLi=Count(unTXs) (5)
in equation 5, shardL i is the load value of the slice i, and unTXs is each round of unprocessed transactions within the slice.
According to the formula 5, the load condition of each fragment can be evaluated, so that the fragment with larger load can be matched with the node with higher performance in the next round of node distribution, and the load balance is achieved.
As can be seen from the above description, according to the blockchain slice load balancing method provided by the embodiment of the application, the nodes can be rated through the hardware performance, the transaction processing time and the transaction verification result of each node in each slice of the blockchain, then the load state of each slice is determined according to the unprocessed transaction number of each slice after the transaction verification is executed in the blockchain, and in the next round of transaction verification, the high-performance node is distributed to the slice with larger load, so that the performance of the slice is improved, the verification transaction efficiency is accelerated, the problem of unbalanced load of each slice is solved, and the slices reach a relatively balanced state through the reassignment operation of the slice nodes.
In order to enable the higher-load slices to be distributed to the nodes with higher performance, in an embodiment of the blockchain slice load balancing method of the present application, the step S103 may further specifically include the following:
And reassigning the nodes with the node ratings exceeding the rating threshold to the fragments with the load states exceeding the load threshold, and randomly selecting one node with the node ratings exceeding the rating threshold as a master node of the fragments, wherein the master node is used for collecting transaction verification results of other nodes in the fragments.
Specifically, node reassignment operation is performed according to the node score obtained after each round of verification and the conditions of each piece of load: so that more heavily loaded slices can be allocated to higher performing nodes. Meanwhile, the application can also randomly select one node from the nodes with the score higher than the average score as the master node in the sharding.
In order to improve the overall transaction verification efficiency, in an embodiment of the blockchain slicing load balancing method of the present application, referring to fig. 2, the following may be further specifically included:
Step S201: and judging whether unprocessed transactions exist after the blockchain shards execute transaction verification aiming at the same transaction task.
Step S202: if not, the corresponding generated micro-blocks are packaged and uplink, otherwise, whether the number of times of executing transaction verification by the fragments aiming at the same transaction task exceeds an operation threshold value is judged, and if yes, the verification of the unprocessed transaction is abandoned.
Specifically, when the first round of verification starts, the node distributes the transaction to each fragment randomly, then distributes the transaction to a specific fragment according to the transaction address of the sender, then the node in each fragment starts to perform consensus verification on the transaction in each fragment, if all the transactions in the fragment are verified after one round of verification is finished, the transaction is packed into one block and sent to the DS node, if the round of verification is finished and there are unverified transactions, the round number is increased by 1, whether the round number is larger than the round number upper limit Tmax is judged, if the round number is larger than the round number upper limit Tmax, the unverified transaction is abandoned, otherwise, the DS node calculates the load condition of each fragment according to the unprocessed transaction number of each fragment, and then the node is redistributed to verify the unprocessed transaction according to the node distribution strategy until all the unprocessed transactions are verified or the round number upper limit is exceeded, and the rest of transactions are abandoned.
In order to enhance the load balancing effect, in an embodiment of the blockchain slicing load balancing method of the present application, before the step S103, the following may be further specifically included:
and monitoring whether a micro-block of the block chain is newly added with the block packing uplink, and if so, triggering the block node reassignment operation of each block.
Specifically, in the present application, when each fragment starts to verify the fragment transaction, it is the first round of verification, and when a micro block is generated in the fragment, it is the end of one round. And then triggering the partition node reassignment operation of each partition according to the received information in the micro-blocks packaged by each partition by the DS node, calculating the load condition of each partition and the score condition of each node, and sequentially carrying out the next round of verification according to the load condition of each partition.
Specifically, after each round of node distribution is completed, a new round of transaction verification is started, and a new block is generated after verification is completed. The specific transaction verification and block generation processes are as follows:
(1) After receiving the transaction, the DS node sends the transaction to the master node of the corresponding fragment according to the transaction fragment method.
(2) The master node of each fragment continuously collects the transactions sent by the DS node. After a certain number of transactions are collected, it packages the transactions and adds a time stamp t send, broadcasts to the nodes in the shard and starts verification.
(3) After receiving the transaction set from the master node in the segment, the node starts to perform a first round of verification, packages and signs the verified transaction of each round, and then sends the result set with the signature of the sender to the master node in the segment.
(4) And the master node in the segment packages and signs the result set of the nodes in the segment according to the received time and the time stamp. At the same time, all validated transactions are packaged into a micro-tile.
(5) The master node within the shard broadcasts a block containing all node verification results and signatures to all nodes in the shard.
If most nodes agree on the contents of the chunk (i.e., reach consensus), the master node broadcasts the result and the resulting chunk to the DS nodes. There will be two different situations:
1) The master node in the segment is an honest node: if there is a dishonest node in the sharer, the dishonest node will not affect the final result because the general node in the sharer cannot modify the result.
2) The master node in the segment is a dishonest node: at this point, the master node may choose not to pack certain transaction blocks into chunks, intentionally not acknowledge normal transactions, or not respond for a long time to slow down the rate of generating chunks. When the honest node in the segment detects this (e.g., a message from the master node has not been received within a period of time exceeding the response time), a broadcast will be initiated to the other nodes in the segment. If more than half of the nodes initiate the broadcast, a rollback procedure is initiated, then the master node is reselected, and the score of the previous master node is cleared.
(6) The DS node collects the transaction blocks and corresponding results of each fragment and verifies whether the signature in the data is valid. If so, the DS node will score the behavior of the transaction verification for each node according to the timestamp in the result set and save it locally. The number of unprocessed transactions of each fragment is then calculated, and the allocation of the next round of nodes is started.
After the end of this period, the DS node counts a fractional block and updates the blockchain. This fractional block contains the following data:
(1) Time of fractional block generation;
(2) Scoring obtained by all nodes in the current round;
(3) The number of unprocessed transactions for each fragment in the previous round;
(4) Hash value of the previous block;
(5) Signature of all DS nodes.
After the DS node has agreed on the result of this block, the DS node master node will broadcast a new block to the entire network and update the local state of the blockchain. After receiving the information, other nodes also update the state of the blockchain locally, and finally the new block is updated into the blockchain.
The node distribution process is carried out by DS nodes after each round of verification is finished, and the specific steps are as follows:
(1) The DS node will calculate the accumulated score for each node over the past m rounds based on the historical scores saved to the nodes in the blockchain.
(2) The DS nodes rank the accumulated scores of the nodes in descending order.
(3) And sequentially distributing the nodes to the fragments with the largest legacy load in the previous round, and selecting the fragment with the smallest hash value if a plurality of fragments meet the condition. And repeating the allocation until all the nodes are allocated.
(4) And finally, screening out nodes with scores higher than average score in each fragment, and randomly selecting one node from the nodes as a master node in the fragment by calculating public key hash.
In order to effectively improve the load balance of each partition of a blockchain and improve the blockchain verification transaction efficiency, the application provides an embodiment of a blockchain partition load balancing device for realizing all or part of the content of the blockchain partition load balancing method, referring to fig. 3, the blockchain partition load balancing device specifically comprises the following contents:
The slice load determining module 10 is configured to determine a load state of each slice according to an unprocessed transaction number of each slice in the blockchain after performing transaction verification.
The node rating determining module 20 is configured to determine a node rating of each node according to the hardware performance of each node in each fragment after executing the verification transaction, the transaction processing time and the transaction verification result.
The partition node reassignment module 30 is configured to perform a partition node reassignment operation according to the load status of each partition and the node rating of each node in each partition, perform a transaction verification operation on an unprocessed transaction in the partition after the partition node reassignment operation is completed, and package and uplink a micro-partition block generated correspondingly after the transaction verification operation is completed.
As can be seen from the above description, the blockchain slice load balancing device provided by the embodiment of the application can grade the nodes through the hardware performance, processing transaction time and transaction verification result of each node in each slice of the blockchain, then determine the load state of each slice according to the unprocessed transaction number of each slice after executing transaction verification in the blockchain, and distribute the high-performance node to the slice with larger load in the next round of transaction verification, thereby improving the performance of the slice and accelerating the verification transaction efficiency of the slice, so as to solve the problem of unbalanced load of each slice, and the reallocation operation of the slice nodes enables each slice to reach a relatively balanced state.
In order to enable the larger-load shards to be distributed to the nodes with higher performance, in an embodiment of the blockchain shard load balancing device of the present application, referring to fig. 4, the shard node reassignment module 30 includes:
The load balancing processing unit 31 is configured to redistribute the nodes with the node ratings exceeding the rating threshold to the segments with the load states exceeding the load threshold, and randomly select a node with the node ratings exceeding the rating threshold as a master node of the segments, where the master node is configured to collect transaction verification results of other nodes in the segments.
In order to improve the overall transaction verification efficiency, in an embodiment of the blockchain slicing load balancing device of the present application, referring to fig. 5, the following is further specifically included:
The unprocessed transaction determination unit 41 is configured to determine whether an unprocessed transaction exists after the blockchain shard performs transaction verification for the same transaction task.
The unprocessed transaction operation unit 42 is configured to, if the blockchain shard performs transaction verification for the same transaction task and there is no unprocessed transaction, pack and link the corresponding generated micro-block, otherwise, determine whether the number of times the shard performs transaction verification for the same transaction task exceeds an operation threshold, and if yes, discard to verify the unprocessed transaction.
In order to improve the load balancing effect, in an embodiment of the blockchain slicing load balancing device of the present application, the following is further specifically included:
and the reassignment triggering unit is used for monitoring whether the micro-block of the block chain is newly added with the block packing uplink, and if yes, triggering the reassignment operation of the block nodes of each block.
In order to effectively improve the load balance of each partition of a blockchain and improve the blockchain verification transaction efficiency, the application provides an embodiment of an electronic device for realizing all or part of contents in the blockchain partition load balance method, wherein the electronic device specifically comprises the following contents:
A processor (processor), a memory (memory), a communication interface (Communications Interface), and a bus; the processor, the memory and the communication interface complete communication with each other through the bus; the communication interface is used for realizing information transmission between the block chain fragmentation load balancing device and related equipment such as a core service system, a user terminal, a related database and the like; the logic controller may be a desktop computer, a tablet computer, a mobile terminal, etc., and the embodiment is not limited thereto. In this embodiment, the logic controller may refer to an embodiment of the blockchain slicing load balancing method and an embodiment of the blockchain slicing load balancing device in the embodiment, and the contents thereof are incorporated herein, and the repetition is omitted.
It is understood that the user terminal may include a smart phone, a tablet electronic device, a network set top box, a portable computer, a desktop computer, a Personal Digital Assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Wherein, intelligent wearing equipment can include intelligent glasses, intelligent wrist-watch, intelligent bracelet etc..
In practical applications, part of the blockchain splitting load balancing method may be performed on the electronic device side as described above, or all operations may be performed in the client device. Specifically, the selection may be made according to the processing capability of the client device, and restrictions of the use scenario of the user. The application is not limited in this regard. If all operations are performed in the client device, the client device may further include a processor.
The client device may have a communication module (i.e. a communication unit) and may be connected to a remote server in a communication manner, so as to implement data transmission with the server. The server may include a server on the side of the task scheduling center, and in other implementations may include a server of an intermediate platform, such as a server of a third party server platform having a communication link with the task scheduling center server. The server may include a single computer device, a server cluster formed by a plurality of servers, or a server structure of a distributed device.
Fig. 6 is a schematic block diagram of a system configuration of an electronic device 9600 according to an embodiment of the present application. As shown in fig. 6, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. Notably, this fig. 6 is exemplary; other types of structures may also be used in addition to or in place of the structures to implement telecommunications functions or other functions.
In one embodiment, the blockchain shard load balancing method functions may be integrated into the central processor 9100. The central processor 9100 may be configured to perform the following control:
step S101:
Step S102:
As can be seen from the above description, the electronic device provided in the embodiment of the present application ranks the nodes according to the hardware performance, processing transaction time and transaction verification result of each node in each partition of the blockchain, then determines the load status of each partition according to the number of unprocessed transactions after executing transaction verification of each partition in the blockchain, and distributes the high-performance node to the partition with larger load in the next round of transaction verification, thereby improving the performance of the partition, accelerating the efficiency of verification transaction of the partition, so as to solve the problem of unbalanced load of each partition, and the redistribution operation of the partition nodes makes each partition reach a relatively balanced status.
In another embodiment, the blockchain shard load balancing device may be configured separately from the central processor 9100, for example, the blockchain shard load balancing device may be configured as a chip connected to the central processor 9100, and the blockchain shard load balancing method function is implemented by the control of the central processor.
As shown in fig. 6, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is noted that the electronic device 9600 need not include all of the components shown in fig. 6; in addition, the electronic device 9600 may further include components not shown in fig. 6, and reference may be made to the related art.
As shown in fig. 6, the central processor 9100, sometimes referred to as a controller or operational control, may include a microprocessor or other processor device and/or logic device, which central processor 9100 receives inputs and controls the operation of the various components of the electronic device 9600.
The memory 9140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable media, a volatile memory, a non-volatile memory, or other suitable device. The information about failure may be stored, and a program for executing the information may be stored. And the central processor 9100 can execute the program stored in the memory 9140 to realize information storage or processing, and the like.
The input unit 9120 provides input to the central processor 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used for displaying display objects such as images and characters. The display may be, for example, but not limited to, an LCD display.
The memory 9140 may be a solid state memory such as Read Only Memory (ROM), random Access Memory (RAM), SIM card, etc. But also a memory which holds information even when powered down, can be selectively erased and provided with further data, an example of which is sometimes referred to as EPROM or the like. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application/function storage portion 9142, the application/function storage portion 9142 storing application programs and function programs or a flow for executing operations of the electronic device 9600 by the central processor 9100.
The memory 9140 may also include a data store 9143, the data store 9143 for storing data, such as contacts, digital data, pictures, sounds, and/or any other data used by an electronic device. The driver storage portion 9144 of the memory 9140 may include various drivers of the electronic device for communication functions and/or for performing other functions of the electronic device (e.g., messaging applications, address book applications, etc.).
The communication module 9110 is a transmitter/receiver 9110 that transmits and receives signals via an antenna 9111. A communication module (transmitter/receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, as in the case of conventional mobile communication terminals.
Based on different communication technologies, a plurality of communication modules 9110, such as a cellular network module, a bluetooth module, and/or a wireless local area network module, etc., may be provided in the same electronic device. The communication module (transmitter/receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide audio output via the speaker 9131 and to receive audio input from the microphone 9132 to implement usual telecommunications functions. The audio processor 9130 can include any suitable buffers, decoders, amplifiers and so forth. In addition, the audio processor 9130 is also coupled to the central processor 9100 so that sound can be recorded locally through the microphone 9132 and sound stored locally can be played through the speaker 9131.
The embodiment of the present application further provides a computer readable storage medium capable of implementing all the steps in the blockchain splitting load balancing method in which the execution subject is a server or a client in the above embodiment, where the computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements all the steps in the blockchain splitting load balancing method in which the execution subject is a server or a client in the above embodiment, for example, the processor implements the following steps when executing the computer program:
Step S101: . . . ;
step S102: . . . .
As can be seen from the above description, the computer readable storage medium provided by the embodiment of the present application rates the nodes through the own hardware performance, processing transaction time and transaction verification result of each node in each segment of the blockchain, then determines the load status of each segment according to the number of unprocessed transactions after executing transaction verification of each segment in the blockchain, and distributes the high-performance node to the segment with larger load in the next round of transaction verification, thereby improving the performance of the segment and accelerating the efficiency of verification transaction of the segment, so as to solve the problem of unbalanced load of each segment, and the reassignment operation of the segment node makes each segment reach a relatively balanced status.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (devices), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The principles and embodiments of the present invention have been described in detail with reference to specific examples, which are provided to facilitate understanding of the method and core ideas of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (8)

1. A blockchain shard load balancing method, the method comprising:
Determining the load state of each fragment according to the unprocessed transaction quantity of each fragment in the blockchain after transaction verification is executed;
determining node ratings of all nodes according to the hardware performance of all nodes in all the fragments after verification transaction is executed, transaction processing time and transaction verification results;
performing partition node reassignment operation according to the load state of each partition and the node rating of each node in each partition, executing transaction verification operation on unprocessed transactions in the partition after the partition node reassignment operation is completed, and packing and chaining micro-area blocks generated correspondingly after the transaction verification operation is completed;
The operation of redistributing the nodes of the fragments according to the load state of each fragment and the node rating of each node in each fragment comprises the following steps:
And reassigning the nodes with the node ratings exceeding the rating threshold to the fragments with the load states exceeding the load threshold, and randomly selecting one node with the node ratings exceeding the rating threshold as a master node of the fragments, wherein the master node is used for collecting transaction verification results of other nodes in the fragments.
2. The blockchain shard load balancing method of claim 1, further comprising:
judging whether unprocessed transactions exist after the blockchain shards execute transaction verification aiming at the same transaction task;
if not, the corresponding generated micro-blocks are packaged and uplink, otherwise, whether the number of times of executing transaction verification by the fragments aiming at the same transaction task exceeds an operation threshold value is judged, and if yes, the verification of the unprocessed transaction is abandoned.
3. The blockchain shard load balancing method of claim 1, comprising, prior to said shard node reassignment operations according to the load status of each shard and the node ratings of each node in each shard:
and monitoring whether a micro-block of the block chain is newly added with the block packing uplink, and if so, triggering the block node reassignment operation of each block.
4. A blockchain slice load balancing apparatus, comprising:
The system comprises a block chain, a block load determining module and a block load determining module, wherein the block chain is used for carrying out transaction verification on each block in the block chain;
the node rating determining module is used for determining the node rating of each node according to the hardware performance of each node in each fragment after executing verification transaction, the transaction processing time and the transaction verification result;
The system comprises a sliced node reassignment module, a packet node reassignment module and a packet processing module, wherein the sliced node reassignment module is used for carrying out sliced node reassignment operation according to the load state of each slice and the node rating of each node in each slice, executing transaction verification operation on unprocessed transactions in the slices after the sliced node reassignment operation is completed, and packing and chaining micro-area blocks generated correspondingly after the transaction verification operation is completed;
The slicing node reassignment module comprises:
The load balancing processing unit is used for redistributing the nodes with the node ratings exceeding the rating threshold value into the fragments with the load states exceeding the load threshold value, and randomly selecting one node with the node ratings exceeding the rating threshold value as a master node of the fragments, wherein the master node is used for collecting transaction verification results of other nodes in the fragments.
5. The blockchain shard load balancing device of claim 4 further comprising:
The unprocessed transaction judging unit is used for judging whether unprocessed transactions exist after the blockchain shards execute transaction verification aiming at the same transaction task;
and the unprocessed transaction operation unit is used for packing and linking the corresponding generated micro-blocks if the unprocessed transaction does not exist after the blockchain fragments execute the transaction verification aiming at the same transaction task, otherwise, judging whether the times of executing the transaction verification aiming at the same transaction task by the fragments exceeds an operation threshold value, and if so, discarding the verification of the unprocessed transaction.
6. The blockchain shard load balancing device of claim 4 further comprising:
and the reassignment triggering unit is used for monitoring whether the micro-block of the block chain is newly added with the block packing uplink, and if yes, triggering the reassignment operation of the block nodes of each block.
7. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor performs the steps of the blockchain shard load balancing method of any of claims 1 to 3 when the program is executed.
8. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the steps of the blockchain shard load balancing method of any of claims 1 to 3.
CN202110486438.5A 2021-04-30 2021-04-30 Block chain slicing load balancing method and device Active CN113157457B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110486438.5A CN113157457B (en) 2021-04-30 2021-04-30 Block chain slicing load balancing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110486438.5A CN113157457B (en) 2021-04-30 2021-04-30 Block chain slicing load balancing method and device

Publications (2)

Publication Number Publication Date
CN113157457A CN113157457A (en) 2021-07-23
CN113157457B true CN113157457B (en) 2024-05-17

Family

ID=76871434

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110486438.5A Active CN113157457B (en) 2021-04-30 2021-04-30 Block chain slicing load balancing method and device

Country Status (1)

Country Link
CN (1) CN113157457B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114520812B (en) * 2021-08-16 2023-02-14 西安电子科技大学 Memory rotation method, system, equipment and application for block chain fragmentation system
CN114710486B (en) * 2022-03-09 2023-09-08 合肥工业大学 Method and system for monitoring fragmented single-point overheating in block chain system
CN115002106B (en) * 2022-04-22 2024-04-12 中国农业银行股份有限公司 Block chain verification method, device, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109377225A (en) * 2018-10-30 2019-02-22 杭州复杂美科技有限公司 Transaction allocation method, common recognition method, equipment and storage medium
CN110334053A (en) * 2019-05-09 2019-10-15 哈尔滨理工大学 A kind of data based on block chain deposit card data processing method
WO2020022958A1 (en) * 2018-07-27 2020-01-30 Aioz Pte Ltd Method and apparatus for transaction verification in a blockchain-based network
WO2020211460A1 (en) * 2019-04-16 2020-10-22 北京艾摩瑞策科技有限公司 Logical sharding method and system for blockchain nodes
CN112511590A (en) * 2020-10-26 2021-03-16 南京辰阔网络科技有限公司 Efficient storage reconfiguration method for block chain fragmentation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020022958A1 (en) * 2018-07-27 2020-01-30 Aioz Pte Ltd Method and apparatus for transaction verification in a blockchain-based network
CN109377225A (en) * 2018-10-30 2019-02-22 杭州复杂美科技有限公司 Transaction allocation method, common recognition method, equipment and storage medium
WO2020211460A1 (en) * 2019-04-16 2020-10-22 北京艾摩瑞策科技有限公司 Logical sharding method and system for blockchain nodes
CN110334053A (en) * 2019-05-09 2019-10-15 哈尔滨理工大学 A kind of data based on block chain deposit card data processing method
CN112511590A (en) * 2020-10-26 2021-03-16 南京辰阔网络科技有限公司 Efficient storage reconfiguration method for block chain fragmentation

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
多区块链交易分发和事件处理的系统方案;刘雄文;;计算机科学(S2);全文 *
面向大数据的区块链在清算系统中的应用;蔡维德;郁莲;袁波;邓佑权;李琪;郭斌;;大数据(01);全文 *

Also Published As

Publication number Publication date
CN113157457A (en) 2021-07-23

Similar Documents

Publication Publication Date Title
CN113157457B (en) Block chain slicing load balancing method and device
WO2017186092A1 (en) Network slice selection method and apparatus
WO2020011154A1 (en) Method, apparatus, and system for blockchain transparent fragmentation
EP3568931B1 (en) Delaying new session initiation in response to increased data traffic latency
US10855616B2 (en) Predicting wait time for new session initiation during increased data traffic latency
EP3843355A1 (en) Method for sending message, method for verifying message, device, and communication system
Tian et al. User preference-based hierarchical offloading for collaborative cloud-edge computing
CN111047439B (en) Transaction processing method based on blockchain
US11165864B2 (en) Information synchronization method and apparatus
CN110765092A (en) Distributed search system, index distribution method, and storage medium
CN111221649A (en) Edge resource storage method, access method and device
Zhao et al. Contact duration aware data replication in DTNs with licensed and unlicensed spectrum
CN109905863B (en) Relay access method of distributed cooperative communication based on block chain storage
Desogus et al. Remiot: Reputation-based network selection in multimedia iot
CN103297542A (en) Operating system bus and balancing method supporting online expansion and retraction of components
CN115733841A (en) Block chain dynamic fragmentation expansion method based on image flow segmentation
CN106612298B (en) A kind of content distribution method and system based on large-scale network node
CN114386107A (en) MuSig 2-based multiple data signature acceleration method and system
CN112929837A (en) Dynamic control method and device for radio remote unit
CN116055064B (en) Method, system, medium and equipment for multi-block simultaneous consensus in block chain segmentation
WO2023020442A1 (en) Blockchain generation method and apparatus
WO2013174051A1 (en) Method and device for processing user resources
CN115629896A (en) Method and device for dealing with common identification timeout in alliance chain
CN110245950B (en) Block discharging method and device related to block chain
CN110224840B (en) Block chain based packaging method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: 071700 unit 111, 1st floor, building C, enterprise office area, xiong'an citizen service center, Rongcheng County, xiong'an District, China (Hebei) pilot Free Trade Zone, Baoding City, Hebei Province

Applicant after: ICBC Technology Co.,Ltd.

Applicant after: INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Address before: 100029 Tianyuan Xiangtai building, No.5 Anding Road, Chaoyang District, Beijing

Applicant before: ICBC Technology Co.,Ltd.

Country or region before: China

Applicant before: INDUSTRIAL AND COMMERCIAL BANK OF CHINA

GR01 Patent grant
GR01 Patent grant