-
Notifications
You must be signed in to change notification settings - Fork 795
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
Fix vote_generator loop inconsistency during high load #2095
Fix vote_generator loop inconsistency during high load #2095
Conversation
This reverts commit 4404c4c.
… between threshold and 11
What's the reason for it taking 200ms at 40-60 tps? |
@clemahieu
I should have said initially that if the rate is any higher than |
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.
Looks good in my tests
* Fix vote_generator loop inconsistency during high load. * Increase deadline for bulk_pull_account.basics test * Revert "Increase deadline for bulk_pull_account.basics test" This reverts commit 4404c4c. * Simplify config option * Use a flag as the wait predicate to prevent getting stuck with hashes between threshold and 11
Adds a
vote_generator_threshold
config option ( between 1 and 12 ) and new logic for the vote generator loop. The goal is to make it behave like a deadline timer which is reset when new hashes arrive, and when fired sends the hashes.vote_generator_delay
(50ms default)vote_generator::add
when a new hash arrives, which makes the loop not send the votes yet, but wait for more. This happens when hashes are arriving fast.The addition of
vote_generator_threshold
helps in configuring what the "high load threshold" should be.Approximate equation (assumes constant rate during sleep time):
hash_arrival_rate * sleep_time = hash
. By settinghashes
to our threshold (default 3), and sleeping the default 50ms, we expect to enter the high load mode at a vote rate of 60. Above that number, if consistent, and we should only see packs of 12 votes. In reality it's lower, at 40 or 45.So we can play with the delay and threshold to achieve a desired configuration. By default, anything below 40 tps and the node should not take more than 50ms to vote for a transaction.
AboveAround 40-60 it should take around 200ms, decreasing for higher hash arrival rates.I've tested this pretty successfully on beta already. Would be interesting to see in RC5 if no issues arise. With a 100tps push of ~2000 blocks by Json:
117,63,0,0,0,0,1,0,0,0,0,176
, where the first number is votes with 1 hash and the last is votes with 12 hashes