The Jira project list page is very slow to load due to heavy javascript code from 3rd party add-ons
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This knowledge base article describes an example of scenario where the project list page accessed from Top Bar > Projects > View All Projects takes a very long time to load (for example > 20s).
Environment
Jira 8.0.0 and above.
Diagnosis
- When loading the Project list page while having the Network tab from the Browser Developer tool opened, we can see that one of the HTTP request which is loading a batch.js file takes a very long time to load (10-20 seconds), due to the big size of the file (several MBs):
In the example above, the batch.js file is loaded from the URL below:
<JIRA_BASE_URL>/s/22d45bff8cc836be8af08b14cca9fc40-CDN/-mpclfi/820006/1euwt2n/913723dad1470421bc02be0a8af8f765/_/download/contextbatch/js/atl.admin,jira.global,jara.admin,-_super/batch.js?agile_global_admin_condition=true&healthcheck-true =true&locale=zh-CN&whisper-enabled=true
- When running on a fresh vanilla Jira instance without any 3rd party add-on installed, or when entering plugin safe mode, we can see that the same file batch.js loads much faster (a few milliseconds) thanks to its very small size (a few KBs):
- Download the content of the problematic batch.js file as a temporary file on your local machine, which is possible by:
- Collecting a HAR file using the browser development tool.
- Clicking on the HTTP request from the Network tab and then clicking on the Response tab and saving its content to a text file:
Check the content of the local batch.js file and look for any javascript code coming from module keys that are not from Atlassian (basically, any code located below a module-key which does not start with the string com.atlassian:
For example, any key starting with the below string is coming from the ScriptRunner add-on:
/* module-key = 'com.onresolve.jira.groovy.groovyrunner ...
For example, any key starting with the below string is coming from the OrgWise-Organization and Report for Jira add-on:
/* module-key = 'com.shdsd.plugin.organizationPro ...
- You may also run the following command on Linux terminal to have an overview of which plugins are contributing on your batch.js response:
- This prints an approximate line count of each module-key:
cat contents_from_batch_js_response.txt | awk 'BEGIN {mkey=""; split("", mlines); print "Lines", "Module-key"};\ ($0 ~ /module-key = /) {match($0, /module-key = .*:/); mkey=substr($0, RSTART+14, RLENGTH-15)};\ (mkey != "") {mlines[mkey]++};\ END {for (k in mlines) {print mlines[k], k | "sort -nr"}}' | column -t Lines Module-key 473105 com.onresolve.jira.groovy.groovyrunner 148409 com.topshelfsolution.simpletasklists 28344 com.atlassian.jira.plugins.jira-workflow-designer 16859 com.xpandit.plugins.xray 16770 com.okapya.jira.checklist 8601 jira.webresources 7631 com.atlassian.auiplugin 5502 com.atlassian.plugin.jslibs 3727 com.intenso.jira.issue-templates 3479 com.atlassian.jira.jira-project-config-plugin 3244 com.go2group.jira.plugin.crm 2331 com.atlassian.jira.project-templates-plugin 1328 com.pyxis.greenhopper.jira 1262 com.atlassian.jira.plugins.jira-dnd-attachment-plugin 1179 com.atlassian.jira.plugins.jira-slack-server-integration-plugin
It also has an example response showing multiple plugins. From the results of your command, you could disable the respective plugins one at a time if plugin safe mode is not possible (the example output is from a different file).
grep "module-key" contents_from_batch_js_response.txt | grep -v "com.atlassian\|jira.webresources\|com.pyxis.greenhopper.jira" | cut -d ':' -f1 | cut -d ' ' -f4 |sort | uniq -c | sort -nr 98 'com.okapya.jira.checklist 43 'com.almworks.jira.structure 25 'com.spartez.jira.plugins.jiraplanningpoker 17 'com.onresolve.jira.groovy.groovyrunner 14 'com.obss.plugin.time-in-status 11 'com.almworks.structure.gantt 6 'com.hascode.plugin.jira-quick-subtasks 5 'com.thinktilt.proforma.add-on 3 'com.intenso.jira.plugins.jsd-extender 2 'com.midori.jira.plugin.betterexcel 2 'com.googlecode.jira-suite-utilities 1 'com.testrail.jira.testrail-plugin 1 'com.resolution.atlasplugins.samlsso.Jira 1 'com.porzelt.jira.darktheme.DarkTheme
- This prints an approximate line count of each module-key:
- Try to delete the scripts coming from these add-on keys, save the local file batch.js, and check if the size of the file decreased drastically. If that's the case, then it is an indication that the add-ons from which you deleted the scripts were the ones contributing to the big size of the batch.js file, and consequently the slow loading of the project list page.
- Alternatively, you can also confirm that the page loads faster, or that the size of batch.js file is smaller by either entering plugin safe mode, or disabling the add-ons identified in that file.
Cause
The Jira application merges and compresses all the javascript code coming from both the native Jira application and all the 3rd party add-ons installed on top of it, and puts them in the batch.js file. This file is loaded and all the javascript code from it is executed by the browser to render any Jira page that you are trying to access. If any 3rd party add-on contains MBs worth of javascript code, the size of the batch.js file will increase, and depending on the speed of the network, this file might taker long time to load, slowing down the loading of some Jira pages.
Solution
Once you have identified the 3rd party add-ons which javascript code is contributing the most to the size of the batch.js file, you might consider either:
- Simplifying the code configured with these add-ons.
- Reaching out to the support teams responsible for these add-ons, since 3rd party add-ons fall outside of Atlassian support.