Automatically generate bundles for bundle-uri
group::gitalygit has recently added bundle uri functionality to Gitaly. This feature allows git servers to advertise a http url to the git client for the git client to download a pre-baked bundle of the repository. This can be thought of as a repository cache. The main benefit is to the server. Instead of having to spin up git-pack-objects processes to pack up all the objects in a repository, this gets offloaded to an already generated bundle.
Currently, a cron job needs to be run to generate bundles for repositories. However, we'd like to make this configuration-less. Ideally, the feature could work this way:
- In Project->Settings->Repository, an admin checks a checkbox labeled "Use Repository Bundle Caching" or something like that
- On a
git cloneorgit fetch, Rails can kick off a sidekiq job that will check if a bundle exists for a repository, and how old it is. If there is no bundle or if it's a very old bundle, then Rails can call Gitaly'sGenerateBundleURIfor that repository to generate a new bundle. - We can even add a sidekiq job to remove bundles for projects that have not been cloned/fetched from in a long time.
This issue is for discussing the design.
Updated 2024-06-03
Based on the discussions, we've decided to make bundle uris a transparent optimization to the GitLab rails application. This means that Gitaly will own the business logic for when and for which repositories to create a bundle URI.
- Gitaly's
config.tomlwill gain a config value for turning bundle uris on or off - Gitaly will decide based on heuristics whether or not to create a new bundle for a repository
Future will be tracked in gitaly#5803 (closed).