Potential N+1 for namespace projects fetch via "search"
This request fetches projects under all subgroups of the given group - Kibana
See the query in the internal note.
We spent 4s
in DB with 8000+
requests (7000
are cached), and almost 30s
on CPU, allocating 1.6GB
of memory, but the complexity was very moderate - 59
, way below even the unauthenticated threshold (200
).
Slack discussion - https://gitlab.slack.com/archives/C6MLS3XEU/p1683124029295429?thread_ts=1682949308.809499&cid=C6MLS3XEU
I think N+1 is involved here - I don't see any preload in app/graphql/resolvers/nested_groups_resolver.rb.
the request above
☝ probably does 100 * 100 project search queries for larger namespaces
the simple preload would shrink this to 2
Edited by Aleksei Lipniagov