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

runtime: create runtime_realgcount func to reduce one time stw when fetch goroutine profile #54014

Closed
Jun10ng opened this issue Jul 23, 2022 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@Jun10ng
Copy link
Contributor

Jun10ng commented Jul 23, 2022

Using goroutineProfileWithLabelsConcurrent to fetch the number of goroutines leads to STW,

Maybe we can directly call gcount() + fing to avoid STW on pre-profile phase.

@rhysh If I were wrong, please correct me, thanks.

@gopherbot gopherbot added this to the Proposal milestone Jul 23, 2022
@seankhliao seankhliao changed the title proposal:runtime:create runtime_realgcount func to reduce one time stw when fetch goroutine profile proposal: runtime:create runtime_realgcount func to reduce one time stw when fetch goroutine profile Jul 24, 2022
@ianlancetaylor
Copy link
Contributor

There is no API change here, so taking this out of the proposal process.

@ianlancetaylor ianlancetaylor changed the title proposal: runtime:create runtime_realgcount func to reduce one time stw when fetch goroutine profile runtime: create runtime_realgcount func to reduce one time stw when fetch goroutine profile Jul 24, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 24, 2022
@ianlancetaylor ianlancetaylor added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed Proposal compiler/runtime Issues related to the Go compiler and/or runtime. labels Jul 24, 2022
@ianlancetaylor ianlancetaylor modified the milestones: Proposal, Backlog Jul 24, 2022
@gopherbot
Copy link

Change https://go.dev/cl/464349 mentions this issue: runtime: reduce one STW when obtaining goroutine configuration file

Jun10ng added a commit to Jun10ng/go that referenced this issue Dec 31, 2023
@gopherbot
Copy link

Change https://go.dev/cl/559515 mentions this issue: runtime: avoid new linkname for goroutine profiles

gopherbot pushed a commit that referenced this issue Jan 30, 2024
CL 464349 added a new linkname to provide gcount to runtime/pprof to
avoid a STW when estimating the goroutine profile allocation size.

However, adding a linkname here isn't necessary for a few reasons:

1. We already export gcount via NumGoroutines. I completely forgot about
   this during review.
2. aktau suggested that goroutineProfileWithLabelsConcurrent return
   gcount as a fast path estimate when the input is empty.

The second point keeps the code cleaner overall, so I've done that.

For #54014.

Change-Id: I6cb0811a769c805e269b55774cdd43509854078e
Reviewed-on: https://go-review.googlesource.com/c/go/+/559515
Auto-Submit: Michael Pratt <mpratt@google.com>
Auto-Submit: Nicolas Hillegeer <aktau@google.com>
Reviewed-by: Nicolas Hillegeer <aktau@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
ezz-no pushed a commit to ezz-no/go-ezzno that referenced this issue Feb 18, 2024
Fixes golang#54014

Change-Id: If4ee2752008729e1ed4b767cfda52effdcec4959
GitHub-Last-Rev: 5ce300b
GitHub-Pull-Request: golang#58239
Reviewed-on: https://go-review.googlesource.com/c/go/+/464349
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
ezz-no pushed a commit to ezz-no/go-ezzno that referenced this issue Feb 18, 2024
CL 464349 added a new linkname to provide gcount to runtime/pprof to
avoid a STW when estimating the goroutine profile allocation size.

However, adding a linkname here isn't necessary for a few reasons:

1. We already export gcount via NumGoroutines. I completely forgot about
   this during review.
2. aktau suggested that goroutineProfileWithLabelsConcurrent return
   gcount as a fast path estimate when the input is empty.

The second point keeps the code cleaner overall, so I've done that.

For golang#54014.

Change-Id: I6cb0811a769c805e269b55774cdd43509854078e
Reviewed-on: https://go-review.googlesource.com/c/go/+/559515
Auto-Submit: Michael Pratt <mpratt@google.com>
Auto-Submit: Nicolas Hillegeer <aktau@google.com>
Reviewed-by: Nicolas Hillegeer <aktau@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants