-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
4 changed files
with
29 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 \ | ||
./ |