Skip to content

proposal: runtime garbage profile #16629

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

Closed
benburkert opened this issue Aug 7, 2016 · 5 comments
Closed

proposal: runtime garbage profile #16629

benburkert opened this issue Aug 7, 2016 · 5 comments

Comments

@benburkert
Copy link
Contributor

For latency sensitive applications, excess garbage1 can have a major impact on tail latencies. The alloc reporting feature of benchmarks is a excellent tool for identifying garbage, but cannot be used during runtime on live applications. And heap profiling can show live objects and allocs but it is often difficult to discern garbage from regular heap allocated objects. A profile that records short lived objects and their allocation sites over a given duration could be a useful tool for identifying sources of garbage.

The memory statistics provided by the runtime package do not provide exact numbers for garbage allocations, but likely provide enough information for accurate estimation. One way to estimate garbage is by comparing memory statistics before and after each GC pass. Taking the minimum value between a) alloced objects/bytes before GC and b) freed objects/bytes after GC gives an estimate of garbage per GC. Repeating this over a long enough duration may produce a statistically accurate estimate of garbage.

Please see the github.com/benburkert/pprof-garbage package proof of concept and demo.

1: garbage being defined as extremely short lived objects/bytes: marked as live for less than one period between GC passes.

@quentinmit quentinmit added this to the Proposal milestone Aug 8, 2016
@quentinmit
Copy link
Contributor

/cc @aclements who was thinking about something very similar (putting dead objects in the normal heap profile)

@adg
Copy link
Contributor

adg commented Sep 26, 2016

@aclements ping!

@aclements
Copy link
Member

And heap profiling can show live objects and allocs but it is often difficult to discern garbage from regular heap allocated objects.

In the default "-inuse_space" mode, it shows only reachable objects, so there isn't any garbage to discern.

A profile that records short lived objects and their allocation sites over a given duration could be a useful tool for identifying sources of garbage.

Have you tried taking two heap profiles and using go tool pprof -alloc_space -base <before> <after>?

If this doesn't solve the problem, could you take a look at my proposal at #13463 (comment)? The aim of that proposal is to more clearly surface sources of short-lived garbage.

@adg
Copy link
Contributor

adg commented Oct 31, 2016

Any news here? Leaning toward declining, based on lack of interest.

@rsc
Copy link
Contributor

rsc commented Nov 7, 2016

It sounds like the right place for further discussion is #13463, which is already about more detail in memory profiles.

@rsc rsc closed this as completed Nov 7, 2016
@golang golang locked and limited conversation to collaborators Nov 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants