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

Kubelet: per-pod workers should avoid grabbing the pod array lock #5685

Merged
merged 1 commit into from
Mar 20, 2015

Conversation

yujuhong
Copy link
Contributor

Per-pod worker syncs the pod and container status, and write the pod status in
the pod status cache. Given that it already owns a copy of the pod, it can
bypass the additional pod lookup step completely. This change adds a new
generatePodStatusByPod() method to achieve this. In general, per-pod worker
should avoid accessing the internal pod array completely, as this would may
lead to high contention.

This change also changes the return type of GetPodByFullName to reflect the
name, and consolidates GetPodByFullName() and GetPodByName().

@yujuhong
Copy link
Contributor Author

/cc @bradfitz @vmarmol

@bradfitz
Copy link

I assume I was summoned by accident.

@yujuhong
Copy link
Contributor Author

Yes, my apology. I meant to cc/ @fgrzadkowski

I don't know a good way to unsubscribe from a github issue once you've mentioned, so apologize again for the future noise...

@vmarmol vmarmol self-assigned this Mar 20, 2015
if !found {
return api.PodStatus{}, fmt.Errorf("Couldn't find spec for pod %s", podFullName)
return api.PodStatus{}, fmt.Errorf("Couldn't find pod %s", podFullName)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I know you didn't change it but: errors should start with lowercase and can qe use %q instead of %s? I find it helps in cases when whitespace and empty strings are concerned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Changed this and more.

@vmarmol
Copy link
Contributor

vmarmol commented Mar 20, 2015

LGTM, just a minor nit

Per-pod worker syncs the pod and container status, and write the pod status in
the pod status cache. Given that it already owns a copy of the pod, it can
bypass the additional pod lookup step completely. This change adds a new
generatePodStatusByPod() method to achieve this. In general, per-pod worker
should avoid accessing the internal pod array completely, as this would may
lead to high contention.

This change also changes the return type of GetPodByFullName to reflect the
name, and consolidates GetPodByFullName() and GetPodByName().
@yujuhong
Copy link
Contributor Author

Addressed the nit. Thanks!

@vmarmol
Copy link
Contributor

vmarmol commented Mar 20, 2015

LGTM, thanks @yujuhong and thanks for fixing the nits!

vmarmol added a commit that referenced this pull request Mar 20, 2015
Kubelet: per-pod workers should avoid grabbing the pod array lock
@vmarmol vmarmol merged commit b6d2cf4 into kubernetes:master Mar 20, 2015
@yujuhong yujuhong deleted the pod_status branch March 23, 2015 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants