Re: Trouble running pprof on a Go app deployed in CF


Rohit Kumar
 

Is there any reason why you can't profile the binary on a linux machine
with the same architecture and go version as deployed on CF? I have
generally had problems with the Go profiler when it comes to profiling
things across OSes/architectures. There are also bugs with the Go profiler
on older OSX versions [1].

Rohit

[1] https://golang.org/pkg/runtime/pprof (see the "Bugs" section at the end
of the page)

On Tue, Jan 12, 2016 at 11:34 PM, Cem Ezberci <cem.ezberci(a)gmail.com> wrote:

I am trying to do profiling on a CF app remotely from a Mac machine. When
I issue the go tool pprof command without a local binary as a parameter,
the results seem to be correct, however issuing list on a function name
does not work and I see messages like "No source information for <insert
function name>". I thought the reason for this not providing the local
binary so the go tool could not resolve these lines. However, when I did
that, I didn't even get a breakdown of functions that make up the top
offenders. Instead, I just got the name of the binary back like below:

(pprof) top
285.72MB of 285.72MB total ( 100%)
flat flat% sum% cum cum%
285.72MB 100% 100% 285.72MB 100% [binary name]

I realized the reason for this was that I had the binary executable built
for Mac and the one on the server was built for linux. So I built it with
the following on my local machine:

GOOS=linux GOARCH=amd64 godep go build

I got lucky with this approach and I was able to issue list command on a
given function. However, I quickly realized that functions listed on top
when I provide the binary in command line and one where I do not were
different (although the allocation percentages and amounts were the same).
And when I issue list command for the function listed at the top and look
at the line number where it says where the most of the allocations take
place, I see a line that does logging, which does not make any sense. So
the only conclusion I have at this point is that for some reason the binary
built on CF and the one built on my local (same dependencies -- since I
built with "godep go build"-- and same architecture and os) do not match
and the symbols (?) are off.

Has anyone ever tried to do what I am trying to do; i.e. profiling a Go
app deployed on CF remotely from a Mac? Any ideas/thoughts on what might be
the problem here?

Thanks,
-Cem

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.