-
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
fix(repo-server): excess git requests, resolveReferencedSources and runManifestGenAsync not using cache (Issue #14725) #16410
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #16410 +/- ##
==========================================
+ Coverage 49.53% 49.56% +0.02%
==========================================
Files 269 269
Lines 47222 47223 +1
==========================================
+ Hits 23392 23405 +13
+ Misses 21530 21517 -13
- Partials 2300 2301 +1 ☔ View full report in Codecov by Sentry. |
Nice, looks like this massively mitigates the issue with a relatively lightweight change. Very safe and easy to cherry-pick back. Thanks for splitting up the PRs! |
…s and runManifestGenAsync Signed-off-by: nromriell <nateromriell@gmail.com>
d47a64c
to
c118ff4
Compare
Of course! Definitely was a great idea to split them, much easier to follow the changes |
Signed-off-by: nromriell <nateromriell@gmail.com>
1e6588c
to
131ce0c
Compare
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.
Thanks @nromriell for breaking the huge PR into smaller chunks. The change is really effective.
The code looks good to me overall.
Of course, thanks for taking the time to review! |
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.
Tks a lot for breaking the original PR.
Please check my comment.
@@ -300,6 +300,7 @@ func (s *Service) runRepoOperation( | |||
var gitClient git.Client | |||
var helmClient helm.Client | |||
var err error | |||
gitClientOpts := git.WithCache(s.cache, !settings.noRevisionCache && !settings.noCache) |
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.
It seems that the repository.Service.cache
is just Redis based and doesn't leverage the twolevel
cache client. Can you please confirm my understanding of this part of the code? If so, it means that we are moving the chatty communication from Git to Redis which can bring new problems.
I don't want to push for a premature optimization as long as we are aware of this possible behaviour and have a plan B if we want to go with this implementation which I am not opposed to.
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.
That's right, overall redis requests are down after the change due to not having to try and get and set the values for each application each time.
I do however have the optimization for moving this to a two level cache as part of the original PR and in the final part of the PR split nromriell#3
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.
LGTM
Awesome job @nromriell !
/cherry-pick release-2.9 |
…unManifestGenAsync not using cache (Issue #14725) (#16410) * fix(repo-server): excess git requests part 1, resolveReferencedSources and runManifestGenAsync Signed-off-by: nromriell <nateromriell@gmail.com> * fix: remove unnecessary settings instantiation Signed-off-by: nromriell <nateromriell@gmail.com> --------- Signed-off-by: nromriell <nateromriell@gmail.com>
…unManifestGenAsync not using cache (Issue #14725) (#16410) (#16494) * fix(repo-server): excess git requests part 1, resolveReferencedSources and runManifestGenAsync * fix: remove unnecessary settings instantiation --------- Signed-off-by: nromriell <nateromriell@gmail.com> Co-authored-by: Nathan Romriell <nateromriell@gmail.com>
…unManifestGenAsync not using cache (Issue argoproj#14725) (argoproj#16410) * fix(repo-server): excess git requests part 1, resolveReferencedSources and runManifestGenAsync Signed-off-by: nromriell <nateromriell@gmail.com> * fix: remove unnecessary settings instantiation Signed-off-by: nromriell <nateromriell@gmail.com> --------- Signed-off-by: nromriell <nateromriell@gmail.com> Signed-off-by: irinam0992 <irinam0992@gmail.com>
Thanks @crenshaw-dev @ishitasequeira @leoluz for taking the time to review! |
…unManifestGenAsync not using cache (Issue argoproj#14725) (argoproj#16410) * fix(repo-server): excess git requests part 1, resolveReferencedSources and runManifestGenAsync Signed-off-by: nromriell <nateromriell@gmail.com> * fix: remove unnecessary settings instantiation Signed-off-by: nromriell <nateromriell@gmail.com> --------- Signed-off-by: nromriell <nateromriell@gmail.com>
…unManifestGenAsync not using cache (Issue argoproj#14725) (argoproj#16410) * fix(repo-server): excess git requests part 1, resolveReferencedSources and runManifestGenAsync Signed-off-by: nromriell <nateromriell@gmail.com> * fix: remove unnecessary settings instantiation Signed-off-by: nromriell <nateromriell@gmail.com> --------- Signed-off-by: nromriell <nateromriell@gmail.com>
…unManifestGenAsync not using cache (Issue argoproj#14725) (argoproj#16410) * fix(repo-server): excess git requests part 1, resolveReferencedSources and runManifestGenAsync Signed-off-by: nromriell <nateromriell@gmail.com> * fix: remove unnecessary settings instantiation Signed-off-by: nromriell <nateromriell@gmail.com> --------- Signed-off-by: nromriell <nateromriell@gmail.com>
…unManifestGenAsync not using cache (Issue argoproj#14725) (argoproj#16410) * fix(repo-server): excess git requests part 1, resolveReferencedSources and runManifestGenAsync Signed-off-by: nromriell <nateromriell@gmail.com> * fix: remove unnecessary settings instantiation Signed-off-by: nromriell <nateromriell@gmail.com> --------- Signed-off-by: nromriell <nateromriell@gmail.com> Signed-off-by: Kevin Lyda <kevin@lyda.ie>
…unManifestGenAsync not using cache (Issue argoproj#14725) (argoproj#16410) * fix(repo-server): excess git requests part 1, resolveReferencedSources and runManifestGenAsync Signed-off-by: nromriell <nateromriell@gmail.com> * fix: remove unnecessary settings instantiation Signed-off-by: nromriell <nateromriell@gmail.com> --------- Signed-off-by: nromriell <nateromriell@gmail.com>
Partially Fixes #14725
First part of a split of the initial PR. Starts the fixes required to remove the excess git requests when using multi-source and ref sources.
Issue:
When
resolveReferencedSources
andrunManifestGenAsync
callnewClientResolveRevision
they currently do not pass the git options to use the cache when enabled, because of this whennewClientResolveRevision
creates a new git client and callsLsRemote
the cache is always skippedChanges:
Updated the ls-remote calls from resolveReferencedSources and runManifestGenAsync to have access to the cache
Impact:
On its own this does not fix the issue. This will reduce the number of ls-remote currently being made by preventing multiple calls inside the same goroutine or slightly time offset calls from missing cache, however due to the fact that a large number of calls are made by nearly simultaneous processes when the cache expires this is only a partial fix.
This also does not fix the large number of fetch calls being made to ref-only repos.
These two remaining items will be addressed in follow PRs
Baseline v2.9.0 with 200 multi-source applications with a ref only source:

With the changes in this PR under the same conditions:

Checklist: