You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: replace runtime.ReadMemStats with runtime/metrics (#1724)
## Which problem is this PR solving?
[runtime.ReadMemStats](https://pkg.go.dev/runtime#ReadMemStats) requires
a `stopTheWorld` call when retrieving memory usage stats. Since Go 1.16,
the new
[runtime/metrics](https://pkg.go.dev/runtime/metrics#pkg-overview)
doesn't require a `stopTheWorld` call.
The reason why I would like to avoid the `stopTheWorld` call here is
because we are calling `ReadMemStats` every 100ms now. In Refinery 3.0,
the `ReadMemStats` is only called when peer queue is empty. That's way
less frequent and less disruptive. I'm hoping this PR will allow us to
maintain accurate memory usage reporting while having less interruption
to the main work of Refinery.
## Short description of the changes
- use `runtime/metrics` to read `"/memory/classes/heap/objects:bytes"`
stats in `checkAlloc`
If this new package proves to work well, we can also use it report an
estimated CPU usage. I will leave that work in a future PR
0 commit comments