Jira Cleaning
There is couple of things that can slow down Jira. The obvious issues would be database access, disk access or just not enough computing power. In my opinion, inappropriate use can be very harmful as well, and with older versions of Jira you could get significant performance boost just by “cleaning” old stuff.
To be honest, I am not sure how much speed can this cleaning bring with current version of Jira, or if at all, but it makes administration little bit easier.
Removing old projects
In a big Jira instance you can end up with loads of projects that are not used anymore or that have not been updated for a long time. In our instance we used to have around 500 projects. Some of them were only for testing, some of them were merged, moved, or just left there.
To improve performance, we decided that we will remove all projects that were not updated for more than 2 years.
In order to do that I created MySQL query to get list of projects, so I could use it then in Python code.
Here is MySQL query to get projects that were last updated before 2013-01-01:
I stored output into the file. It should look similar to this:
Then I used Python code to remove projects. At first I thought that I can use jira-python and delete_project()
but that didn’t work. So I had to use SOAP, while it works.
In my Python code, I do couple of things:
- read output file from MySQL query
- parse it to dictionary
- iterating through project ids
- finding project and deleting it
To run Python code:
You can find all source code in CleanJira repository.
Removing Jira User Groups
Removing user groups can speed up permission checking and then overall performance. In our instance we used to have around 200 user groups but later on we changed permission model and there was no need for that many groups.
To remove user groups I used the same procedure as with projects. First I get user groups from database.
And result should look something like this.
In Python I used SOAP calls and method deleteGroup()
. You can also specify not to remove certain groups, let say the groups which name starts with special word.
To run Python code:
You can find all source code in CleanJira repository.
Remove permission schemes without projects
After removing old projects you can end up with quiet a few permission schemes. You can easily delete them Jira administration section, but if number of schemes goes to hundred, why not write a script.
To get permission schemes without project, I wrote this query:
Where result will look awfully familiar by now.
In Python I used SOAP calls again and method deletePermissionScheme()
. This method is taking scheme name as argument, so it is important that it is included in MySQL query.
To run Python code:
You can find all source code in CleanJira repository.