Improve service deepcopy#37932
Merged
istio-testing merged 4 commits intoistio:masterfrom Mar 15, 2022
Merged
Conversation
GregHanson
approved these changes
Mar 15, 2022
ramaraochavali
approved these changes
Mar 15, 2022
howardjohn
reviewed
Mar 15, 2022
| // DeepCopy creates a clone of Service. | ||
| // TODO : See if there is any efficient alternative to this function - copystructure can not be used as is because | ||
| // Service has sync.RWMutex that can not be copied. | ||
| func (s *Service) DeepCopy() *Service { |
Member
There was a problem hiding this comment.
Wonder if for our DeepCopy implementations we should add Fuzz tests comparing them to copystructure or something. Then we can ensure our performance optimizations are also correct
aryan16
pushed a commit
to aryan16/istio
that referenced
this pull request
Mar 28, 2022
* optimize service deepcopy * benchmark * update * fix lint
airbnb-gerrit
pushed a commit
to airbnb/istio
that referenced
this pull request
Sep 13, 2022
DeepCopy using reflection is super slow, and a big chunk of init push context time is doing deep copy. This is already improved a lot by this PR: istio#37932 (init push context time drop from 1m30s to 40s). ServiceAttribute DeepCopy is still taking more than 10% cpu time, so improving this function can further reduce the init push context time and hence our propagation delay. Benchmark results: (before) goos: darwin goarch: amd64 pkg: istio.io/istio/pilot/pkg/model cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz BenchmarkServiceDeepCopy BenchmarkServiceDeepCopy-16 132760 8190 ns/op PASS (after) goos: darwin goarch: amd64 pkg: istio.io/istio/pilot/pkg/model cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz BenchmarkServiceDeepCopy BenchmarkServiceDeepCopy-16 1213035 1019 ns/op PASS Change-Id: Ied3e81d252ccf226bbb8d1d56eb88bff7c146af4 Reviewed-on: https://gerrit.musta.ch/c/public/istio/+/3700 Reviewed-by: Douglas Jordan <[email protected]> Reviewed-by: Weibo He <[email protected]>
istio-testing
pushed a commit
that referenced
this pull request
Sep 14, 2022
* istio: improve deep copy for service attributes DeepCopy using reflection is super slow, and a big chunk of init push context time is doing deep copy. This is already improved a lot by this PR: #37932 (init push context time drop from 1m30s to 40s). ServiceAttribute DeepCopy is still taking more than 10% cpu time, so improving this function can further reduce the init push context time and hence our propagation delay. Benchmark results: (before) goos: darwin goarch: amd64 pkg: istio.io/istio/pilot/pkg/model cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz BenchmarkServiceDeepCopy BenchmarkServiceDeepCopy-16 132760 8190 ns/op PASS (after) goos: darwin goarch: amd64 pkg: istio.io/istio/pilot/pkg/model cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz BenchmarkServiceDeepCopy BenchmarkServiceDeepCopy-16 1213035 1019 ns/op PASS Change-Id: Ied3e81d252ccf226bbb8d1d56eb88bff7c146af4 Reviewed-on: https://gerrit.musta.ch/c/public/istio/+/3700 Reviewed-by: Douglas Jordan <[email protected]> Reviewed-by: Weibo He <[email protected]> * istio: fix lint AddressMap contains a mutex which govet complains if we return a copy, ignoring the vet error (behavior is the same as before). Change-Id: If0274e6e1412eb50586ea609a07c302557297ad8 Reviewed-on: https://gerrit.musta.ch/c/public/istio/+/3706 Reviewed-by: Weibo He <[email protected]>
istio-testing
pushed a commit
to istio-testing/istio
that referenced
this pull request
Jan 4, 2023
DeepCopy using reflection is super slow, and a big chunk of init push context time is doing deep copy. This is already improved a lot by this PR: istio#37932 (init push context time drop from 1m30s to 40s). ServiceAttribute DeepCopy is still taking more than 10% cpu time, so improving this function can further reduce the init push context time and hence our propagation delay. Benchmark results: (before) goos: darwin goarch: amd64 pkg: istio.io/istio/pilot/pkg/model cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz BenchmarkServiceDeepCopy BenchmarkServiceDeepCopy-16 132760 8190 ns/op PASS (after) goos: darwin goarch: amd64 pkg: istio.io/istio/pilot/pkg/model cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz BenchmarkServiceDeepCopy BenchmarkServiceDeepCopy-16 1213035 1019 ns/op PASS Change-Id: Ied3e81d252ccf226bbb8d1d56eb88bff7c146af4 Reviewed-on: https://gerrit.musta.ch/c/public/istio/+/3700 Reviewed-by: Douglas Jordan <[email protected]> Reviewed-by: Weibo He <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please provide a description of this PR:
remove using copy structure for simple type.