-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: Cache transform for Secrets and ConfigMaps to reduce memory #1866
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Siddhesh Ghadi <[email protected]>
Signed-off-by: Siddhesh Ghadi <[email protected]>
Signed-off-by: Siddhesh Ghadi <[email protected]>
Signed-off-by: Anand Kumar Singh <[email protected]>
Signed-off-by: Anand Kumar Singh <[email protected]>
Signed-off-by: Anand Kumar Singh <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add some tests for the wrapper?
cmd/main.go
Outdated
| if watchedNsCache := getDefaultWatchedNamespacesCacheOptions(); watchedNsCache != nil { | ||
| // Use transformers to strip data from Secrets and ConfigMaps | ||
| // that are not tracked by the operator to reduce memory usage. | ||
| if strings.ToLower(os.Getenv("MEMORY_OPTIMIZATION_ENABLED")) != "false" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets use DISABLE_MEMORY_OPTIMIZATION env var which users should explicitly set to true to disable optimization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Signed-off-by: Anand Kumar Singh <[email protected]>
Signed-off-by: Anand Kumar Singh <[email protected]>
What type of PR is this?
/kind enhancement
What does this PR do / why we need it:
This PR reduces memory usage in the Argo CD Operator by introducing a cache transform and client wrapper for Secrets and ConfigMaps.
See the attached proposal in this PR for design details, trade-offs, PoC results, and future scope.
Results
These metrics were collected from a test cluster containing 100 ConfigMaps and 100 Secrets, each approximately 1 MB in size. The cluster was running four Argo CD instances and no other workload operators.
With the optimization enabled, operator memory usage dropped from ~350 MB to ~100 MB.
UnOptimized Operator Manager Memory:
Optimized Operator Manager Memory:
However, we could not reduce the startup memory consumption, which remained at ~750 MB in both cases.
We previously attempted another approach in #1795, but it introduced significant complexity and restricted how watches could be set up. Compared to that, this solution provides a better balance between complexity, maintenance overhead, and outcome.