[go: up one dir, main page]

Skip to content

Projects::TreeController#show Gitaly migration

~Conversation: #220 (closed)

Investigate moving git functionality in the Projects::TreeController#show endpoint to Gitaly.

Information

TODO

  • Investigate required changes in gitlab-rails

    • According to graphana's WALL time chart, instantiating the repository is the slowest Rugged operation in this action. This is done for all project actions in a before_action :repository on app/controllers/projects/application_controller.rb. This means that even for non-repository related project actions, such as Edit Project, the git repository is loaded into memory. There seems to be an actual reason for this: just to render the Graphs tab in the UI menu there's a call to @repository.try(:root_ref). Migrate root_ref to Gitaly and remove the instantiation of a Rugged repository as a before_action on Project controllers. This should have a positive performance effect on many project actions across the board. We will have to check change @repository access in these controllers that are expecting the variable to be instantiated to use the attr_accessor repository.
    • With the previous point as a precondition, remove the initialization of the Rugged repository in this action once all operations used in this action are migrated to gitaly.
    • The next slowest Rugged operation is Repository#tag_names. The source of this was not clear to me from the beginning, so I ran a profiling on the action. The relevant part is:

Captura_de_pantalla_2017-01-30_a_las_20.31.41

So, the source is lib/extracts_path.rb's method extract_ref, which is the one that in a path like foo/bar/baz/my.file determines that foo/bar is the branch name and baz/my.file is the file path (for example). It does this through Repository#ref_names by iterating through branch_names + tag_names. Repository#tag_names, the biggest offender, spends most of its time running Rugged::TagCollection#each. So we should implement ref_names in Gitaly.

  • Implement required changes in gitaly MR to follow
    • Implement GRPC call SmartHTTP#root_ref
    • Implement GRPC call SmartHTTP#ref_names. This probably means we can implement SmartHTTP#tag_names and SmartHTTP#branch_names at the same time.
  • Implement required changes in gitlab-rails MR to follow

/cc @andrewn @jacobvosmaer-gitlab

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information