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

Reduce operator memory consumption (OOMKilled) #56

Closed
jotak opened this issue Jul 18, 2024 · 1 comment · Fixed by #62
Closed

Reduce operator memory consumption (OOMKilled) #56

jotak opened this issue Jul 18, 2024 · 1 comment · Fixed by #62
Assignees

Comments

@jotak
Copy link

jotak commented Jul 18, 2024

The bpfman operator seems to be "vulnerable" to OOMKills due to watching configmaps cluster-wide.
Steps to reproduce:

  • install bpfman (just the operator is needed)
  • run the following:
kubectl create namespace test
for i in {0..400}; do kubectl create cm test-cm-$i -n test --from-file=(put large file here) ; done

I used a file of ~ 500KB

Monitor pod metrics: ingress bandwidth and memory

image

We see that the created configmaps impact the operator memory, despite them being apparently unrelated to the operator, and deployed in a separate namespace. Then the pods gets OOM-killed.

I think this is due to missing configuration in the manager cache, that leads to watching cluster-wide configmaps (with informers used under the cover without restriction of scope).

This page touch-bases on the problem: https://master.sdk.operatorframework.io/docs/best-practices/designing-lean-operators/
Here, the config controller sets up a watch on configmaps. Note that the Predicate function provided does not reduce the informers scope (it only reduce the generated reconcile requests), so despite of this predicate, all cluster configmaps are still set in cache under the hood.

My guess is that it should be OK to add this config options to the manager:

  Cache: cache.Options{
    ByObject: map[client.Object]cache.ByObject{
      &corev1.ConfigMap{}: cache.ByObject{
	Fields: labels.SelectorFromSet(fields.Set{"metadata.name": internal.BpfmanConfigName}),
      },
    },
  },

(I haven't tested)

@anfredette
Copy link
Contributor

Thanks for doing this testing and creating the issue @jotak!

@msherif1234 msherif1234 self-assigned this Jul 23, 2024
@mergify mergify bot closed this as completed in #62 Jul 24, 2024
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in bpfman Jul 24, 2024
msherif1234 pushed a commit to msherif1234/bpfman-operator that referenced this issue Oct 30, 2024
…/ocp-bpfman-operator-bundle

chore(deps): update ocp-bpfman-operator-bundle to 8ea396e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants