-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
High CPU usage in repo server for plugin detection with >8.000 apps #15763
Comments
Do you actually use any CMPs, or is all that truly completely wasted CPU? |
@crenshaw-dev I use a CMP, but not in that repository. |
Gotcha. We could cache the discovery result on a per-commit basis, but my guess is that you're hitting the high CPU use with new commits. An alternative would be to explicitly set |
No actually, it's the same commit, but I have a mono repo, so it does the resolving 8.000 times for each root folder of the apps. Great, I'll check the directory part |
@woehrl01 this might also help mitigate the issue if your monorepo is large due to non-yaml resources: https://argo-cd.readthedocs.io/en/latest/operator-manual/config-management-plugins/#plugin-tar-stream-exclusions |
Could you please elaborate on this solution? |
Thanks @crenshaw-dev the repo only consists of yaml files, but I still use it to exclude the .git folder. I also experience that I have to lower the parallel repo actions from 50 to 5 otherwise I'll end up in a strange deadlock situation. Could be because of the plugin detect, too. |
@JuozasVainauskas Argo CD only does plugin "discovery" if you haven't explicitly specified in your App manifest that you want something besides a plugin. For example: kind: Application
spec:
source:
kustomize:
images: [a=b] For this app, Argo CD would skip plugin discovery because it automatically knows it'll be using Kustomize instead. |
Understood, thank you. Unfortunately, this will not help us since we use plugins by name instead of discovery. |
@crenshaw-dev I just deployed the fix with the directory across all our clusters. The CPU usage of the repo-server has not changed (but isn't an issue yet), I'll monitor and keep you updated. |
Comments from @crenshaw-dev - When you add a CMP, all apps now have to query that CMP to see if it can be handled. This is by design to keep potential issues out of repo server. However, it does create a performance penalty if you add a single CMP for a single app because all apps have to check against that CMP. Will review to see if we should architect differently. |
Related proposal: #15006 |
Another suggested stop-gap: Support a feature flag to disable discovery. @alexmt suggests keeping it disabled by default. |
Update: we have successfully solved the performance issue by setting |
Potentially unrelated I had wondered if it might not be easier/better if we could configure the plugin-tar as inclusive per plugin rather than globally and an exclusion list. At least in large monorepos it's much easier to decide what I want to send to the CMP rather than trying to exclude. |
I can also confirm huge perf improvements by adding:
To our directory argocd apps (we only have maybe 30-50 of them). git_ms timing from our repo-server logs went from 40s to 20s |
Our problem seems quite similar to the ones from folks in the thread... we have a big mono repo and a high number of applications (+8k), and cloning the same repo for each app seems to be the cause of the performance problems. When using the plugin as an initContainer in previous versions of ArgoCD (2.4.18), the same plugin synchronizes all apps and resources in just a few seconds (~20s), in the other hand, when using it as a sidecar it takes around 20 minutes, lots of CPU, and often never fully completes... Question: Is it possible/recommended to still use plugins as InitContainer instead of changing to the new sidecar approach? had the impression the option was removed from v2.8+ versions but couldn't tell for sure from the docs so far... Also, is there any way to avoid the multiple cloning of the same repo that we might have missed from the docs? Thanks a ton in advance for any insights!!! |
We having the same performance issue since we moved to CMP plugin, specifically we using helmfile plugin integration |
It seems to work better for me after upgrading to 2.11 and applying the new Example:
|
ArgoCD versions 2.10 and below have reached EOL. Can you upgrade and let us know if the issue is still present, please? |
Checklist:
argocd version
.Describe the bug
Using 2.8.3 of argocd we can see high cpu usages in the repo server for detecting the plugins.
We are using a huge monorepo for our applications, without any templating (just plain yaml). But the detection of plugins take a significant amount of time.
Flame graph with pixie:
Another one on cleanup:
Slack discussion: https://cloud-native.slack.com/archives/C01TSERG0KZ/p1694514516286809?thread_ts=1694175483.721089&cid=C01TSERG0KZ
CC: @csantanapr
To Reproduce
Apply thousand of apps at the same time
Expected behavior
Apply them "fast"
Screenshots
Version
The text was updated successfully, but these errors were encountered: