-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
doc: runtime/pprof: block profiler documentation needs some love #14689
Comments
What I'd be most interested to learn from a blog post on the blocking profiler is what to expect in terms of performance overhead. I've taken the fact that it's not enabled by default (compared with e.g. the heap profiler) to mean that it may have a significant impact on runtime performance. On the other hand, its instrumentation points seem to be a subset of what's covered by |
Thanks @rhysh, that clears up the units a little. I found this sentence is quite hard to read. With the example @rhysh gave of
|
Any progress on this? |
No progress on this. (Progress would be posted here, and nothing is posted here) Help wanted. |
I have reason to use this in a non-server context. I will attempt to provide/contribute some documentation but I can't make any guarantees that it will be interesting or useful. I will update here as I get information. |
I would really like to add this function:
to src/runtime/pprof/pprof.go. I think that would make the Block profile API more consistent with the memory and CPU profile APIs. I know that this is not the place to get code reviews, but I wanted to get everyone's gut reaction before I started with the gerrit code review, etc. I have already integrated this into a few test applications and it works pretty well, actually. I look forward to hearing your feedback! Thanks! |
@whh8b, it's too late to add anything new to Go 1.9. This CL is marked Go 1.9Maybe because it's a documentation-only change. To propose new API changes, open a new bug. |
Just came across a comment from @rsc on reddit about this:
|
More than 3 years has gone since this post is initiated as today's date is 19/08/2019 and still credible information is unavailable on GoLang Blocking profiler. |
I would like to benefit from the resolution of this issue as well, I'm willing to dedicate time to this but I don't have the knowledge required and I'm not sure how to get it. Is anyone willing to do a brain-dump (e.g. a short video call) and I can take care of it from there (write up and submitting the cl)? |
I've taken a shot at documenting the profiler here: https://github.com/felixge/go-profiler-notes/blob/main/block.md I'd be happy to upstream some of this into the official docs. As a starting point I think we should document how |
The current description of the rate parameter is a bit cryptic and possibly not accurate. It's replaced with a more verbose and explicit description of the sampling process. Additionally a bias in the sampling for rate > 1 is pointed out. Partially fixes golang#14689.
The current description of the rate parameter is a bit cryptic and possibly not accurate. It's replaced with a more verbose and explicit description of the sampling process. Additionally a bias in the sampling for rate > 1 is pointed out. Partially fixes golang#14689.
Change https://go.dev/cl/547057 mentions this issue: |
Change https://go.dev/cl/547955 mentions this issue: |
Amazingly, we seem to have nearly no in-tree documentation on the semantics of block and mutex profiles. Add brief summaries, including the new behavior from CL 506415 and CL 544195. For #14689. For #44920. For #57071. For #61015. Change-Id: I1a6edce7c434fcb43f17c83eb362b1f9d1a32df1 Reviewed-on: https://go-review.googlesource.com/c/go/+/547057 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Rhys Hiltner <rhys@justin.tv> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Adding explicit section headers makes it cleaner to split the profile descriptions into multiple paragraphs, as there is now an explicit transition from discussion of one profile type to the next. For #14689. Change-Id: Ifcff918367e91a165ee5f74423be3935b421972b Reviewed-on: https://go-review.googlesource.com/c/go/+/547955 Reviewed-by: Rhys Hiltner <rhys@justin.tv> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com>
Amazingly, we seem to have nearly no in-tree documentation on the semantics of block and mutex profiles. Add brief summaries, including the new behavior from CL 506415 and CL 544195. For golang#14689. For golang#44920. For golang#57071. For golang#61015. Change-Id: I1a6edce7c434fcb43f17c83eb362b1f9d1a32df1 Reviewed-on: https://go-review.googlesource.com/c/go/+/547057 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Rhys Hiltner <rhys@justin.tv> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Adding explicit section headers makes it cleaner to split the profile descriptions into multiple paragraphs, as there is now an explicit transition from discussion of one profile type to the next. For golang#14689. Change-Id: Ifcff918367e91a165ee5f74423be3935b421972b Reviewed-on: https://go-review.googlesource.com/c/go/+/547955 Reviewed-by: Rhys Hiltner <rhys@justin.tv> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com>
The link to "Debugging performance issues in Go programs" in the OP is broken; you can find the article on the Go Wiki |
Reading https://golang.org/pkg/runtime/pprof/ does not make clear how to use the blocking profiler in an application.
The blog post at http://blog.golang.org/profiling-go-programs (2011) finishes with:
But I cannot find any follow up.
In a post to the mailing list someone said that Brad mentioned it briefly in a talk, but he only mentions
go test -blockprofile
, and I'm not running tests.I have used several search engines to look for materials but they all point at runtime/pprof and other not-useful-to-me blog posts. Getting creative, I just thought I would dive in and try to use it:
Which results in a file with contents which don't look useful:
Finally, I searched github for "pprof lookup block". This appears to show some examples of its use and reveals the function
runtime.SetBlockProfile
. However, this function is also quite confusingly documented.Is
rate
really a fraction, between 0 and 1? If so, since it is anint
, it would seem my options are to either pass it 0 or 1, but the suggestion that it is a fraction seems contradictory. Is it necessary to call this function to start the profiler?To conclude, the documentation at
runtime/pprof
really needs to make it clear how to use the block profiler. Some facts which are still not clear to me, even after reading code found elsewhere:StartBlockProfiler
function?P.S. I did eventually find Debugging performance issues in Go programs, which answers some of these questions. But unfortunately it was not easy to find for some reason.
The text was updated successfully, but these errors were encountered: