-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime/metrics: add /gc/heap/live:bytes #56857
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
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. 🎉 |
Change https://go.dev/cl/497315 mentions this issue: |
Change https://go.dev/cl/497317 mentions this issue: |
Change https://go.dev/cl/497316 mentions this issue: |
Change https://go.dev/cl/497320 mentions this issue: |
Change https://go.dev/cl/497319 mentions this issue: |
Change https://go.dev/cl/497575 mentions this issue: |
Change https://go.dev/cl/497576 mentions this issue: |
For #56857 Change-Id: I0622af974783ab435e91b9fb3c1ba43f256ee4ac Reviewed-on: https://go-review.googlesource.com/c/go/+/497315 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Michael Knyszek <[email protected]> Reviewed-by: David Chase <[email protected]> Run-TryBot: Felix Geisendörfer <[email protected]> Auto-Submit: Michael Knyszek <[email protected]> Reviewed-by: Michael Knyszek <[email protected]>
For #56857 Change-Id: I184d752cc615874ada3d0dbc6ed1bf72c8debd0f Reviewed-on: https://go-review.googlesource.com/c/go/+/497316 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Felix Geisendörfer <[email protected]> Auto-Submit: Michael Knyszek <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Reviewed-by: David Chase <[email protected]>
For #56857 Change-Id: I7e7d2ea3e6ab59291a4cd867c680605ad75bd21f Reviewed-on: https://go-review.googlesource.com/c/go/+/497317 Reviewed-by: Michael Knyszek <[email protected]> Auto-Submit: Michael Knyszek <[email protected]> Run-TryBot: Felix Geisendörfer <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: David Chase <[email protected]>
For #56857 Change-Id: I58187d7c4112b35951014ab14f2969bed7f4c8e1 Reviewed-on: https://go-review.googlesource.com/c/go/+/497319 Run-TryBot: Felix Geisendörfer <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Auto-Submit: Michael Knyszek <[email protected]> Reviewed-by: David Chase <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
For #56857 Change-Id: I748fd2a33ee76d9a83ea42f2ebf6d9edda243301 Reviewed-on: https://go-review.googlesource.com/c/go/+/497320 Run-TryBot: Felix Geisendörfer <[email protected]> Reviewed-by: David Chase <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Auto-Submit: Michael Knyszek <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
For #56857 Change-Id: If3b962f575c33b2cc29f89e33c7aafb476d98ce9 Reviewed-on: https://go-review.googlesource.com/c/go/+/497575 Auto-Submit: Michael Knyszek <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: David Chase <[email protected]> Run-TryBot: Felix Geisendörfer <[email protected]> Reviewed-by: Michael Knyszek <[email protected]>
For #56857 Change-Id: I10dbc5db506c95b7578c2b6baf051a351f68bb2a Reviewed-on: https://go-review.googlesource.com/c/go/+/497576 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: David Chase <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> Run-TryBot: Felix Geisendörfer <[email protected]> Auto-Submit: Michael Knyszek <[email protected]>
All of the metrics discussed in this proposal have landed, see patches above. Closing this 🥳 Thanks @mknyszek et al. for reviews and discussion 🙇 |
Change https://go.dev/cl/497880 mentions this issue: |
Currently /gc/scan/total:bytes is computed as a separate sum. Compute it using the same inputs so it's always consistent with the sum of everything else in /gc/scan/*. For #56857. Change-Id: I43d9148a23b1d2eb948ae990193dca1da85df8a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/497880 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Michael Knyszek <[email protected]> Reviewed-by: Michael Pratt <[email protected]>
Change https://go.dev/cl/498075 mentions this issue: |
For #56857. Change-Id: I03bdba906d271d97ce29874c50d5aba55dc285b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/498075 Run-TryBot: Michael Knyszek <[email protected]> Auto-Submit: Michael Knyszek <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Michael Pratt <[email protected]>
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: