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/metrics: add /gc/heap/live:bytes #56857
Comments
cc @mknyszek |
A similar proposal was rejected previously (#51966). Part of the problem was inclusion in However, I do think your argument that it's useful for identifying issues with a memory limit is "new information" (now that the memory limit has landed) as far as the proposal processes goes. I think that might be enough to push this over the edge into more serious consideration for me personally. I think to start with I'd be inclined at this point to call this If we do this, we should probably also export scannable stack bytes and scannable globals bytes, at least as far as they go into the GOGC calculation. We should also really export GOGC and the memory limit as well, since they can change during application execution. I don't really see enough utility from exporting the count of live objects though. I think a memory profile is better for that sort of thing anyway. (Also, we don't currently track that (mod memory profiling) and it's more work.) |
Yeah, there's a simpler way for bytes. :) You want |
Sounds great. I'll update my patch based on your suggestions.
Yeah, that makes sense. Seems like this is missing the code freeze anyway. |
I updated the CL to use
I can prepare CLs for those as well. Should I submit them separately? |
It's an accounting artifact currently required for good performance. It would be nice to fix, but I'm not yet sure how without either (1) impacting the allocation fast path or (2) slowing down For users that really need this consistency (like the
Either or. Your current CL is not very big. |
This proposal has been added to the active column of the proposals project |
Based on the discussion above, this proposal seems like a likely accept. |
No change in consensus, so accepted. |
@felixge were you planning to implement this? |
Yes, I'll try to submit a good patch for
If time allows I could also try to look into these, but I'm not sure if they'd be covered by the accepted proposal or would need separate proposals? |
That's a good question. I personally feel we should just include those in the proposal. |
There appears to be no way to monitor what is called the
Live Heap
in the GC Guide.The closest runtime/metric seems to be
/memory/classes/heap/objects:bytes
which isLive Heap
+New Heap
(i.e. includes potentially dead but unswept allocations).Monitoring
Live Heap
seems to be useful when running withGOGC=off
and aGOMEMLIMIT
to understand if the live heap of a program is approaching theGOMEMLIMIT
which could lead to high CPU usage or OOM kills.Therefor I'm proposing to add
/memory/classes/heap/live_objects:bytes
and/gc/heap/live_objects:objects
to the runtime/metrics package. They should return similar values as what is currently returned by theInUse*
values of theruntime.MemProfile()
profile. It's probably worth to discuss whether the termInUse
is preferable overLive
.I created a very hacky prototype of this here, but there is probably a much better way to do this.
The text was updated successfully, but these errors were encountered: