How to monitor database connections in Jira
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 article provides some examples on how we can monitor Database connection usage in Jira.
Environment
Jira 8
Solution
Database monitoring graph
Jira has a built-in database connection pool graph in which we can see the available connections in the pool and the active ones:
https://confluence.atlassian.com/adminjiraserver/monitoring-database-connection-usage-938847726.html
Performance log file
The atlassian-jira-perf.log is one of the useful logs we may parse to get Database Connection usage info over time.
The lines we're interested are the PLATFORMINSTRUMENTS records that contain values for "dbcp.numActive", meaning the number of active DB connections at that time.
Grepping the log as follows will produce an output similar to the one below, with the timestamp and the number of active connections at (roughly) every minute:
$ cat atlassian-jira-perf.log | egrep 'dbcp.numActive","value":"[0-9]*"' | sed -E 's/,[0-9]{3}.*dbcp.numActive",/ /g' | sed -E 's/\},\{.*$//g' | sed 's/"value"://g' | sed 's/"//g' | cut -d" " -f-3
2020-12-03 13:59:23 49
2020-12-03 14:00:16 50
2020-12-03 14:01:09 47
2020-12-03 14:02:00 46
2020-12-03 14:02:50 50
2020-12-03 14:03:51 46
2020-12-03 14:07:54 1
2020-12-03 14:08:54 1
2020-12-03 14:09:54 1
You may compare those values with the dbconfig.xml <pool-size>
parameter to confirm the DB pool hasn't been a performance bottleneck.
Also check Tuning database connections!