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

Fix controller memory usage #4589

Merged
merged 1 commit into from Mar 14, 2024
Merged

Fix controller memory usage #4589

merged 1 commit into from Mar 14, 2024

Conversation

zzjin
Copy link
Collaborator

@zzjin zzjin commented Mar 13, 2024

Decrease 50x footprint by using filtered cache. fixes #4588.

When deploy controller to clusters witch have large amount of resources like deployments/pods/secrects/ingresses, some controller is consume more memory than needed.

Before After
img_v3_028t_74b35935-f2fb-4b7d-a6ab-c08e7d984fdg image

Key problem:

When controller manager start, it will watch and cache all needed resource it owns for performance reason.
When cluster have thousand of resources, the cache memory increases whenever custom resource's count.

Solution:

With terminal/adminer controller usage, controller manager only want to watch resources we created and/or managed for update/delete etc events.
So add labels to controller managed resources and then create cache filtered only for those labeled resources, can reduce cache memory usage to match real custom resource's count, and also reduce api-server call response to save internal network bandwidth.

Copy link

Whoa! Easy there, Partner!

This PR is too big. Please break it up into smaller PRs.

@sealos-ci-robot
Copy link
Member

sealos-ci-robot commented Mar 13, 2024

🤖 Generated by lychee action

Summary

Status Count
🔍 Total 1198
✅ Successful 371
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 826
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

@zzjin zzjin force-pushed the dev_adminer branch 2 times, most recently from 80e7090 to d60e80c Compare March 13, 2024 16:18
@zzjin zzjin added this to the v5.0 milestone Mar 13, 2024
Copy link

codecov bot commented Mar 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.45%. Comparing base (cbbe279) to head (575c67e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4589   +/-   ##
=======================================
  Coverage   65.45%   65.45%           
=======================================
  Files           8        8           
  Lines         660      660           
=======================================
  Hits          432      432           
  Misses        180      180           
  Partials       48       48           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

decrease 50x footprint by using filtered cache.

Signed-off-by: zzjin <tczzjin@gmail.com>
@zzjin zzjin merged commit 1c960df into labring:main Mar 14, 2024
38 checks passed
bxy4543 pushed a commit to bxy4543/sealos that referenced this pull request Mar 14, 2024
decrease 50x footprint by using filtered cache.

Signed-off-by: zzjin <tczzjin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Terminal/Adminer controller consume much more memory when deployed on large scale clusters.
3 participants