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

perf: Optimize cache by minimizing unnecessary data storage. #2300

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

mjshastha
Copy link
Contributor

@mjshastha mjshastha commented Oct 29, 2024

  • Updated cache.Options with a DefaultTransform function that removes managed fields and the "kubectl.kubernetes.io/last-applied-configuration" annotation from objects before storing them in the cache.
  • Stripping managed fields reduces cache memory overhead, which improves performance in large clusters. ref: https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/cache#TransformStripManagedFields
  • Removing the "last-applied-configuration" annotation prevents unnecessary cache bloat.

This enhancement minimizes cache size and resource usage, improving controller runtime performance and memory management.

…oves managed fields and the `"kubectl.kubernetes.io/last-applied-configuration"` annotation from objects before storing them in the cache.

- Stripping managed fields reduces cache memory overhead, which improves performance in large clusters.
- Removing the `"last-applied-configuration"` annotation prevents unnecessary cache bloat and reduces redundant reconciliation triggers caused by changes to this field, which does not require for operation.

This enhancement minimizes cache size and resource usage, improving controller runtime performance and memory management.
@mjshastha mjshastha force-pushed the crCacheOptimization branch from 74d8555 to 2db983c Compare November 6, 2024 13:25
@afdesk afdesk requested a review from simar7 November 19, 2024 05:48
Copy link
Contributor

@afdesk afdesk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…into crCacheOptimization

# Conflicts:
#	pkg/operator/operator.go
@simar7 simar7 merged commit 1880d76 into aquasecurity:main Nov 20, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants