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
cmd/go: tool pprof gives no samples #24443
Comments
The samples are there, but the
|
I tend to do |
/cc @adg |
Related: google/pprof#182 Could we make pprof require a flag for memory profiles indicating which kind is wanted instead of defaulting to inuse_space (which is almost never what I want)? The default seems to be a source of significant, persistent confusion. |
For live server profiling inuse_space is more meaningful than the alloc_space. |
What about falling back to alloc when inuse is empty? This almost always
happen when profiling microbenchmarks.
…On Mon, 19 Mar 2018, 21:07 Hyang-Ah Hana Kim, ***@***.***> wrote:
For live server profiling inuse_space is more meaningful than the
alloc_space.
Moreover, memory profiling libraries for other languages (e.g. C++) often
choose to report only inuse_* equivalent metrics.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#24443 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADa683jwhNLoPwgjmHOHr4LQMvURIzTZks5tgA_3gaJpZM4Svk1h>
.
|
@hyangah this doesn't match my experience. I run memory profiles on live servers with alloc_space more often than with inuse_space. The most common reason that I run a memory profile is as part of performance optimizations and reducing allocations is a really common optimization. inuse_space is useful for debugging leaks (and, rarely, surprisingly-large-but-not-growing heaps), which I do less often. This might be different from C++ where it's easier to write memory leaks. |
@cespare not only memory leak. inuse_space is one of the first places to look into when optimizing the memory usage in stable state or comparing multiple different instances with different configuration. alloc_space is of course useful for allocation optimization. For benchmark or test or short running programs, this doesn't make much - why do we care about the inuse_space from the last GC after the end of the program, right? @rauls5382 and @aalexand, is there any way to tell pprof to choose alloc_space over inuse_space for such profile data? For example, what do you think about recording preferred value sample index in the profile, or just dropping inuse_space samples from benchmark or test generated profile out? |
I'd settle for a print statement conditioned by no output that suggests trying another index and a way to find out what they are. |
@hyangah |
To echo the other discussions here, I think inuse_space is more useful for long-running servers than alloc_space, so if the default metric is going to change for anything other than the local "go tool" runs, please let users know in advance. I'd opt against that since alloc_space is currently cumulative since program start which makes it difficult to aggregate across different replicas of a server or over time unless some custom normalization is applied. |
…336) In the interactive mode, inform users of different sample types if the profile includes zero samples for selected sample type by default (or through user-provided sample_index flag value). The example output may look like $ pprof mem.prof Type: inuse_space Time: Mar 20, 2018 at 11:36am (EDT) No samples were found with the default sample value type. Try "sample_index" command to analyze different sample values. Entering interactive mode (type "help" for commands, "o" for options) (pprof) Update golang/go#24443
Change https://golang.org/cl/101677 mentions this issue: |
Thanks @aalexand My PR to add a print statement in case of zero sample was merged to upstream. I will try to update the vendored version of pprof as well. The change 101677 is to additionally embed comments in the generated profile output - they explain what those different measurement types are. |
Change https://golang.org/cl/101736 mentions this issue: |
Merges updates listed in google/pprof@0e0e5b7...a74ae6f Update #24443 cmd/vendor/vendor.json was updated manually. Change-Id: I15d5fe82ac18263d4d54f5773cee0e197e93dd59 Reviewed-on: https://go-review.googlesource.com/101736 Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
One thing we could do is introduce a new named profile that means "heap allocations for all time" and make it the same as the regular heap profile but with a different default. Then -memprofile can write that new profile out instead of the old one. Go runtime/pprof.WriteMemProfile is equivalent to runtime/pprof.Lookup("heap").WriteTo, so we'd just have a new name "allocs" or something like that, which is almost exactly the same output, with a different default. Then you can ask for it from running servers too. |
/cc @hyangah see what you think of previous comment |
SGTM |
Change https://golang.org/cl/102696 mentions this issue: |
Title says it all. Here is evidence. Applies to other packages too.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version devel +baf3eb1625 Tue Mar 6 01:11:26 2018 +0000 darwin/amd64
Does this issue reproduce with the latest release?
Not tested.
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/r/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/r"
GORACE=""
GOROOT="/Users/r/go"
GOTMPDIR=""
GOTOOLDIR="/Users/r/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bf/qmf6xmzn7vs1gzv6g7mq_wfr0004fc/T/go-build412122499=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
See above.
The text was updated successfully, but these errors were encountered: