Skip to content

Proactively enable commitGraph feature for Git repos

We've seen in https://gitlab.com/gitlab-org/gitlab-ce/issues/63432#note_182763288 that enabling the commitGraph feature of Git 2.21 in Projects::CommitController#branches can dramatically drop the RPC time of the ListTagNamesContainingCommit Gitaly RPC from 5 s to < 500 ms.

Right now the P99 shoots upwards to 50 s (https://dashboards.gitlab.net/d/PqeIQ9Iik/gitaly-feature-latency-detail?orgId=1&refresh=5m&var-job=gitaly&var-method=ListTagNamesContainingCommit&from=now-24h&to=now&fullscreen&panelId=1):

image

Running Housekeeping on the repo may cause GC to run and build a commit graph. This can be done via ::Projects::HousekeepingService.new(proj, :gc).execute until https://gitlab.com/gitlab-org/gitlab-ce/issues/63349 is resolved.

It would be expensive to build the commit graph for every repo on GitLab.com. However, we really care about optimizing the worst offenders. We could track the most frequently consumers of ListTagNamesContainingCommit and enable the commit graph on them now. For example:

  1. Record the number of times a repo initiates ListTagNamesContainingCommit
  2. Check if the commitGraph is enabled. If it is, we're done.
  3. If it is not, and the count reaches a certain threshold (e.g. 100), initiate a commitGraph build.
Edited by 🤖 GitLab Bot 🤖
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information