Performance tuning on Projects::GitHttpController#info_refs
What does this MR do?
The MR tries to improve performance of the following issues:
DeployToken#project being slow
From grafana (click on DeployToken#project
in the link) that project
method is slow, varying between 10ms ~60ms.
Preliminary exam shows that the index to lookup a deploy token's project is absent. So this MR adds the index. However later I discovered that the link table (project_deploy_tokens
) is quite small in size. Therefore this would not improve the performance too much, but is still valuable in case the table becomes bigger in the future.
It is also discovered that the project
method is being called twice each time we do Gitlab::Auth
. By memoizing this we save once query for auth check.
Redundant update query per project update
For each project creation, two callbacks for updating some timestamps are triggered. Those two queries are similar in nature (updating the column to current time), so it makes sense to combine them into one query.
What are the relevant issue numbers?
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
Tests added for this feature/bug -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides
Closes #48239 (closed)