-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
head change coalescer #4688
head change coalescer #4688
Conversation
257799e
to
49544a3
Compare
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.
Logic looks good to me!
if cancel { | ||
continue | ||
} | ||
|
||
newRevert = append(newRevert, ts) |
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.
Nit: Can these be changed to
if !cancel {
newRevert = append(newRevert, ts)
}
49544a3
to
378d7a1
Compare
@vyzo so the code here appears to work pretty well, but I'm still seeing the mempool triggering recent state calls. Maybe we can just bump the timeout number? Will try now... |
To check this, I just grabbed a random 120 second profile of the lotus node while its fully caught up |
We can try to add some more smarts -- for instance, when it's time to trigger the callback check to see if the last coalesce was within some bound (say 100ms) -- and if that's the case wait some more. |
Also, some state computations are unavoidable, we do have to compute at some point, we would just like to avoid the unnecessary ones :) |
Added some more smarts to the coalescing algorithm, controlled by 3 parameters: minDelay, maxDelay, and mergeInterval. When the first head chance (since the last dispatch) is received, the coalescer schedules a timer for minDelay to coalesce more head changes. For the mpool, I have set minDelay=2s, maxDelay=6s, and mergeInterval=1s. |
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.
New version looks good to me
No description provided.