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

Performance issue with search box

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The current search box is very inefficient when checking for suggestions. When a user enters part of a username waiting for the autocomplete to finish, if there are a lot of users it can take a very long time.

      While running a search in the search box I ran a quick thread dump to find out where the suggest was being stuck at and found:

      Handling GET /jenkins/search/suggest : … state=RUNNABLE
          at java.lang.String$CaseInsensitiveComparator.compare(String.java:1170)
          at java.lang.String.compareToIgnoreCase(String.java:1220)
          at hudson.model.User$1.compare(User.java:397)
          at hudson.model.User$1.compare(User.java:395)
          at java.util.TimSort.mergeLo(TimSort.java:687)
          at java.util.TimSort.mergeAt(TimSort.java:483)
          at java.util.TimSort.mergeCollapse(TimSort.java:408)
          at java.util.TimSort.sort(TimSort.java:214)
          at java.util.TimSort.sort(TimSort.java:173)
          at java.util.Arrays.sort(Arrays.java:659)
          at java.util.Collections.sort(Collections.java:217)
          at hudson.model.User.getAll(User.java:395)
          at hudson.model.User$FullNameIdResolver.resolveCanonicalId(User.java:735)
          at hudson.model.User.get(User.java:326)
          at hudson.model.User.get(User.java:299)
          at hudson.model.User.get(User.java:354)
          at hudson.model.User.current(User.java:366)
          at hudson.search.UserSearchProperty.isCaseInsensitive(UserSearchProperty.java:26)
          at hudson.search.CollectionSearchIndex.suggest(CollectionSearchIndex.java:61)
          at hudson.search.UnionSearchIndex.suggest(UnionSearchIndex.java:63)
          at hudson.search.UnionSearchIndex.suggest(UnionSearchIndex.java:62)
          at hudson.search.UnionSearchIndex.suggest(UnionSearchIndex.java:62)
          at hudson.search.UnionSearchIndex.suggest(UnionSearchIndex.java:62)
          at hudson.search.UnionSearchIndex.suggest(UnionSearchIndex.java:62)
          at hudson.search.UnionSearchIndex.suggest(UnionSearchIndex.java:63)
          at hudson.search.Search$Mode$2.find(Search.java:192)
          at hudson.search.Search.find(Search.java:343)
          at hudson.search.Search.suggest(Search.java:268)
          at hudson.search.Search.getSuggestions(Search.java:134)
          at hudson.search.Search.doSuggest(Search.java:117)

        Attachments

          Activity

          Hide
          schristou Steven Christou added a comment -

          The fix this issue in https://github.com/jenkinsci/jenkins/pull/1143. We are executing UserSearchProperty.isCaseInsensitive(); once per item which is a very expensive operation because it calls User.current(); which in turn calls a getAll. Instead this fix just calls the UserSearchProperty.isCaseInsensitive(); once and saves the result.

          Show
          schristou Steven Christou added a comment - The fix this issue in https://github.com/jenkinsci/jenkins/pull/1143 . We are executing UserSearchProperty.isCaseInsensitive(); once per item which is a very expensive operation because it calls User.current(); which in turn calls a getAll . Instead this fix just calls the UserSearchProperty.isCaseInsensitive(); once and saves the result.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: christ66
          Path:
          core/src/main/java/hudson/model/User.java
          core/src/main/java/hudson/search/CollectionSearchIndex.java
          http://jenkins-ci.org/commit/jenkins/84e8d011805194578d3b3ccfca060ce5cffbf7eb
          Log:
          [FIXED JENKINS-21969] Performance issue with search box when doing case insensitive searching.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: christ66 Path: core/src/main/java/hudson/model/User.java core/src/main/java/hudson/search/CollectionSearchIndex.java http://jenkins-ci.org/commit/jenkins/84e8d011805194578d3b3ccfca060ce5cffbf7eb Log: [FIXED JENKINS-21969] Performance issue with search box when doing case insensitive searching.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: christ66
          Path:
          .idea/compiler.xml
          .idea/encodings.xml
          .idea/groovyc.xml
          changelog.html
          cli/pom.xml
          core/pom.xml
          core/src/main/java/hudson/ClassicPluginStrategy.java
          core/src/main/java/hudson/FilePath.java
          core/src/main/java/hudson/PluginManager.java
          core/src/main/java/hudson/cli/ConsoleCommand.java
          core/src/main/java/hudson/model/AbstractItem.java
          core/src/main/java/hudson/model/DirectoryBrowserSupport.java
          core/src/main/java/hudson/model/DownloadService.java
          core/src/main/java/hudson/model/Job.java
          core/src/main/java/hudson/model/ListView.java
          core/src/main/java/hudson/model/Queue.java
          core/src/main/java/hudson/model/Run.java
          core/src/main/java/hudson/model/UpdateSite.java
          core/src/main/java/hudson/model/User.java
          core/src/main/java/hudson/model/View.java
          core/src/main/java/hudson/model/queue/ScheduleResult.java
          core/src/main/java/hudson/slaves/SlaveComputer.java
          core/src/main/java/hudson/util/IOUtils.java
          core/src/main/java/hudson/util/ProcessTree.java
          core/src/main/java/hudson/util/RunList.java
          core/src/main/java/hudson/util/TextFile.java
          core/src/main/java/jenkins/ClassLoaderReflectionToolkit.java
          core/src/main/java/jenkins/diagnosis/HsErrPidList.java
          core/src/main/java/jenkins/model/Jenkins.java
          core/src/main/java/jenkins/security/DefaultConfidentialStore.java
          core/src/main/java/jenkins/util/VirtualFile.java
          core/src/main/resources/META-INF/upgrade/IOUtils.hint
          core/src/main/resources/hudson/model/AbstractBuild/tasks_zh_CN.properties
          core/src/main/resources/hudson/model/BooleanParameterDefinition/config.jelly
          core/src/main/resources/hudson/model/ChoiceParameterDefinition/config.jelly
          core/src/main/resources/hudson/model/FileParameterDefinition/config.jelly
          core/src/main/resources/hudson/model/PasswordParameterDefinition/config.jelly
          core/src/main/resources/hudson/model/RunParameterDefinition/config.jelly
          core/src/main/resources/hudson/model/StringParameterDefinition/config.jelly
          core/src/main/resources/hudson/model/TextParameterDefinition/config.jelly
          core/src/test/java/hudson/util/ProcessTreeTest.java
          core/src/test/java/hudson/util/RunListTest.java
          core/src/test/java/jenkins/RemotingJarSignatureTest.java
          debian/debian/changelog
          plugins/pom.xml
          pom.xml
          test/pom.xml
          test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
          test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
          test/src/test/java/hudson/model/ListViewTest.java
          test/src/test/java/hudson/model/QueueTest.java
          test/src/test/java/hudson/model/UpdateCenterTest.java
          test/src/test/java/hudson/model/UpdateSiteTest.java
          test/src/test/java/hudson/model/UserTest.java
          test/src/test/java/hudson/tasks/ArtifactArchiverTest.java
          war/pom.xml
          war/src/main/webapp/images/16x16/gear2.gif
          war/src/main/webapp/images/16x16/gear2.png
          http://jenkins-ci.org/commit/jenkins/ae5a3cb3620b21daf2572b570312efabbaeed046
          Log:
          Merge branch 'master' into JENKINS-21969

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: christ66 Path: .idea/compiler.xml .idea/encodings.xml .idea/groovyc.xml changelog.html cli/pom.xml core/pom.xml core/src/main/java/hudson/ClassicPluginStrategy.java core/src/main/java/hudson/FilePath.java core/src/main/java/hudson/PluginManager.java core/src/main/java/hudson/cli/ConsoleCommand.java core/src/main/java/hudson/model/AbstractItem.java core/src/main/java/hudson/model/DirectoryBrowserSupport.java core/src/main/java/hudson/model/DownloadService.java core/src/main/java/hudson/model/Job.java core/src/main/java/hudson/model/ListView.java core/src/main/java/hudson/model/Queue.java core/src/main/java/hudson/model/Run.java core/src/main/java/hudson/model/UpdateSite.java core/src/main/java/hudson/model/User.java core/src/main/java/hudson/model/View.java core/src/main/java/hudson/model/queue/ScheduleResult.java core/src/main/java/hudson/slaves/SlaveComputer.java core/src/main/java/hudson/util/IOUtils.java core/src/main/java/hudson/util/ProcessTree.java core/src/main/java/hudson/util/RunList.java core/src/main/java/hudson/util/TextFile.java core/src/main/java/jenkins/ClassLoaderReflectionToolkit.java core/src/main/java/jenkins/diagnosis/HsErrPidList.java core/src/main/java/jenkins/model/Jenkins.java core/src/main/java/jenkins/security/DefaultConfidentialStore.java core/src/main/java/jenkins/util/VirtualFile.java core/src/main/resources/META-INF/upgrade/IOUtils.hint core/src/main/resources/hudson/model/AbstractBuild/tasks_zh_CN.properties core/src/main/resources/hudson/model/BooleanParameterDefinition/config.jelly core/src/main/resources/hudson/model/ChoiceParameterDefinition/config.jelly core/src/main/resources/hudson/model/FileParameterDefinition/config.jelly core/src/main/resources/hudson/model/PasswordParameterDefinition/config.jelly core/src/main/resources/hudson/model/RunParameterDefinition/config.jelly core/src/main/resources/hudson/model/StringParameterDefinition/config.jelly core/src/main/resources/hudson/model/TextParameterDefinition/config.jelly core/src/test/java/hudson/util/ProcessTreeTest.java core/src/test/java/hudson/util/RunListTest.java core/src/test/java/jenkins/RemotingJarSignatureTest.java debian/debian/changelog plugins/pom.xml pom.xml test/pom.xml test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java test/src/test/java/hudson/model/ListViewTest.java test/src/test/java/hudson/model/QueueTest.java test/src/test/java/hudson/model/UpdateCenterTest.java test/src/test/java/hudson/model/UpdateSiteTest.java test/src/test/java/hudson/model/UserTest.java test/src/test/java/hudson/tasks/ArtifactArchiverTest.java war/pom.xml war/src/main/webapp/images/16x16/gear2.gif war/src/main/webapp/images/16x16/gear2.png http://jenkins-ci.org/commit/jenkins/ae5a3cb3620b21daf2572b570312efabbaeed046 Log: Merge branch 'master' into JENKINS-21969
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Steven Christou
          Path:
          core/src/main/java/hudson/model/User.java
          core/src/main/java/hudson/search/CollectionSearchIndex.java
          http://jenkins-ci.org/commit/jenkins/a4c4ed5fdabaae6c734545fc6a548e1ed9c3267c
          Log:
          Merge pull request #1143 from christ66/JENKINS-21969

          [FIXED JENKINS-21969] Performance issue with search box

          Compare: https://github.com/jenkinsci/jenkins/compare/99e080f33afc...a4c4ed5fdaba

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Steven Christou Path: core/src/main/java/hudson/model/User.java core/src/main/java/hudson/search/CollectionSearchIndex.java http://jenkins-ci.org/commit/jenkins/a4c4ed5fdabaae6c734545fc6a548e1ed9c3267c Log: Merge pull request #1143 from christ66/ JENKINS-21969 [FIXED JENKINS-21969] Performance issue with search box Compare: https://github.com/jenkinsci/jenkins/compare/99e080f33afc...a4c4ed5fdaba
          Hide
          dogfood dogfood added a comment -

          Integrated in jenkins_main_trunk #3215
          [FIXED JENKINS-21969] Performance issue with search box when doing case insensitive searching. (Revision 84e8d011805194578d3b3ccfca060ce5cffbf7eb)

          Result = SUCCESS
          schristou88 : 84e8d011805194578d3b3ccfca060ce5cffbf7eb
          Files :

          • core/src/main/java/hudson/model/User.java
          • core/src/main/java/hudson/search/CollectionSearchIndex.java
          Show
          dogfood dogfood added a comment - Integrated in jenkins_main_trunk #3215 [FIXED JENKINS-21969] Performance issue with search box when doing case insensitive searching. (Revision 84e8d011805194578d3b3ccfca060ce5cffbf7eb) Result = SUCCESS schristou88 : 84e8d011805194578d3b3ccfca060ce5cffbf7eb Files : core/src/main/java/hudson/model/User.java core/src/main/java/hudson/search/CollectionSearchIndex.java
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: christ66
          Path:
          core/src/main/java/hudson/model/User.java
          core/src/main/java/hudson/search/CollectionSearchIndex.java
          http://jenkins-ci.org/commit/jenkins/592dca5a88ac27f455f977cc760d7101fa577d96
          Log:
          [FIXED JENKINS-21969] Performance issue with search box when doing case insensitive searching.

          (cherry picked from commit 84e8d011805194578d3b3ccfca060ce5cffbf7eb)

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: christ66 Path: core/src/main/java/hudson/model/User.java core/src/main/java/hudson/search/CollectionSearchIndex.java http://jenkins-ci.org/commit/jenkins/592dca5a88ac27f455f977cc760d7101fa577d96 Log: [FIXED JENKINS-21969] Performance issue with search box when doing case insensitive searching. (cherry picked from commit 84e8d011805194578d3b3ccfca060ce5cffbf7eb)

            People

            • Assignee:
              schristou Steven Christou
              Reporter:
              schristou Steven Christou
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: