-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop broadcasting transactions when the block cannot be solidified #5562
Comments
At what point does the number of blocks that cannot be solidified cause transaction broadcasting to stop? After all, the number of transactions in a block is uncertain, and I am concerned that setting the threshold too low will easily trigger this state. |
What is the maximum memory allowed for block participation in solidification? The current threshold represents the height difference between the block head and the solidified block, and it should be linearly related to the memory. Otherwise, setting such a threshold has little significance. |
@jwrct If do not consider DDoS attacks, it can refer to the block synchronization time statistics. Need to consider the chain recovery time. If it is half an hour, you can set the threshold to 10,000. If it is 10 minutes, you can set it to 3,000. |
@lxcmyf The OOM phenomenon occurs, a total of about 1.5 million transactions were packaged. If there are no transactions in this block, it is considered that the memory usage of this block can be ignored. |
Rationale
The block production mechanism adopts the minimum participation strategy. When the number of SRs is lower than the minimum participation rate, SRs stop producing blocks. The default configuration is minParticipationRate = 15. As long as more than 15% of SRs work normally, SRs can produce blocks as usual.
The block production thread judgment logic is as follows.
Block solidification mechanism: The block can be solidified only after it is confirmed by 70% of SRs, the codes are shown below.
Background
There is a problem between the block producing mechanism and the solidification mechanism. When the number of participating SRs is greater than 15% and less than 70% of the total, SRs can continue to generate blocks. Since the blocks cannot be solidified and are kept in the memory, it may cause the memory to be exhausted.
Experiment Process
The experiment uses 27 mainnet SRs to construct an unfinalized scenario with maximum SR block production.
Starting from block 52873440, massively stress test transactions, up to block 52874137, and found that the SR block producing performance dropped to around 300 txs/block. Continue stress testing and found that the packaging performance continues to decline. Finally, after 5 days, the SR packaging performance became 2-3 txs per block, and eventually, an OOM occurred (SR014 on the morning of July 25).
Experiment Results
Conclusion 1: in the unfinalized scenario, after 697 blocks (840,000 transactions), the SR packaging performance dropped below 300 txs per block.
Conclusion 2: in the unfinalized scenario, the SR packaging performance declines linearly. When the single block packaging performance is 2 transactions, the OOM phenomenon occurs. A total of about 1.5 million transactions were packaged.
If there are too many blocks that cannot be solidified, the chain recovery speed will be plodding due to the need to synchronize a large number of unsolidified blocks after the node is restarted.
The following log comes from an online node.
The synchronization block time statistics are as follows.
Implementation
When the number of blocks that cannot be solidified reaches the threshold, transaction broadcasting is stopped to prevent SR from packaging too many transactions that cannot be solidified. This has the following benefits:
The implementation is as follows.
Add solid block check function.
When broadcasting transactions, if the blocks that cannot be solidified reach the threshold, failure information will be returned directly.
When processing the inventory message, if the blocks that cannot be solidified reach the threshold, the message will no longer be processed.
The text was updated successfully, but these errors were encountered: