Skip to content

Backport of perf: Remove expensive reflection from raft/mesh hot path into release/1.14.x#17492

Merged
hc-github-team-consul-core merged 2 commits intorelease/1.14.xfrom
backport/lstoll-deepcopy-upstreamdownstream/grossly-sincere-phoenix
May 26, 2023
Merged

Backport of perf: Remove expensive reflection from raft/mesh hot path into release/1.14.x#17492
hc-github-team-consul-core merged 2 commits intorelease/1.14.xfrom
backport/lstoll-deepcopy-upstreamdownstream/grossly-sincere-phoenix

Conversation

@hc-github-team-consul-core
Copy link
Collaborator

Backport

This PR is auto-generated from #16552 to be assessed for backporting due to the inclusion of the label backport/1.14.

The below text is copied from the body of the original PR.


Description

Replaces a reflection-based copy of a struct in the mesh topology with a deep-copy generated implementation.

This is in the hot-path of raft FSM updates, and the reflection overhead was a substantial part of mesh registration times (~90%). This could manifest as raft thread saturation, and resulting instability.

This is a similar problem/fix as #14934, it might be worth seeing if there are any other uses of the reflection copy library and replacing it with (generated) copies.

Fixes #16551

Testing & Reproduction steps

Details in issue #16551 . The before/after from the test case in that issue:

Screenshot 2023-03-07 at 11 35 23

After the change was rolled out, we no longer saw any registration delays and the general raft/FSM thread saturation dropped off substantially

image

PR Checklist

  • updated test coverage
  • external facing docs updated
  • not a security concern

Overview of commits

@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/lstoll-deepcopy-upstreamdownstream/grossly-sincere-phoenix branch from a793c5c to 0c44166 Compare May 26, 2023 17:42
@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/lstoll-deepcopy-upstreamdownstream/grossly-sincere-phoenix branch from a246621 to fca4738 Compare May 26, 2023 17:42
@hc-github-team-consul-core hc-github-team-consul-core enabled auto-merge (squash) May 26, 2023 17:42
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved Consul Bot automated PR

@vercel vercel bot temporarily deployed to Preview – consul-ui-staging May 26, 2023 17:46 Inactive
@vercel vercel bot temporarily deployed to Preview – consul May 26, 2023 17:47 Inactive
@hc-github-team-consul-core hc-github-team-consul-core merged commit 96bb646 into release/1.14.x May 26, 2023
@hc-github-team-consul-core hc-github-team-consul-core deleted the backport/lstoll-deepcopy-upstreamdownstream/grossly-sincere-phoenix branch May 26, 2023 17:56
huikang pushed a commit that referenced this pull request May 30, 2023
… into release/1.14.x (#17492)

* backport of commit 04b6a90

* backport of commit 13e4057

---------

Co-authored-by: Lincoln Stoll <me@lds.li>
Co-authored-by: John Murret <john.murret@hashicorp.com>
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.

4 participants