Skip to content

Performance tuning on Projects::GitHttpController#info_refs

Mark Chao requested to merge 48239-performance-info-ref into master

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?

#48239 (closed)

Does this MR meet the acceptance criteria?

Closes #48239 (closed)

Edited by Mark Chao

Merge request reports