mirror of https://github.com/hashicorp/consul
Browse Source
* perf: Remove expensive reflection from raft/mesh hot path 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. Co-authored-by: Joel Brandhorst <joel.brandhorst@gmail.com> * add changelog --------- Co-authored-by: Joel Brandhorst <joel.brandhorst@gmail.com> Co-authored-by: John Murret <john.murret@hashicorp.com>pull/17494/head
Lincoln Stoll
2 years ago
committed by
GitHub
5 changed files with 32 additions and 17 deletions
@ -0,0 +1,3 @@
|
||||
```release-note:improvement |
||||
raft: Remove expensive reflection from raft/mesh hot path |
||||
``` |
@ -0,0 +1,15 @@
|
||||
// generated by deep-copy -pointer-receiver -o ./catalog_schema.deepcopy.go -type upstreamDownstream ./; DO NOT EDIT.
|
||||
|
||||
package state |
||||
|
||||
// DeepCopy generates a deep copy of *upstreamDownstream
|
||||
func (o *upstreamDownstream) DeepCopy() *upstreamDownstream { |
||||
var cp upstreamDownstream = *o |
||||
if o.Refs != nil { |
||||
cp.Refs = make(map[string]struct{}, len(o.Refs)) |
||||
for k2, v2 := range o.Refs { |
||||
cp.Refs[k2] = v2 |
||||
} |
||||
} |
||||
return &cp |
||||
} |
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash |
||||
|
||||
readonly PACKAGE_DIR="$(dirname "${BASH_SOURCE[0]}")" |
||||
cd $PACKAGE_DIR |
||||
|
||||
# Uses: https://github.com/globusdigital/deep-copy |
||||
deep-copy \ |
||||
-pointer-receiver \ |
||||
-o ./catalog_schema.deepcopy.go \ |
||||
-type upstreamDownstream \ |
||||
./ |
Loading…
Reference in new issue