Skip to content

Add a new metrics to expose local cached items size #3182

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

Open
halfcrazy opened this issue Mar 28, 2025 · 8 comments
Open

Add a new metrics to expose local cached items size #3182

halfcrazy opened this issue Mar 28, 2025 · 8 comments

Comments

@halfcrazy
Copy link
Contributor

halfcrazy commented Mar 28, 2025

Backgroud
In controller-runtime, the default behaviour is to cache all data using client.Get unless using a read-only client or custom cache policies, e.g., ClientDisableCacheFor, NewCache. Therefore, using client.Get on a specific pod in a large cluster with many pods may lead to high memory usage.

Proposal
Add a new metric to expose the local cached items' size. Then we can analyze the high memory usage caused by the misuse cache policy.

@halfcrazy
Copy link
Contributor Author

#3054

@krisztianfekete
Copy link
Contributor

@halfcrazy, looks like this will be done by #3202

@halfcrazy
Copy link
Contributor Author

@halfcrazy, looks like this will be done by #3202

I'm afraid #3202 cannot resolve this issue. AFAIK, until kubernetes/kubernetes#129160 is merged. We need to register the informer metric too.

@xigang
Copy link

xigang commented May 9, 2025

/cc @sbueringer

@sbueringer
Copy link
Member

sbueringer commented May 9, 2025

Yeah, we're going to wait for this to be implemented in k/k. Then we can probably pick it up (if it's safe from a metric cardinality point of view)

@xigang
Copy link

xigang commented May 9, 2025

Thanks @sbueringer ! Could you help review this PR kubernetes/kubernetes#129160? It would be great to keep things moving forward.

@sbueringer
Copy link
Member

Huge backlog unfortunately at the moment. I'll try to get to it, but I can't promise it.

@xigang
Copy link

xigang commented May 9, 2025

@sbueringer Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants