Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira Guardrails made easy with ScriptRunner

Over time your Jira instance grows and maintenance and cleanup become essential in keeping larger Jira instances running smoothly and quickly. Unwieldy instances can become slow, with system errors and crashes getting in the way of your team's busy workload. Regular maintenance ensures your team can find the information they need quickly and easily, and keeps the complaints out of your email box too!

To help you get started, Atlassian has provided guidelines around maximum capacities for Jira Data Center. These Guardrails can help you identify potential problem areas in need of a cleanup.

"Guardrails are data type recommendations designed to help you identify potential risks and aid you [in] making decisions about next steps in your instance optimisation journey."
Atlassian, Jira Software guardrails [accessed 31/10/2022]

Automate and accelerate your Jira admin

This Jira maintenance doesn't have to be manual and arduous either it can be the work of a few moments due to the range of built-in scripts that the ScriptRunner team has recently added specifically to help you operate within these guardrails. Check which areas are nearing the guardrail limitations and action the cleanup required from within a single screen.

The new ScriptRunner for Jira Guardrails built-in scripts are:

  1. Maximum Change History Records Per Issue
  2. Maximum Number of Issue Links Per Issue
  3. Maximum Attachment Size
  4. Maximum Number of Unarchived Projects
  5. Maximum Comments Per Issue

These scripts are built-in, meaning they are ready to go, with configurations available so you can tweak and customise them to fit your requirements.

1. Maximum Change History Records Per Issue

Atlassian's Guardrails recommend limiting the number of changeitems or changegroups to 20,000. This will prevent out-of-memory errors in the history tab and speed up issue view loading and reindexing.

To avoid the need to delete the entire change history relating to your records, we have created a new built-in script that first identifies all issues with more changeitems and changegroups than any amount specified. Next, you can delete the oldest change history records, cleaning up your issues and quickly speeding up your Jira instance.

2. Maximum Number of Issue Links Per Issue

To keep issue loading speeds down and to prevent stuck threads, Atlassian recommends capping your maximum number of issue links to 1000 per issue.

Our built-in script creates a list of any issues with a higher number of issue links than your chosen amount. You can then archive or delete older or unneeded issue links using this list.

3. Maximum Attachment Size

Atlassian's Guardrails recommend that each issue contains no more than 3000 attachments, with a size limit of 10MB per single attachment. Working outside of these recommendations slows down load times for issues and shared files and, in turn, slows down your team!

First, this built-in script will identify any attachments over a specific size. This is automatically set to the recommended 10MB as default, but you can change this to any size. Then, you can delete these large files from the same screen to clean up your instance.

You can also use our example snippets to filter these results further, such as by image type or attachments added by a particular user.

4. Maximum Number of Unarchived Projects

Using this built-in script, you can monitor how many live projects you have at any time and note when you're close to the recommended number of live projects. Atlassian's Guardrails recommend that you have at most 7000 projects per Jira instance. Once you go above this number, you can expect more complex and slower permission calculations, extended wait times and possible timeout errors, when creating new projects.

The easiest way to combat these issues is to archive projects no longer in use. Use our built-in script to monitor how many unarchived projects you have. And, when you near that guardrail, this script filters your projects to help you find which ones should be archived. You can filter on projects that have not been updated within a certain amount of time, or you can filter to target specific projects. Finally, you can use this script to archive the identified projects and bring your number back within the guardrail recommendation.

5. Maximum Comments Per Issue

When you have a large team, a contentious project, or a long-running project, it is easy to rack up those comments. Once you hit 1000 comments on a single issue, you can expect your issue view and reindexing to take longer and, in extreme cases, you will start to receive out-of-memory errors and potentially Jira crashing altogether.

To stay within Atlassian's Guardrails and keep your Jira performance in tip-top shape, this built-in script is your hero. First, you can generate a list of the issues with comments over the allowance you have set. You can search within the whole instance or search just within specific projects. Next, you can delete comments from any of these identified projects, choosing to delete either the oldest comments or target specific types of comments, such as application bots that provide the least relevant comments.

Bonus tip: Epic Guardrails

Atlassian has also highlighted that you may notice slow loading of the epic link menu once you pass 100,000 epics. The easiest way to stop this from happening is to identify how many epics are in your instance and, if you are approaching the guardrail, archive any epics that are no longer in use.

To do this, first run this simple JQL search to generate a list of epics which have not been updated within the last 52 weeks:

issuetype = Epic and updated < -52w

ScriptRunner users can make this search even more specific using our advanced JQL. Use this search to find epics which have no stories:

type = Epic and issueFunction not in epicsOf('')

Additionally, use this search to identify epics where stories are closed:

issueFunction in epicsOf('resolution is not empty') and not issueFunction in epicsOf('resolution is empty')

Get ScriptRunner for Jira for your Data Center instance or access documentation via Atlassian Marketplace.

Jira housekeeping that takes care of itself

Guardrails offer a great starting point for taking control of larger Jira instances, but it doesn't stop there! ScriptRunner provides a whole host of other functionality to take your Jira maintenance to the next level. Choose from our range of scripts with regularly-scheduled automation and reactive, event-based automation.



Log in or Sign up to comment
AUG Leaders

Atlassian Community Events