Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-3799

Optimize memory requirements of SimpleMessageSearchIndex

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • master
    • None
    • None

    Description

      While experimenting some more with the ExpireMailboxService, I noticed that it uses an unexpectedly high amount of heap memory. I tracked the issue down to SimpleMessageSearchIndex.searchResults(), which always uses FetchType.FULL when retrieving messages from the MessageMapper for non-UID searches. Thus it loads the entire mail into memory, even if it only needs to check the internalDate.

      I propose to optimize the fetch type used at this point, so it depends on the actual requirements of the stated SearchQuery. For most queries, it will only need to retrieve the mail headers, which typically have a much smaller memory footprint than mail bodies. For certain cases it may avoid even that if it only needs the message metadata.

      Besides a significant reduction in memory use, I also anticipate a certain amount of speed improvement when reducing/skipping content retrieval from blob storage.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kotto Karsten Otto
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 4h 10m
                4h 10m