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

feature: update lock policy for container management #1307

Merged
merged 1 commit into from
Jun 5, 2018

Conversation

allencloud
Copy link
Collaborator

@allencloud allencloud commented May 11, 2018

Signed-off-by: Allen Sun allensun.shl@alibaba-inc.com

Ⅰ. Describe what this PR did

In the container manager, code usually use

c.Lock()
defer c.Unlock()

to avoid race condition. While I think it is not so preferred since it does have serious affect on performance.

This PR dis three types of things:

  • encapsulate all state management into a single file container_state.go;
  • make container.Lock much more grained granularity.
  • change log format to make it more explicit.

Ⅱ. Does this pull request fix one issue?

fixes #1244

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@allencloud allencloud changed the title feature: update lock policy for container management [WIP] feature: update lock policy for container management May 11, 2018
@allencloud allencloud force-pushed the modify-lock branch 15 times, most recently from 536d62b to a8596a8 Compare May 14, 2018 07:21
@allencloud
Copy link
Collaborator Author

This pull request still do no lock on c.Write(mgr.Store) which seems that marshalling a struct with sync.Mutex may cause block.

@allencloud allencloud changed the title [WIP] feature: update lock policy for container management feature: update lock policy for container management May 15, 2018
@allencloud
Copy link
Collaborator Author

Thanks godness, this pr has passed all the ci tests. While to avoid if this is coincidence, I re-trigger the test to do a double check.

Signed-off-by: Allen Sun <allensun.shl@alibaba-inc.com>
@HusterWan
Copy link
Contributor

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Jun 5, 2018
@allencloud allencloud merged commit ccc38fd into AliyunContainerService:master Jun 5, 2018
@allencloud allencloud deleted the modify-lock branch June 5, 2018 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[performance] lock critical section reasonably and do not lock unnecessary code procedure
6 participants