Performance degradation for non-admin users

Issue #2 resolved
Rafael Sperafico created an issue

Depending on the amount of permission checks, the following dropdown menu can slow down the request.

<fieldset class="dependsOnselectedBuildStrategy showOncom.atlassianlab.bamboo.plugins.bamboo-after-deployment-trigger-plugin:afterDeployment" style="display: none;">
    <div id="fieldArea_deploymentProject" class="field-group required">

    <label for="deploymentProject" id="fieldLabelArea_deploymentProject">Deployment project<span class="aui-icon icon-required"></span><span class="content"> (required)</span></label>    
    <select name="deployment.trigger.afterDeployment.deploymentProjectId" id="deploymentProject" class="select long-field select2-container aui-select2-container ">
        <option value="0">Choose deployment project</option>
        <option value="1111111111">Deployment name - Environment name</option>
        ... 
    </select>

Benchmark:

URL         http://localhost:8085/branch/admin/config/editChainBranchDetails.action?planKey=PROJ-PLAN0
Remote Address      /127.0.0.1
Request Start Time  8/31/17 16:17:17
Request End Time    8/31/17 16:17:17
Response Start Time 8/31/17 16:19:26
Response End Time   8/31/17 16:19:26
Duration        129.49 sec

As a suggestion, instead of loading all environments they should be changed to autocomplete or to something else, reducing the amount of validation.

Comments (9)

  1. Jeanyhwh Desulme

    Is there a timeframe on when this will be addressed? With an instance of our size we're can be easily loading over 18K individual environments.

  2. Eddie Webbinaro

    This issue is caused by the use of Bamboo service deploymentProjectService.getAllDeploymentProjects() in https://bitbucket.org/atlassianlabs/bamboo-after-deployment-trigger/src/0697af0bdd7bc45e4b95ef4e0022d9d517368a8a/src/main/java/com/atlassianlab/bamboo/plugins/afterdeploymenttrigger/AfterDeploymentTriggerConfigurator.java?at=master&fileviewer=file-view-default#AfterDeploymentTriggerConfigurator.java-167 which takes an extremely long time for any large volume of deployment projects.

    I know atlassian has had to make fixes to the All Deployments page load for performance issues, but I don't know if they avoided this API or made improvements behind it. I think using JS to asynchronously load based on auto-complete per @rsperafico's suggestion is the best path as I don't see any more lightweight method in the java apis to get all deployments any faster.

    Some timing around that call shows that with 4000 projects it takes just over 2 minutes just to get list back from internal API. Subsequent methods of this plugin are rather quick :

    [AfterDeploymentTriggerConfigurator] getAllDeploymentProject() complete: 123624
    [AfterDeploymentTriggerConfigurator] deployment filtering complete: 123628
    [AfterDeploymentTriggerConfigurator] added to context: 123629
    [AfterDeploymentTriggerConfigurator] putEnvironmentsToContext() complete: 123630
    
  3. Alexey Chystoprudov

    You're right. Asynchronous call would be even better if it would be search deployment project/environment API similar to com.atlassian.bamboo.resultsummary.ResultsSummaryCriteria

  4. Eddie Webbinaro

    Do you mean ResultsSummaryManager? The criteria class looks like a POJO. If you have specific APIs to model let me know! I was looking at QuickSearcher

  5. Alexey Chystoprudov

    Merged in eddiewebb/bamboo-after-deployment-trigger/issue-2-non-admin-performance (pull request #2)

    Fixes issue #2 - eliminate getAllDeploymentProjects lookup with autocomplete against rest api

    • benchmarking 3 alternate approaches to stream deployment projects with some trace levekl logging

    • Uses bamboos quickserach api to dynamically load deployment project as user types

    • removed deployproject list from configurator class, but now passes existing name if set to pre-load dropdown on edit.

    • removed debug logging

    • moved passed project name as options to initialization to ensure it works with web resource batching

    • individual imports replace asterisk

    • filters out non DEPLOYMENTPROJECT types from search results

    Approved-by: Alexey Chystoprudov achystoprudov@atlassian.com

    → <<cset 682d9b8e2b9d>>

  6. Christopher Cunniff

    @chystoprudov do you know when a version of the plugin including this fix will be available within the atlassian marketplace?

  7. Log in to comment