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

VERY poor performance with large test history when viewing results.

      It takes about 20 sec to display any part of the test report when the json file is big enough and there are lots of previous builds.

          [JENKINS-24457] VERY poor performance with large test history when viewing results.

          @teilo, are you sure there's no issue in the ui code?
          It looks really strange that we had no issues with other reports...

          Anatoly Bubenkov added a comment - @teilo, are you sure there's no issue in the ui code? It looks really strange that we had no issues with other reports...

          root report view:

          wget 0.00s user 0.00s system 0% cpu 2:40.45 total

          it's insanely slow...

          Anatoly Bubenkov added a comment - root report view: wget 0.00s user 0.00s system 0% cpu 2:40.45 total it's insanely slow...

          i was initially wrong about 20 sec, it's much slower

          Anatoly Bubenkov added a comment - i was initially wrong about 20 sec, it's much slower

          James Nord added a comment -

          on my server using the supplied json.

          time curl http://myserver/job/tests/job/JENKINS-24457/1/testReport/

          real 0m0.290s
          user 0m0.015s
          sys 0m0.046s

          So yes I think the code is ok.

          try setting initial heap == max heap (or something higher)

          The VM doesn't always expand the heap when a GC frees memory.

          I see exactly this issue in the unit tests if the VM doesn't have enough heap and it is caused by GC removing the test result which the plugin needs in order to render the plugin - so each and every scenario requires the test result to be loaded again and again and again and again...

          @danielbeck - yes there is free server RAM if you throw away your disk cache - but something heavy on disk like jenkins that's not a good idea in my experience.

          James Nord added a comment - on my server using the supplied json. time curl http://myserver/job/tests/job/JENKINS-24457/1/testReport/ real 0m0.290s user 0m0.015s sys 0m0.046s So yes I think the code is ok. try setting initial heap == max heap (or something higher) The VM doesn't always expand the heap when a GC frees memory. I see exactly this issue in the unit tests if the VM doesn't have enough heap and it is caused by GC removing the test result which the plugin needs in order to render the plugin - so each and every scenario requires the test result to be loaded again and again and again and again... @danielbeck - yes there is free server RAM if you throw away your disk cache - but something heavy on disk like jenkins that's not a good idea in my experience.

          ok now it gives 15.012 total for root report
          and 5.042 total for scenario report
          still not so good, but thanks!

          Anatoly Bubenkov added a comment - ok now it gives 15.012 total for root report and 5.042 total for scenario report still not so good, but thanks!

          James Nord added a comment -

          Will. Attempt to reproduce

          James Nord added a comment - Will. Attempt to reproduce

          thanks!
          and sorry for annoying me

          Anatoly Bubenkov added a comment - thanks! and sorry for annoying me

          James Nord added a comment -

          Comment from reporter:

          "This only happens if there is a large (100+) build history"

          This may indicating a recursive load issue - re-opened to investigate.

          James Nord added a comment - Comment from reporter: "This only happens if there is a large (100+) build history" This may indicating a recursive load issue - re-opened to investigate.

          I can share a result of our investigation.

          The poor performance of Cucumber Test Result Plugin caused by the logic of displaying test results.
          Each time when users are visiting Cucumber Test Result page, Cucumber plugin loads previous build results (for calculating age of failed tests).
          In case if current build is success plugin load only one previous result, but in case if a build is failed Cucumber plugin will load previous recursively for calculating a Scenario fail age.

          This behavior has issues:
          1. Method getResult() is synchronized (This mean that only one user can load report for one job).
          2. Cucumber plugin is trying to cache test result in WeakReference class field.
          3. Calculating of fail age has not optimized algorithm. Cucumber plugin calculates fail age separately for each scenario. That's mean that for 10 failed scenarios in one build, the plugin will try to open (or read from a cached field) the XML results 10 times.

          You can see here screenshot with visual VM. When I tried to open a report with 10 failed scenarios in a row Cucumber Plugin is used ~200mb and ~20% of CPU for GC. (Totally we have 868 scenarios)

          Vitaliy Skrypnyk added a comment - I can share a result of our investigation. The poor performance of Cucumber Test Result Plugin caused by the logic of displaying test results. Each time when users are visiting Cucumber Test Result page, Cucumber plugin loads previous build results (for calculating age of failed tests). In case if current build is success plugin load only one previous result, but in case if a build is failed Cucumber plugin will load previous recursively for calculating a Scenario fail age. This behavior has issues: 1. Method getResult() is synchronized (This mean that only one user can load report for one job). 2. Cucumber plugin is trying to cache test result in WeakReference class field. 3. Calculating of fail age has not optimized algorithm. Cucumber plugin calculates fail age separately for each scenario. That's mean that for 10 failed scenarios in one build, the plugin will try to open (or read from a cached field) the XML results 10 times. You can see here screenshot with visual VM. When I tried to open a report with 10 failed scenarios in a row Cucumber Plugin is used ~200mb and ~20% of CPU for GC. (Totally we have 868 scenarios)

          James Nord added a comment -

          vitaliy_skrypnyk to be clear you are 100% correct and this is by design. There is no guarantee that previous builds have finished when the later build completes. This is the same in the junit plugin.

          The slow behavior is due to Memory pressure - if you had more memory available then the prior results would be in memory and would not need to be loaded and parsed - although there is potential that some thing could be improved in this area.

          > Cucumber plugin calculates fail age separately for each scenario

          this is still required as you do not need to view all scenarios - they can be viewed individually, so calculating this for all scenarios when you are viewing a single scenario will be equally sub-optimal.

          James Nord added a comment - vitaliy_skrypnyk to be clear you are 100% correct and this is by design. There is no guarantee that previous builds have finished when the later build completes. This is the same in the junit plugin. The slow behavior is due to Memory pressure - if you had more memory available then the prior results would be in memory and would not need to be loaded and parsed - although there is potential that some thing could be improved in this area. > Cucumber plugin calculates fail age separately for each scenario this is still required as you do not need to view all scenarios - they can be viewed individually, so calculating this for all scenarios when you are viewing a single scenario will be equally sub-optimal.

            Unassigned Unassigned
            bubenkoff Anatoly Bubenkov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: