Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-18364

Optimize creation of relative links to jobs

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Functions.getRelativeLinkTo(Item p) is called quite liberally while rendering Views. It calls view.getItems() which means recalculating the jobs to display. This can lead to performance problems for complex views (e.g. with the view-jobs-filter plugin).

      One idea is to cache the result from ListView.getItems(). Kohsuke created an initial branch for this:
      https://github.com/jenkinsci/jenkins/commits/view-caching

        Attachments

          Issue Links

            Activity

            Hide
            ericweikl Eric Weikl added a comment - - edited

            Tested with the view-jobs-filter plugin, verified that Kohsuke's branch reduces the call count to ViewJobFilter.filter() to 1

            Show
            ericweikl Eric Weikl added a comment - - edited Tested with the view-jobs-filter plugin , verified that Kohsuke's branch reduces the call count to ViewJobFilter.filter() to 1
            Hide
            jglick Jesse Glick added a comment -

            Unclear why getRelativeLinkTo is even needed in a typical page render, since View.getItem(String) does not care whether the item is actually in the current view anyway (and why would you be displaying an item not in the current view?). Quick workaround may be to use a weak cache of View.getItems by request (which might be useful anyway).

            Show
            jglick Jesse Glick added a comment - Unclear why getRelativeLinkTo is even needed in a typical page render, since View.getItem(String) does not care whether the item is actually in the current view anyway (and why would you be displaying an item not in the current view?). Quick workaround may be to use a weak cache of View.getItems by request (which might be useful anyway).
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            changelog.html
            core/src/main/java/hudson/Functions.java
            core/src/test/java/hudson/FunctionsTest.java
            http://jenkins-ci.org/commit/jenkins/bcc86148561ad9ab4a0365ff00d28ff7ee71d57c
            Log:
            [FIXED JENKINS-18364] Functions.getRelativeLinkTo is called many times during rendering, so skip checking View.getItems which is expensive.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html core/src/main/java/hudson/Functions.java core/src/test/java/hudson/FunctionsTest.java http://jenkins-ci.org/commit/jenkins/bcc86148561ad9ab4a0365ff00d28ff7ee71d57c Log: [FIXED JENKINS-18364] Functions.getRelativeLinkTo is called many times during rendering, so skip checking View.getItems which is expensive.
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #3272
            [FIXED JENKINS-18364] Functions.getRelativeLinkTo is called many times during rendering, so skip checking View.getItems which is expensive. (Revision bcc86148561ad9ab4a0365ff00d28ff7ee71d57c)

            Result = SUCCESS
            Jesse Glick : bcc86148561ad9ab4a0365ff00d28ff7ee71d57c
            Files :

            • core/src/test/java/hudson/FunctionsTest.java
            • core/src/main/java/hudson/Functions.java
            • changelog.html
            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #3272 [FIXED JENKINS-18364] Functions.getRelativeLinkTo is called many times during rendering, so skip checking View.getItems which is expensive. (Revision bcc86148561ad9ab4a0365ff00d28ff7ee71d57c) Result = SUCCESS Jesse Glick : bcc86148561ad9ab4a0365ff00d28ff7ee71d57c Files : core/src/test/java/hudson/FunctionsTest.java core/src/main/java/hudson/Functions.java changelog.html
            Hide
            danielbeck Daniel Beck added a comment - - edited

            Issue is a performance regression introduced in 1.512, therefore reclassifying as bug to make this eligible for LTS inclusion.

            Measured on a pristine instance with ~8000 freestyle jobs (j0 to j8447), no builds:

            • 1.511: List view with simple regex (j1.*) opens in <1 second
            • 1.512: Same list view opens in 44 seconds, takes 100% CPU during that time.
            Show
            danielbeck Daniel Beck added a comment - - edited Issue is a performance regression introduced in 1.512, therefore reclassifying as bug to make this eligible for LTS inclusion. Measured on a pristine instance with ~8000 freestyle jobs ( j0 to j8447 ), no builds: 1.511: List view with simple regex ( j1.* ) opens in <1 second 1.512: Same list view opens in 44 seconds, takes 100% CPU during that time.
            Hide
            imakowski Ireneusz Makowski added a comment -

            Please add this to latest lts

            Show
            imakowski Ireneusz Makowski added a comment - Please add this to latest lts
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            changelog.html
            core/src/main/java/hudson/Functions.java
            core/src/test/java/hudson/FunctionsTest.java
            http://jenkins-ci.org/commit/jenkins/98f4b7d99a20252fe64e0ff44ac9375ffc6bc0db
            Log:
            [FIXED JENKINS-18364] Functions.getRelativeLinkTo is called many times during rendering, so skip checking View.getItems which is expensive.
            (cherry picked from commit bcc86148561ad9ab4a0365ff00d28ff7ee71d57c)

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html core/src/main/java/hudson/Functions.java core/src/test/java/hudson/FunctionsTest.java http://jenkins-ci.org/commit/jenkins/98f4b7d99a20252fe64e0ff44ac9375ffc6bc0db Log: [FIXED JENKINS-18364] Functions.getRelativeLinkTo is called many times during rendering, so skip checking View.getItems which is expensive. (cherry picked from commit bcc86148561ad9ab4a0365ff00d28ff7ee71d57c)
            Hide
            pdr Pete Ryland added a comment -

            This change looks like it may have caused problems with the radiator plugin. Please see JENKINS-23096.

            Show
            pdr Pete Ryland added a comment - This change looks like it may have caused problems with the radiator plugin. Please see JENKINS-23096 .

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                ericweikl Eric Weikl
              • Votes:
                3 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: