You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an open discussion issue, which summarizes the optimization work in the past and some ideas for the next step. More suggestions and new ideas are needed for further optimization. We are willing to provide more details of the data for your reference. And we will keep updating this post to include further ideas.
Goal
increase TPS
Increase network transmission stability and security
Improve smart contract execution efficiency
Introduction
Over the past few months, @neo-project/core, @neo-project/ngd-shanghai have done a lot of work regarding optimization. At present, in our experimental environment, the peak value of TPS has reached 2100/s. It is hoped that there can be greater breakthroughs and improvements in the future to lay a solid foundation to support large-scale commercial applications.
At present, we adhere to the following methodologies: Benchmark-> Locate Bottlenecks-> Optimization / New Design .
There are four modules having a relatively large impact on performance, including memory pool, P2P, consensus and VM. For each module, we have summarized the possible performance issues and list the optimizations that have been completed or in progress. Besides, we also list some potential optimization ideas and would like to further discuss or design about them.
The following figure is a summary of the time consumption of all current methods:
Tips:
Those marked yellow are optimizations which has been implemented.
Those marked orange are sessions take long time which need to be optimized.
Memory Pool
It takes a lot of time to enter the memory pool in the process of transactions , which mainly includes two processes:
Verification before the transaction entering the memory pool, such as whether the balance is sufficient, set operations, and verify the signature.
When the new block comes in, there will be a reverification of the memory pool transactions, which is caused by the following reasons and takes about 2 seconds.
How to improve the efficiency of starting a new node from index = 0 ? (exchange scenario)
How to improve network transmission efficiency in the case of a large number of nodes?
.....
Consensus
Although the current bottleneck is not consensus mechanism, however, when there are a large number of transactions, frequent ChangeView phenomenon is prone to occur, resulting in slower block generation.
The other issue is the adjustment of the block generation time. When the TPS is improved, it is necessary to find a more suitable block generation time.
Open discussion
How to improve the efficiency of consensus execution and reduce the frequency of ChangeView
Possible solution 1: Change the serial block generation to the pipeline block generation mechanism (both neo-go and @vncoelho have tried)
Setting a reasonable block generation time and and the maximum number of transactions in a block
Faster new consensus mechanism with more nodes, such as sharding, new consensus algorithms, etc.
VM
The execution process of the VM is another time-consuming session, especially in VM instruction execution, interoperable services, and serial execution of transactions.
At present, each transfer usually takes 0.2 milliseconds, which is relatively time-consuming.
In Progress
Optimizing the ContractManifest.Clone method in System.Contract.Call to avoid deep copying
In the process of optimization, we found that some code is not efficient, resulting in performance degradation. We think the following measures can help optimization.
Using the space-for-time algorithm. The memory can be expanded by hardware, such as using HashSet instead of array traversal
Caching calculated data, such as the Size field in transactions, calculated from serialized data, which is very time-consuming
Using efficient processing syntax, like @shargon mentioned, avoid Linq, replace List with Array, etc.
Parallel processing where possible, such as transaction signature verification
The text was updated successfully, but these errors were encountered:
This is an open discussion issue, which summarizes the optimization work in the past and some ideas for the next step. More suggestions and new ideas are needed for further optimization. We are willing to provide more details of the data for your reference. And we will keep updating this post to include further ideas.
Goal
Introduction
Over the past few months, @neo-project/core, @neo-project/ngd-shanghai have done a lot of work regarding optimization. At present, in our experimental environment, the peak value of TPS has reached 2100/s. It is hoped that there can be greater breakthroughs and improvements in the future to lay a solid foundation to support large-scale commercial applications.
At present, we adhere to the following methodologies: Benchmark-> Locate Bottlenecks-> Optimization / New Design .
There are four modules having a relatively large impact on performance, including memory pool, P2P, consensus and VM. For each module, we have summarized the possible performance issues and list the optimizations that have been completed or in progress. Besides, we also list some potential optimization ideas and would like to further discuss or design about them.
The following figure is a summary of the time consumption of all current methods:
Tips:
Memory Pool
It takes a lot of time to enter the memory pool in the process of transactions , which mainly includes two processes:
In Progress
P2P
Currently we have more discussion on github regarding network optimization, including great suggestions from @decentralisedkev @ixje @jsolman @yongjiema @shagron @vncoelho @igormcoelho , etc., in fast synchronization, stability, and security.
In Progress
Ping / Pong
mechanism to synchronize block height between nodesgetdata
message transmission loss and duplicateOpen discussion
Consensus
Although the current bottleneck is not consensus mechanism, however, when there are a large number of transactions, frequent
ChangeView
phenomenon is prone to occur, resulting in slower block generation.The other issue is the adjustment of the block generation time. When the TPS is improved, it is necessary to find a more suitable block generation time.
Open discussion
How to improve the efficiency of consensus execution and reduce the frequency of
ChangeView
neo-go
and @vncoelho have tried)Setting a reasonable block generation time and and the maximum number of transactions in a block
Faster new consensus mechanism with more nodes, such as sharding, new consensus algorithms, etc.
VM
The execution process of the VM is another time-consuming session, especially in VM instruction execution, interoperable services, and serial execution of transactions.
At present, each transfer usually takes 0.2 milliseconds, which is relatively time-consuming.
In Progress
ContractManifest.Clone
method inSystem.Contract.Call
to avoid deep copyingOpen discussion
The text was updated successfully, but these errors were encountered: