Closed chaunceyjiang closed 1 month ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 51.76%. Comparing base (
57c1989
) to head (1186588
). Report is 20 commits behind head on master.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
We have tested on such environment: 2 member clusters, each cluster have 500 node, 10000 pod in all.
before this PR introduced: karmada-metrics-adapter cost 1.3GB memory at least (and may probabilistically rise), memory overhead is mainly due to the line _ = sci.Lister(provider.PodsGVR)
.
after this PR introduced: only cost about 300MB.
This is a significant performance optimization ! ٩(๑❛ᴗ❛๑)۶
Now, can you add more explaination in PR description to summarize how does this PR works to reduce the memory?
You only said you trimmed some of the information, may be you can explain more about why typedmanager
is better than genericmanager
, or other summary terms.
/LGTM
It's probably more of a feature. /kind feature /lgtm
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: RainbowMango
The full list of commands accepted by this bot can be found here.
The pull request process is described here
When there is a large amount of pod usage in the member cluster, metrics-adapter will consume a lot of memory. The reason is that it caches all the information of all pods in the cluster. However, we don't need all this information, so we trim some of the information to reduce memory usage.
What type of PR is this? /kind bug
What this PR does / why we need it:
Which issue(s) this PR fixes: Fixes #
Special notes for your reviewer:
The core idea of this PR is to use
TransformFunc
to trim the fields that pod and node need to buffer. Currently, it only retains fields such asname
,namespace
,labels
, etc. Other fields are not needed, so we do not need to cache them.Does this PR introduce a user-facing change?: