Policy pages have bad load times for projects with large numbers of environments
Summary
Steps to reproduce
Example Project
https://gitlab.com/gitlab-com/www-gitlab-com/-/security/policies
https://gitlab.com/gitlab-com/www-gitlab-com/-/security/policies/new
What is the current bug behavior?
Currently projects with large numbers of environments have terrible performance for the policy page. All environments are queried before the policy list and the new policy pages are fully loaded.
Symptoms:
- On the policy list page, the empty state or list of policies takes a very long time to load for projects with large numbers of environments
- On the new policy page, a loading spinner is shown for a very long time for projects with large numbers of environments
What is the expected correct behavior?
- The page should load quickly, in less than 1 second
- Loading any more extensive lists, such as the list of environments, should be done asynchronously from the primary page load
Proposed Solution
-
Create and implement a lightweight, single API call that checks whether or not at least one environment exists. Use this call to determine whether the user can create a New Policy and to determine whether the user can create a new Network Policy. -
Load the list of environments for the environment dropdown asynchronously. If the user clicks on the filter before the list is fully loaded, then the dropdown should display a Loading...
option item only and do nothing until the list is fully loaded.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
-
frontend do not wait for environments to load for policies list (!69916 (merged)) -
frontend do not wait for environments to load for policy editor (!70024 (merged)) - but do deter being able to save a policy until all the environments load
Edited by Alexander Turinske