Further reduce the number of Gitaly calls per Rails request
During the Gitaly migration project we were focused on bringing down the number of Gitaly calls per Rails request because we were introducing a lot of RPC overhead with Gitaly and we had to reach parity with the existing performance of gitlab.com. This effort faded away after we tore down NFS on gitlab.com, but we now have reasons to push it further.
I propose the following process:
- Reduce the gitaly call threshold in Gitlab::GitalyClient
- Push this as a branch to gitlab.com and let CI run on your MR.
- This will cause tests to fail in CI. If it doesn't, lower the threshold further.
- For each failure try to pin down where it goes wrong by running the failing test locally and analyzing / debugging the code. Once you find a problem area, put an allow_n_plus_1_calls block around it.
- Create an issue for each block, and cross-reference the issues with code comments. I.e. each block should have a TODO code comment pointing to the issue to get rid of it.
- One by one deal with the N+1 issues you found.
- GOTO step 1.