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

proposal: runtime: add SchedStats API #15490

Open
deft-code opened this Issue Apr 29, 2016 · 15 comments

Comments

Projects
None yet
8 participants
@deft-code

deft-code commented Apr 29, 2016

MemStats provides a way to monitor allocation and garbage collection.

We need a similar facility to monitor the Scheduler.

Briefly:

  • Total goroutines create
  • Current number of of goroutines
  • Total number of goroutines scheduled
  • Current number of goroutines scheduled
  • Total thread starts
  • Current number of threads.
  • Metrics on the delay between a goroutine being ready and running on a proc.
@minux

This comment has been minimized.

Member

minux commented Apr 29, 2016

@aclements

This comment has been minimized.

Member

aclements commented Apr 30, 2016

@minux, while true, runtime/trace seems like a pretty high overhead way to collect what amounts to a fairly small amount of information. It's certainly low overhead for what it does, but what it does is much more than what's needed here. The metrics @deft-code wants are primarily intended for continuous monitoring (based on offline conversations), so it needs to be cheap.

@aclements

This comment has been minimized.

Member

aclements commented Apr 30, 2016

Here are the notes on the desired metrics I had from our meeting a while ago:

Ring buffer of sampled duration between entering and exiting runnable state

  • With some probability, when a goroutine enters runnable, tag it, and when it exits runnable, add the runnable duration to a ring
  • Consumers can do what they want with these samples, including just averaging them, or building distributions.

Four global stats

  • Current number of goroutines
  • Total number of goroutines ever created
  • Current number of runnable goroutines
  • Total number of runnable-to-running transitions

Maybe current number of running goroutines

@bradfitz bradfitz added this to the Unplanned milestone May 4, 2016

@bradfitz bradfitz added the Proposal label May 4, 2016

@bradfitz

This comment has been minimized.

Member

bradfitz commented Aug 22, 2016

Assigning to @aclements to decide what we're willing to support long-term.

@adg

This comment has been minimized.

Contributor

adg commented Sep 26, 2016

Ping @aclements

@rsc

This comment has been minimized.

Contributor

rsc commented Dec 19, 2016

Still up to @aclements.

@rsc

This comment has been minimized.

Contributor

rsc commented Jan 9, 2017

Ping @aclements. Can you look at this during the release candidate quiet?

@aclements

This comment has been minimized.

Member

aclements commented Jan 9, 2017

@deft-code, do the specific stats I suggested in #15490 (comment) address your needs?

@aclements aclements modified the milestones: Go1.9Early, Unplanned Jan 9, 2017

@aclements

This comment has been minimized.

Member

aclements commented Jan 10, 2017

Sorry, I'd lost track of the fact that there was a concrete proposal doc for this: https://github.com/deft-code/proposal/blob/master/design/15490-schedstats.md

@deft-code, could you mail a CL to add this to the go-proposal repository and, once submitted, edit your first post to link to it? Thanks.

@deft-code

This comment has been minimized.

deft-code commented Jan 11, 2017

I'll get on top of it.

@aclements

This comment has been minimized.

Member

aclements commented Jan 11, 2017

Thanks!

@rsc rsc changed the title from proposal: runtime SchedStats API to proposal: runtime: add SchedStats API Jan 23, 2017

@gopherbot

This comment has been minimized.

gopherbot commented Mar 14, 2017

CL https://golang.org/cl/38180 mentions this issue.

@rsc

This comment has been minimized.

Contributor

rsc commented Mar 27, 2017

Do we need to keep this issue open, or should we accept it?

@aclements

This comment has been minimized.

Member

aclements commented Mar 27, 2017

There's definitely still work to do on how and what exactly the API should expose, but I think it's pretty clear we need to provide some visibility into the scheduler.

@rsc

This comment has been minimized.

Contributor

rsc commented Mar 28, 2017

Teams inside Google are patching in CL 38180 and getting some experience with it. If others would like to do the same, please do. We'll probably wait until Go 1.10 to decide to add the API officially. Putting the proposal on hold until then.

@rsc rsc added the Proposal-Hold label Mar 28, 2017

@bradfitz bradfitz modified the milestones: Go1.10Early, Go1.9Early May 3, 2017

@bradfitz bradfitz removed the NeedsDecision label May 22, 2017

@bradfitz bradfitz removed this from the Go1.10Early milestone Jun 14, 2017

@bradfitz bradfitz modified the milestones: Go1.10, Go1.10Early Jun 14, 2017

@rsc rsc modified the milestones: Go1.10, Go1.11 Nov 29, 2017

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.12 Jun 27, 2018

@bradfitz bradfitz modified the milestones: Go1.12, Go1.13 Nov 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment