Skip to content

kvserver: use cheaper raftSparseStatus during replica ticks#94594

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
erikgrinaker:raft-basic-status-progress
Jan 3, 2023
Merged

kvserver: use cheaper raftSparseStatus during replica ticks#94594
craig[bot] merged 1 commit intocockroachdb:masterfrom
erikgrinaker:raft-basic-status-progress

Conversation

@erikgrinaker
Copy link
Copy Markdown
Contributor

@erikgrinaker erikgrinaker commented Jan 2, 2023

In an idle cluster with many unquiesced replicas, 40% of the Replica.tick CPU time is spent on raft.RawNode.Status(), when considering quiescence and Raft leadership transfers. This status call incurs expensive deep copies of the Config and Progress.Inflights fields, but these fields are never used by the callers.

This patch instead introduces a raftSparseStatus without these expensive and unnecessary fields, which reduces the CPU cost of ticks by about 20%.

Touches #94592.
Touches #94609.

Epic: none
Release note: None

In an idle cluster with many unquiesced replicas, 40% of the
`Replica.tick` CPU time is spent on `raft.RawNode.Status()`, when
considering quiescence and Raft leadership transfers. This status call
incurs expensive deep copies of the `Config` and `Progress.Inflights`
fields, but these fields are never used by the callers.

This patch instead introduces a `raftSparseStatus` without these
expensive and unnecessary fields, which reduces the CPU cost of ticks by
about 20%.

Epic: none
Release note: None
@erikgrinaker erikgrinaker requested review from a team and tbg January 2, 2023 19:07
@erikgrinaker erikgrinaker self-assigned this Jan 2, 2023
@erikgrinaker erikgrinaker requested a review from a team as a code owner January 2, 2023 19:07
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@erikgrinaker
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jan 3, 2023

Build succeeded:

@craig craig bot merged commit 59ce13b into cockroachdb:master Jan 3, 2023
@erikgrinaker erikgrinaker deleted the raft-basic-status-progress branch January 3, 2023 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants