Skip to content

Limit number of branches/tags loaded from Gitaly

Vasilii Iakliushin requested to merge limit_refs_for_project_controller into master

What does this MR do and why?

Problem

We load all tags and branches from Gitaly and then apply the 100 elements limit. This approach has a poor performance.

Kibana: https://log.gprd.gitlab.net/goto/4a3ddb40-2778-11ed-8656-f5f2137823ba

Solution

Gitaly API supports pagination, instead of loading all tags/branches we can load only necessary 100 elements. This will prevent connection timeouts from Gitaly.

Screenshots or screen recordings

Before After
Screenshot_2022-08-29_at_10.52.25 Screenshot_2022-08-29_at_10.50.50

How to set up and validate locally

  1. Enable feature flag
Feature.enable(:use_gitaly_pagination_for_refs)
  1. Visit http://127.0.0.1:3000/gitlab-org/gitlab-test/refs
  2. You should see same branches and tags as without feature flag

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports

Loading