Use memoization for commits on diffs
What does this MR do?
Uses memoization, from the commit message:
The Gitaly CommitService is being hammered by n + 1 calls, mostly when
finding commits. This leads to this gRPC being turned of on production:
gitaly#514 (comment 48991378)
Hunting down where it came from, most of them were due to
MergeRequest#show. To prove this, I set a script to request the
MergeRequest#show page 50 times. The GDK was being scraped by
Prometheus, where we have metrics on controller#action and their Gitaly
calls performed. On both occations I've restarted the full GDK so all
caches had to be rebuild.
Current master, 806a68a8, needed 435 requests
After this commit, 154 requests
Are there points in the code the reviewer needs to double check?
Could this lead to invalid values? I doubt it, given the model seems inmutable after creation
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary - [-] Documentation created/updated
- [-] API support added
- [-] Tests added for this feature/bug
- Review
- [-] Has been reviewed by UX
- [-] Has been reviewed by Frontend
-
Has been reviewed by Backend - [-] Has been reviewed by Database
- [-] Conform by the merge request performance guides
- [-] Conform by the style guides
- [-] Squashed related commits together
- [-] Internationalization required/considered
What are the relevant issue numbers?
Edited by Zeger-Jan van de Weg