N+1: Tree.new(recursive: true)

https://gitlab.com/gitlab-org/gitlab-ce/blob/0862bff8caa391477c2444c24f69e34dfc1591e5/app/models/tree.rb#L64-77

Tree#get_entries(recursive: true) makes recursive Gitaly calls, one for each directory in the tree. This is completely unacceptable, see #1022 (closed). If you call this function on the gitlab-ce repo (via e.g. /api/v4/projects/:id/repository/tree?recursive=true) you generate 2800 Gitaly calls.


Stages:

  • Investigate

  • Assess priority

  • Server-side fixed LINK

  • Client-side fixed LINK

Affected RPC's:

  • Endpoint::Name

Process explanation:

Investigate

If it's not clear what RPC's add up to the N+1 violation, do a new CI run on gitlab-ce/ee to find out.

Assess priority

  • Does this N+1 degrade the user experience?
  • Does it cause more than 100 (extra) requests per second on gitlab.com?

If the answer to both questions is 'no' then downgrade the priority of this issue to v1.1.


Edited by Jacob Vosmaer