Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize conditions of ServiceReplenishmentUpdateFunc to replenish service #28991

Merged
merged 1 commit into from
Aug 5, 2016

Conversation

249043822
Copy link
Member

Originally, the replenishQuota method didn't focus on the third parameter object even if others transfered to it, i think the function is not efficient and perfect. then i use the third param to get MatchResources, it will be more exact. for example, if the old pod was quota tracked and the new was not, the replenishQuota only focus on usage resource of the old pod, still if the third parameter object is nil, the process will be same as before

@k8s-bot
Copy link

k8s-bot commented Jul 15, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

4 similar comments
@k8s-bot
Copy link

k8s-bot commented Jul 15, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-bot
Copy link

k8s-bot commented Jul 15, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-bot
Copy link

k8s-bot commented Jul 15, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-bot
Copy link

k8s-bot commented Jul 15, 2016

Can one of the admins verify that this patch is reasonable to test? If so, please reply "ok to test".
(Note: "add to whitelist" is no longer supported. Please update configurations in kubernetes/test-infra/jenkins/job-configs/kubernetes-jenkins-pull instead.)

This message may repeat a few times in short succession due to jenkinsci/ghprb-plugin#292. Sorry.

Otherwise, if this message is too spammy, please complain to ixdy.

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-label-needed labels Jul 15, 2016
@derekwaynecarr
Copy link
Member

I agree replenish quota could be made more efficient.

I am interested in exploring a means to track what resources on a quota are dirty so that when a quota is synced, we only recalculate the dirty set rather than all resources on the quota. There was a recent PR to reduce the number of queries on sync (see #29134), but I agree there is more than can and should be done.

I have a concern with this PR that the underlying expectation is that the computation of usage for the object is cheap in UsageFunc. It is true for existing Kubernetes resources tracked under quota, but its not true for some complex resources in OpenShift that shares this same core framework. There are some scenarios where calculating the usage of an object may require fetching additional information to some kind of roll-up.

Since this PR ignores the usage values, and just wants to know the set of potential keys, if we had a way of telling the UsageFunc to not worry about calculating values I would have fewer concerns.

As for the scenario this PR helps, did you have one in mind where the set of resources tracked by an Evaluator differed from the runtime.Object in a material way that showed problems? Best I can think of is a quota that tracked services.loadbalancers would now be able to ignore changes to services that are not of that type. That seems useful, so maybe a unit test for that scenario would be good to ensure replenishQuota works as you desire?

I also agree that ReplenishmentFunc was vague on the object, and agree that it should have been the oldObject so can you update the typedef to take that into account?

@derekwaynecarr
Copy link
Member

/cc @deads2k - fyi

@derekwaynecarr derekwaynecarr added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Jul 21, 2016
@derekwaynecarr derekwaynecarr added this to the v1.4 milestone Jul 21, 2016
@249043822 249043822 force-pushed the zhangke-patch-008 branch from 4bbe448 to 7c10931 Compare July 26, 2016 09:03
@249043822
Copy link
Member Author

Hi @derekwaynecarr , first thanks for your guidance above, i have thought about carefully, the UsageFunc
func seems not useful, it can not solve the problem of efficiency in essence. As the sync process focus on resource quota using queue, not for special resource set, so only change this architecture could make replenish quota more efficient, but this need a well thought out plan. Now in this pr, i only do a optimize for replenish quota of service, for example, if if a service goes from node port -> node port, although it was quota tracked, wo still need not do replenish quota , only a servcie type has changed, wo would do replenish quota.

@249043822 249043822 changed the title replenish quota use specified input object optimize conditions of ServiceReplenishmentUpdateFunc to replenish service Jul 26, 2016
@k8s-github-robot k8s-github-robot added do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. retest-not-required-docs-only and removed retest-not-required-docs-only labels Jul 28, 2016
@249043822
Copy link
Member Author

hi @derekwaynecarr , did you checked this pr?

@249043822
Copy link
Member Author

@derekwaynecarr

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 4, 2016
@derekwaynecarr
Copy link
Member

ok to test

@derekwaynecarr derekwaynecarr added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. labels Aug 5, 2016
@derekwaynecarr
Copy link
Member

thanks for the update and test case.

@k8s-bot
Copy link

k8s-bot commented Aug 5, 2016

GCE e2e build/test passed for commit 3973856.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit e84a8ec into kubernetes:master Aug 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants