Skip to content
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

Add ability to enable remote profiling using pprof #142

Merged
merged 2 commits into from
Oct 21, 2022

Conversation

radiohead
Copy link
Contributor

What

This PR adds a new flag, which, when enabled, allows for remote profiling using net/http/pprof package, with the handlers mounted to the metrics server.

By default the flag is disabled, to ensure that the change is backwards-compatible.

Why

This allows for ad-hoc and continuous (e.g. using https://pyroscope.io/) profiling, which is useful for finding memory / cpu bottlenecks.

@radiohead
Copy link
Contributor Author

Hey folks!

We're experimenting using kine with CockroachDB and I've run into OOMs with kine using up to 2GB of RAM in some situations. This seems to be related to #87, since kine officially does not support CockroachDB.

That said, I'm looking into ways to improve peak memory usage, but I've noticed that there's no way to do remote profiling, so I've made this small change to enable it.

I've already tested this internally with https://hub.docker.com/repository/docker/radioheads/kine, but I'm happy to provide more info if necessary.

pkg/metrics/server.go Outdated Show resolved Hide resolved
Copy link
Member

@brandond brandond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the contribution! One small question.

Signed-off-by: Igor Suleymanov <[email protected]>
@radiohead radiohead requested a review from brandond October 20, 2022 07:08
@brandond brandond merged commit 662198a into k3s-io:master Oct 21, 2022
@radiohead radiohead deleted the feat/pprof branch November 2, 2022 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants