-
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
Cache up-to-date consensus payloads #949
Conversation
Codecov Report
@@ Coverage Diff @@
## master #949 +/- ##
=========================================
Coverage ? 64.83%
=========================================
Files ? 199
Lines ? 13700
Branches ? 0
=========================================
Hits ? 8883
Misses ? 4817
Partials ? 0
Continue to review full report at Codecov.
|
…neo-project/neo into speed-up-consensus-with-future-payloads
@erikzhang, even marked as Low Priority, I still believe it is important. As much as we have NEO3 consensus operating more efficiently a better experience we are going to have. This PR is a simple mechanism that caches payloads that were previously discarded. However, they are useful and can surely improve consensus performance. |
Improved the mechanism for just trying to load payloads if they are from the current height. TODO: With this last change it becomes better to just set each used payload to null. @shargon, how to set a |
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.
This is a very good idea. Brother, I think that Reset second parameter could default to true, and only H+1 future messages are collected. After ine height more I dont see any advantage.. right?
In the first implementation I set the default to true, but at the end I preferred to make it more explicit, since we just have 2 calls. H+1 Preparations, H+1 Commits? Something like that? |
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.
Hi @vncoelho, we need UT to ensure this is working properly (we can't approve PRs without testing). Any chance you can add a few?
Also, it would be good if we can have some evidence that this will increase consensus. What exactly is this change going to improve?
@lock9, I will not be able to add UTs to this right now and it is not my priority at the moment. But I think it is a good thing to be done and I would sure revise and review any PR related to this with pleasure. |
@shargon @erikzhang, I think that this is ready to merge. However, I believe that, statistically speaking, we are only going to see real gains when we use delays, which is the case of the mainenet and testnet. The changes are straightforward. |
How can we get a result of |
It can happen, @erikzhang, in particular, if you consider PR #1345. |
How can it happen? I don't understand. |
I believe that the following cases may happen:
Anyway, the focus of this PR is just to cache the next payloads that were already sent via P2P. I do not see reason to discard them. Perhaps the name of the PR can be changed, it does not effectively need to be an speed up. |
@vncoelho You are right. But I think this PR must solve a problem. So, what problem does this PR solve? In my opinion, it provides a caching mechanism that reduces the probability of packet loss. Then, if we can find evidence in the consensus log that our current consensus mechanism often switches views due to packet loss, I will think this PR is useful. But now, I don't think it's worth merging. |
@erikzhang, in fact, we had an internal discussion yesterday and we discussed about closing/(not opening new ones) PRs (features) related to Consensus and dBFT 2.0. The idea is to merge a whole package for dBFT 3.0, we are on the way of writing the paper and start the implementation until middle of this year. There are some requirement for the safety and properties of pBFT, there are other important things we need to solve for fixing "workarounds", such as the use of This PR, in particular, is very simple, there is no bad trade-off in merging this since it only involves a local processing power without any possible scalability issue. |
@vncoelho I can help make more test on different TPS comparison, on different machine. let's see what will it act. |
Sounds great, @cloud8little! |
@vncoelho I've retested on 4 consensus nodes, located in different countries, here is the detail of the results. there is no difference for 15000ms, slightly improvement for 5000/800ms. Obevious improvement for 400ms. the experiment is based on no transactions, since there is a issue #1410, I can't send massive txs at this moment.
neo-cli: master 51cd29fbe21abb9e1f17f64e5c6d21bc7decbbb9
|
Great experiments, @cloud8little. I believe that there is not statistical different. Perhaps that if the PrepReq had more Txs or size we could detect more gains in order to avoid losing this Payload. |
@cloud8little, @superboyiii, @shargon, this is a not a big change but now that we have more features for testing with tx's, could you test if this change improve's performance when network is under high load? Perhaps that as bigger is the PrepareRequest more efficient it will be. |
Since the consensus module has been moved to neo-modules, I will close this first. |
closes #788
Check this out, @erikzhang, @shargon, @jsolman and @igormcoelho. An interesting speed up for consensus payloads.
The mechanism was an idea given by SPCC guys during their GO implementation (@fabwa, Anatoly Bogatyrev and Evgeniy Stratonikov).