Managing mail queue size in Jira Data Center

The Mail queue size metric represents the number of notification emails waiting to be sent to Jira users. In a Jira Data Center environment, this queue is managed across all nodes and is crucial for ensuring timely communication of issue updates and other important information to users.

Thresholds:

Optimal

Less than 50 emails in queue

Requires attention

Between 50 and 99 emails in queue

Needs attention

Greater than 100 emails in queue

How does mail queue size affect Jira Data Center performance?

A large mail queue size can significantly impact your Jira Data Center instance in several ways:

  • Delayed notifications to users about issue updates

  • Potential loss of productivity as users may not receive timely information

  • Increased system load as Jira attempts to process a large backlog of emails

  • Possible indication of underlying performance issues or misconfigurations

Consistently high Mail Queue Size can lead to a degraded user experience and potential system performance issues across your Jira Data Center cluster. More about mail queue size

What's the recommendation?

You should aim to keep the mail queue size below 50 emails for optimal performance. If you're consistently seeing queue sizes above this threshold, consider the following actions:

  • Flush the mail queue

  • Reset the mail queue service

  • Check network connectivity

  • Review outgoing mail server settings

  • Optimize email notification settings

More details on Troubleshooting slow/stuck notification issues in Jira/Service Management Server/Data Center.

Flush the mail queue

Manually flushing the mail queue can help clear temporary backlogs and ensure timely delivery of notifications.

Steps to flush the mail queue:

  1. Go to Administration > System > Mail Queue

  2. Select Flush mail queue

  3. Monitor the queue size to ensure it decreases after flushing

Important considerations:

  • If the queue size doesn't decrease after flushing, don't repeatedly attempt to flush as this can generate more threads and potentially cause performance issues.

  • In a Data Center environment, perform this action on each node if necessary.

For more information on managing the mail queue.

Reset the mail queue service

Resetting the mail queue service can help resolve issues caused by temporary database connectivity problems.

Steps to reset the mail queue service:

  1. Go to Administration > System > Services

  2. Locate the Mail queue service and select Edit

  3. Without changing any values, select Update

  4. Wait for 5 minutes

  5. Check if the mail queue size decreases automatically

Check network connectivity

Poor network connectivity between Jira and the SMTP mail server can cause email backlogs.

Steps to check network connectivity:

  1. Perform a ping test from Jira servers to the SMTP server

  2. Run a traceroute to identify any network bottlenecks

  3. Check with your network team to ensure there are no firewall or routing issues

If network issues are identified:

  1. Work with your network team to optimize the connection between Jira and the SMTP server

  2. Consider implementing a local mail relay if the SMTP server is remote

Review outgoing mail server settings

Incorrect outgoing mail server settings can contribute to mail queue buildup.

Steps to review and optimize mail server settings:

  1. Go to Administration > System > Outgoing Mail

  2. Check the timeout value - ensure it's not set to 0 (which can cause indefinite waits)

  3. Verify that the server details (hostname, port, protocol) are correct

  4. Test the mail server configuration using the "Send a test email" feature

Optimization tips:

  • Set an appropriate timeout value (e.g., 10000 ms)

  • If using TLS, ensure proper certificate configuration

  • Consider increasing the number of connections if your mail server supports it

See Configuring Jira's SMTP mail server to send notifications.

Optimize email notification settings

Reducing the overall volume of email notifications can help prevent mail queue buildup.

Steps to optimize email notifications:

  1. Review notification schemes: Administration > Issues > Notification schemes

    • Reduce the number of events that trigger notifications

  2. Implement email batching: Administration > System > Email notifications

    • Enable "Batch email notifications" and configure appropriate intervals

  3. Review filter subscriptions for large group subscriptions

  4. Adjust Mail Queue Service scheduling time:

    • Go to Administration > System > Services

    • Check the cron value in the Schedule column of the Mail Queue Service

    • Ensure it's set to run every minute: 0 * * * * ?

  5. Check DNS lookup method:

    • Add the JVM parameter -Djava.net.preferIPv4Stack=true to use IPv4 instead of IPv6

    • Apply this change to each Jira node and restart for it to take effect

For more information on configuring email notifications, see Configuring email notifications.

Long-term monitoring and prevention:

  • Implement regular monitoring of the mail queue size across all nodes

  • Set up alerts for when the queue size exceeds certain thresholds

  • Periodically review and optimize email-related configurations and subscriptions

  • Keep Jira and its plugins up-to-date to benefit from performance improvements and bug fixes

Contact Atlassian Support

  1. Enable debug logging for mail-related operations:

    • Go to Administration > System > Logging and Profiling

    • In the Outgoing mail section, select Enable

    • Select Enable debugging

    • Configure logging level for package com.atlassian.jira.service to DEBUG

  2. Wait about 15 minutes to collect sufficient logs

  3. Generate a support zip with runtime diagnostics data:

    • Go to Administration > System > Troubleshooting and support tools > Create support zip

    • Select Customize zip and ensure Runtime diagnostics data is ticked

    • Create and download the zip (repeat for each node in a cluster)

  4. Take screenshots of Administration > System > Mail queue for each node

  5. Run the following SQL queries on the Jira database

    • Query 1

      select * from rundetails where job_id = 'com.atlassian.jira.service.JiraService:10000';
    • Query 2

      select count (*) from filtersubscription where groupname != '';
    • Query 3

      select count (*) from filtersubscription where groupname = '';
  6. Contact Atlassian Support, providing:

    • Support zips from all nodes

    • Screenshots of the mail queue from each node

    • Results of relevant SQL queries (as provided in the "How to Fix" section of the original specification)


Last modified on Jan 23, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.