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

Reduce the cpu cycles in runtime.findrunnable #1942

Closed
tanjianfeng opened this issue Feb 24, 2020 · 7 comments
Closed

Reduce the cpu cycles in runtime.findrunnable #1942

tanjianfeng opened this issue Feb 24, 2020 · 7 comments
Assignees
Labels
area: performance Issue related to performance & benchmarks auto-closed stale-issue This issue has not been updated in 120 days. type: bug Something isn't working

Comments

@tanjianfeng
Copy link
Contributor

tanjianfeng commented Feb 24, 2020

This code path is indeed very slow in go schedule:

  1. runqsteal
  2. stopm, which is a simple futex syscall, and exaggerated by sentry (+hundreds of ns).

And this is a generic problem in Go. "the cumulative time spent in runtime.runqsteal was the largest contributor to the cumulative time of runtime.findrunnable".

Historically, people relief this issue by reducing GOMAXPROCS. But in our case, we cannot simplily do that, as smaller GOMAXPROCS leads to larger latency when load becomes larger.

Some unmature ideas:

  • Dynamic GOMAXPROCS.
  • Avoid the usleep in runqgrab.
  • Call runsteal with more strict condition.

Any thoughts?

@prattmic prattmic added area: performance Issue related to performance & benchmarks type: bug Something isn't working labels Feb 24, 2020
@prattmic prattmic self-assigned this Mar 2, 2020
@prattmic
Copy link
Member

prattmic commented Mar 2, 2020

We've seen this a lot as well. Reducing this cost is definitely one of our priorities going forward.

@navytux
Copy link

navytux commented Mar 11, 2020

Even though it originated in runtime.LockOSThread, this issue looks to be related: golang/go#21827.

@amscanne
Copy link
Contributor

I've created a meta-issue to discuss scalability improvements #2184. There is also a first specific proposal being discussed in #2180.

@prattmic
Copy link
Member

@tanjianfeng I am collecting a set of canonical benchmarks to use when working on this problem. If you have any good benchmark workloads that particularly suffer from this that you can share, that would be helpful.

@tanjianfeng
Copy link
Contributor Author

@tanjianfeng I am collecting a set of canonical benchmarks to use when working on this problem. If you have any good benchmark workloads that particularly suffer from this that you can share, that would be helpful.

Sorry for late response. #2033 is an example in hand.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 120 days.

@github-actions github-actions bot added the stale-issue This issue has not been updated in 120 days. label Sep 15, 2023
Copy link

This issue has been closed due to lack of activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: performance Issue related to performance & benchmarks auto-closed stale-issue This issue has not been updated in 120 days. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants