Skip custom roles queries when possible

What does this MR do and why?

Cache the presence of custom roles for a namespace so that we can skip the custom role queries when custom roles are not configured for the project or group

References

Related to #507925 (closed)

How to set up and validate locally

  1. Visit any project page and check the performance bar
  2. Search the SQL queries for AS custom_permissions

Before this MR, you should see that query. A lot of other pages have that query too. On this branch, that query should be replaced with a simple member roles exists query.

You can also enable Rails caching locally by running touch tmp/caching-dev.txt in the Rails dir and then doing a gdk restart. With caching enabled, there wouldn't be any exists query.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Heinrich Lee Yu

Merge request reports

Loading