Email protocols
IMAP and POP are protocols for the retrieval of email from a server. The protocols have different approaches for the retrieval of email. POP tends to be more efficient than IMAP.
When using IMAP, Jira fetches attachments in chunks of just 16Kb by default. This can have a negative impact on performance when downloading large attachments, showing up as FolderClosedException where the mailserver closed the connection on JEMH as it reads the mail because it exceeded server limits. POP does not have this issue because the complete email is downloaded in one chunk.
Some system properties can be set within Jira to increase the fetch size for IMAP retrieval. This can result in a significant performance boost when using IMAP to download large emails.
Increasing IMAP fetch size for Jira
The following system properties set the IMAP fetch size for the standard and SSL protocols respectively. Values for the parameters are in bytes. In this example the size of fetched chunks is set to 4Mb (up from the 16Kb default):
-Dmail.imap.fetchsize=4194304 -Dmail.imaps.fetchsize=4194304
Depending how you launch Jira, setting environment variables for Jira can be approached in different ways:
Confluence: Configuring System Properties
Performance comparisons
The below tests were executed against a basic JEMH profile containing a single default project mapping. A secure IMAP connection was configured in Jira and then bound to a JEMH mail handler. Emails with a single attachment of increasing size were used as test data.
POP
Email size (MB) | Processing Time |
---|---|
5 | 4.9 Seconds |
10 | 7.6 Seconds |
15 | 11.7 Seconds |
20 | 15.1 Seconds |
IMAP (Default Fetch Size of 16Kb)
Email size (MB) | Processing Time |
---|---|
5 | 2.9 Minutes |
10 | 7.1 Minutes |
15 | 10.3 Minutes |
20 | 11.2 Minutes |
IMAP (Fetch Size Set to 4MB )
Email size (MB) | Processing Time |
---|---|
5 | 10.3 Seconds |
10 | 17 Seconds |
15 | 26.3 Seconds |
20 | 35.2 Seconds |