Skip to content

Conversation

hzxuzhonghu
Copy link
Member

@hzxuzhonghu hzxuzhonghu commented Jul 1, 2022

Please provide a description of this PR:

This is making use of sync.Pool to relieve pressure on the garbage collector.

@hzxuzhonghu hzxuzhonghu requested review from a team as code owners July 1, 2022 09:27
@istio-policy-bot istio-policy-bot added the release-notes-none Indicates a PR that does not require release notes. label Jul 1, 2022
@istio-testing istio-testing added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 1, 2022
@hzxuzhonghu
Copy link
Member Author

Only need to look at the latest commit 0a6f271

@hzxuzhonghu
Copy link
Member Author

/test benchmark_istio

Copy link
Member

@adiprerepa adiprerepa left a comment

Choose a reason for hiding this comment

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

optimization should help a lot


// In order to save cpu, if the evicted keys is very small, we can just ignore
// TODO: make it configurable
if len(l.evictedKeys) < 100 {
Copy link
Member

Choose a reason for hiding this comment

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

is the optimization worth the inaccuracy? I think things like delta will depend on whether or not entries in the cache are still valid. We could just check the cache AND evictedKeys though -- @howardjohn

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure i understand

Copy link
Member Author

Choose a reason for hiding this comment

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

This can be seen as a debouncer, hope you can better understand

func (b EndpointBuilder) DependentConfigs(allocator *model.Allocator) []model.ConfigKey {
var configs []model.ConfigKey
if allocator != nil {
configs = allocator.Allocate(2)
Copy link
Member

Choose a reason for hiding this comment

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

why 2 here?

Copy link
Member Author

Choose a reason for hiding this comment

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

At most 2 is needed for EndpointBuilder

if features.EnableXDSCacheMetrics {
xdsCacheEvictions.Increment()
}

key := k.(string)
value := v.(cacheValue)
if l.trackEvicted {
Copy link
Member

Choose a reason for hiding this comment

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

in what scenario do we not want to track evicted? do we just not evict if this is not set?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actively Remove

@adiprerepa
Copy link
Member

@hzxuzhonghu should #39688 be closed in favor of this?

@hzxuzhonghu
Copy link
Member Author

hzxuzhonghu commented Jul 1, 2022

Intend to make #39688 first as it is almost there.

But the commit is largely dependent on previous pr.

@istio-testing
Copy link
Collaborator

@hzxuzhonghu: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
integ-security-multicluster_istio 0a6f271 link true /test integ-security-multicluster_istio

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Member

@howardjohn howardjohn left a comment

Choose a reason for hiding this comment

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

As mentioned before, I don't feel comfortable merging these types of performance changes, which may or may not bring improvement, without numbers actually showing differences.

Currently our benchmarks only show a regression from this change, so if the are not giving accurate coverage then please update them.

@hzxuzhonghu
Copy link
Member Author

i have to say can we be fair? addind dependentconfigs to cache value does not improve any perf, but on opposite mem costing.. i just reverted the bad stuff in #39688

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes-none Indicates a PR that does not require release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants