You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make late votes not enter consensus peer msg queue #3154
Related to #2927. We should make the consensus reactor, upon seeing a vote message, check if the vote is late and ignore it, outside of consensus state's processing.
This will Save WAL writes, and time under consensus mutex
Problem Definition
On Osmosis RPC nodes, we see 2 million late votes per hour, which I think should mean considerably more work load under the consensus mutex.
We still want precommits for the last block to get into the consensus mutex if they aren't duplicate, so perhaps this should be:
// if vote is late, and is not a precommit for the last block, mark it late and return.
isLate := msg.Vote.Height < csHeight || (msg.Vote.Height == cs.Height && msg.Vote.Round < csRound)
if isLate {
isLastBlockPrecommit := msg.Vote.Type != types.PrecommitType || msg.Vote.Height != csHeight-1
if isLastBlockPrecommit {
cs.metrics.MarkLateVote(msg.Vote.Type)
return
}
}
There is no metric for how many precommits for the last block get in. JUst how many late votes we have.
We get on average on our RPC nodes, 440 late precommits and 75 late prevotes per second. Saving 75 late prevotes from blocking the consensus mutex / WAL seems worth the change to me
Reactor keeps some summary of the consensus protocol state; it is not the latest one, as we don't want lock contention, but it is update enough to figure out old/useless votes
Reactor uses this summary to drop clearly old/useless messages. Some messages are old/useless but the reactor does not know that yet, but we are ok here.
At the consensus level we can really see whether a message is valid/useful of not. We could anticipate such checks so that to only acquire the consensus lock and write the message to the WAL when this pre-check does not report that the message is super old. We are still paying the synchronization cost of the channel between reactor and state, but at least the logic is simpler to follow, and can even apply to a broader spectrum of scenarios.
Activity
ValarDragon commentedon May 31, 2024
We still want precommits for the last block to get into the consensus mutex if they aren't duplicate, so perhaps this should be:
ValarDragon commentedon May 31, 2024
There is no metric for how many precommits for the last block get in. JUst how many late votes we have.
We get on average on our RPC nodes, 440 late precommits and 75 late prevotes per second. Saving 75 late prevotes from blocking the consensus mutex / WAL seems worth the change to me
cason commentedon Jun 10, 2024
My opinion on that:
At the consensus level we can really see whether a message is valid/useful of not. We could anticipate such checks so that to only acquire the consensus lock and write the message to the WAL when this pre-check does not report that the message is super old. We are still paying the synchronization cost of the channel between reactor and state, but at least the logic is simpler to follow, and can even apply to a broader spectrum of scenarios.
cason commentedon Jul 1, 2024
Notice that we need votes from previous rounds for some transitions in the state machine. See lines on the archive paper:
and
Notice that the round
ris not currentroundp.