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

WIP: Add pod-to-rc cache for RC/Job/DaemonSet/Endpoint #18972

Closed
mqliang opened this issue Dec 21, 2015 · 4 comments
Closed

WIP: Add pod-to-rc cache for RC/Job/DaemonSet/Endpoint #18972

mqliang opened this issue Dec 21, 2015 · 4 comments
Labels
needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. priority/backlog Higher priority than priority/awaiting-more-evidence.

Comments

@mqliang
Copy link
Contributor

mqliang commented Dec 21, 2015

K8s use Labels and Selector to couple pods and the ReplicationController, currently, when find the rc for a pod, k8s will traverse all rcs to find the matching one, which is not efficiency.

Some optimization could be done to improve the look up time, such as:

  1. add namespace index, so that filter first on namespace and then search in that namespace for a match. see add namespace index for cache in replication controller manager #17277
  2. add a "equivalent pod" cache: usually, a rc will have a replica number 3-5, which means there are 3-5 pods will have same labels(and thus same rcs), so there is no need to search the matching rc for every "equivalent" pods. We can search the matching rc for the first pod, and cache the result. ControllerManager could watch the update/delete of rcs, and marks a cached value as dirty. When need find the matching rc for a new pod, check to see if the search result for an equivalent pod is already cached. If so, re-search the matching rc just for the "dirty" values
@mqliang
Copy link
Contributor Author

mqliang commented Dec 21, 2015

I will send some PRs address each in turn.

@mqliang
Copy link
Contributor Author

mqliang commented Dec 21, 2015

The same "equivalent cache" optimization skills has been introduced into Scheduler:
#17390

@mikedanese mikedanese added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Dec 21, 2015
@mqliang
Copy link
Contributor Author

mqliang commented Dec 26, 2015

see PR #19043

@mqliang mqliang changed the title WIP: Add pod-to-rc cache for RC/Job/DaemonSet WIP: Add pod-to-rc cache for RC/Job/DaemonSet/Endpoint Dec 28, 2015
@lavalamp lavalamp added team/control-plane and removed sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Jan 25, 2016
@davidopp davidopp added the priority/backlog Higher priority than priority/awaiting-more-evidence. label Feb 4, 2016
@k8s-github-robot k8s-github-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label May 31, 2017
@0xmichalis
Copy link
Contributor

ns indexed caches are OK for now - I think the lookup cache in the RC controller was removed at some point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. priority/backlog Higher priority than priority/awaiting-more-evidence.
Projects
None yet
Development

No branches or pull requests

6 participants