-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Proper Locking During Block Persistence and Increase Performance while Syncing the Chain #237
Proper Locking During Block Persistence and Increase Performance while Syncing the Chain #237
Conversation
…cepting a new block.
neo/Network/LocalNode.cs
Outdated
|
||
// Need to ensure any outstanding calls to Blockchain_PersistCompleted are not in progress. | ||
// TODO: could add locking instead of using an arbitrarily long sleep here. | ||
Thread.Sleep(3000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any plans to improve this place before this PR is merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I should be able to adjust this to obtain the new PersistLock now. I’ll adjust and test it and update the pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be good now.
…new_tx_event is disposed.
…e Syncing the Chain (neo-project#237)
gui 2.3.5 need .net Framework 4.7.1
This change insures consistency of the mem_pool upon accepting and persisting a new block and it improves performance of block persistence. Performance is especially improved when syncing the chain in the case that there are a high number number of future transactions hanging around in the mem_pool.
Syncing from a recent chain.acc.zip file has been almost required in the past since syncing could get very slow without this fix if the chain file is rather old. This is because contention on the mem_pool lock from the AddTransactionLoop would block the block persistence thread when LocalNode.Blockchain_PersistCompleted is invoked.
This change will cancel transaction verification each time a new block is received and persisted. I tested syncing the chain, and observed significant performance improvement using these changes. Testing was performed on 2 cores of an Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz using a disk provisioned at 300 minimum IOPS.
This pull request was originally here (#218), but I'm submitting again freshly from a new branch: