Description

Since upgrading to Jenkins 2.x, we are forced to use cloudbees-folder plugin due to dependency requirement. Our Jenkins setup is quite large (have several thousands of jobs mapped to several thousands of users via matrix-auth plugin) and we do not use jenkins 'folders' feature. Since we started using this plugin, we noticed severe UI performance issue in loading the job home page (takes approximately 45 seconds to load) and further debugging (by getting several thread dumps in the consecutive seconds) revealed that this plugin is invoking Jenkins.getActiveInstance().getAllItems() which in turn loads all jobs in memory and runs through ACL permission check (which is a very expensive call in our setup). Attached the threaddump and here's the two places where Jenkins.getActiveInstance().getAllItems() method gets invoked.

When disabling the above method calls, we noticed that UI performance was restored and job home page loaded in 2-3 seconds. It would be nice to have a feature flag to use this plugin for dependency requirement. When the feature flag is set, perform no-op or at least do not invoke Jenkins.getActiveInstance().getAllItems() method.