Skip to content

gitserver: add experimental feature to read gitserver addr from db

Administrator requested to merge as/experiment-addr-from-db into main

Created by: asdine

This is an experiment to measure the impact of reading the gitserver address from the database in AddrFromRepo.

Context

AddrFromRepo is used to determine on which gitserver instance a repo is hosted. Currently, we are using a hashing algorithm to get this information. RFC 648 suggests to use the database instead and read that information from the gitserver_repos table. The goal of this PR is only to measure the impact of such solution, in a controlled fashion.

Approach

On Cloud only, we are adding a feature flag that once enabled will make AddrFromRepo read from the database. Another configuration variable allows us to control the percentage of calls that will read from the database. That percentage starts at 0 and will be increased progressively.

Every time we increase that rate, we will monitor the impact on the Postgres resources (nb of transactions, CPU, RAM etc.) We will stop the moment the load becomes too high.

This feature flag and this feature will be removed completely once the experiment is over.

Test plan

Added a few unit tests and tested against the local cluster

Merge request reports

Loading