-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
chore: Use more optimal iterate hierarchy v2 (#18929) #18972
chore: Use more optimal iterate hierarchy v2 (#18929) #18972
Conversation
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
76421de
to
00e4428
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18972 +/- ##
==========================================
- Coverage 50.66% 50.65% -0.01%
==========================================
Files 315 315
Lines 43347 43359 +12
==========================================
+ Hits 21961 21964 +3
- Misses 18880 18887 +7
- Partials 2506 2508 +2 ☔ View full report in Codecov by Sentry. |
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.
For performance improvements, can you provide the pprof CPU graph or something similar of before and after the changes to compare the CPU time used by IterateHierarchy
compared to IterateHierarchyV2
as well as the memory tradeoff.
I will look a bit more in depth at https://github.dev/argoproj/gitops-engine/pull/601 when I have more time.
I was looking at timing information from the new logs "Finished setting resource tree" for the same app. In our staging env, it was consistently taking 3-4 min on processing managed resources for one of the apps when calling IterateHierarchy and <1 sec when using IterateHierarchyV2 (issue #18929 has some screenshots). The same app was taking 30-60 min to refresh in production environment with more namespace resources, now it take ~1 min (mostly compare app state). |
Here are some perf views of the system collected following #13534 (comment). The build is from master on 2024/07/07 including #18972, #18694, argoproj/gitops-engine#601, argoproj/gitops-engine#603. |
Some local testing indicates that the memory cost could be substantial (like 10x the current cost). Do you have any live-environment before/after stats? Here's the result of a benchmark I just cooked up. It's pretty contrived, but a big enough cost to be concerning.
|
Nice, I wonder if it's because we simply spend less time in that code, so there are fewer concurrent iterations using up memory. I'll try to get some data from Intuit as well. |
Note that I tested with a locking improvement included as well, though that would have more impact on doing more updates and keeping apps fresher essentially. |
Ah sure. No worries, I'll try to isolate the iterate change when I test internally. Not sure whether I'll get to the lock improvements this week. |
Hey, I was facing a performance issue with the resource tree. Thanks to Michael, we ran a pprof against the application controller and discovered a bottleneck in the iterateChildren function. He recommended trying out this new implementation. After integrating your branch, the issue has been resolved 🎉. In terms of resource consumption, memory usage remains about the same, but CPU usage has nearly doubled. |
@gazidizdaroglu, I've noticed cpu drop in staging environment, but increase in a prod environment. Since this PR integrates locking changes in gitops-changes as well, I've observed just more updates being done in prod and things being much fresher - longest running processor has dropped from 30-60min to 1-2min. I wonder if you experience the same thing. If yes, I think cpu increase is worth it given much less staleness. Let me know if you integrated only iterate hierarchy changes and specifically avoided lock changes. |
Also, with @crenshaw-dev optimizations to iterate hierarchy v2 on top of my changes we may get even better performance. |
I've added a benchmark to argoproj/gitops-engine#603 with some goroutines doing processing of updates. Seems like a new locking doesn't benefit us and even has some regression when using less updates or having cheaper updates. I wonder if the wins I saw were from having locking acquired for less time while iterating hierarchy more efficiently.
|
Closes argoproj#18929 Helps with argoproj#18500 Use iterate hierarchy v2 to have a roughly linear performance for getting the resource tree instead of up to quadratic. Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
00e4428
to
2d1db69
Compare
I've updated this PR to use gitops-engine master and skip the locking change. I'll try it out, probably with #18694. |
@crenshaw-dev, I've updated the PR to only reference our gitops-engine changes in master and to use iterate hierarchy v2. Since the changes were already tested, should be a short review, when you have a bit of time. The license check failure is plaguing many PRs and is probably unrelated. |
…oj#18972) Closes argoproj#18929 Helps with argoproj#18500 Use iterate hierarchy v2 to have a roughly linear performance for getting the resource tree instead of up to quadratic. Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
…oj#18972) Closes argoproj#18929 Helps with argoproj#18500 Use iterate hierarchy v2 to have a roughly linear performance for getting the resource tree instead of up to quadratic. Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com> Signed-off-by: Vegard Færgestad <vegardf@mnemonic.no>
…oj#18972) Closes argoproj#18929 Helps with argoproj#18500 Use iterate hierarchy v2 to have a roughly linear performance for getting the resource tree instead of up to quadratic. Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
…oj#18972) Closes argoproj#18929 Helps with argoproj#18500 Use iterate hierarchy v2 to have a roughly linear performance for getting the resource tree instead of up to quadratic. Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
Closes #18929
Helps with #18500
Use iterate hierarchy v2 to have a roughly linear performance for getting the resource tree instead of up to quadratic.
Checklist: