You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Karsten Otto (Jira)" <se...@james.apache.org> on 2022/08/08 13:23:00 UTC

[jira] [Created] (JAMES-3799) Optimize memory requirements of SimpleMessageSearchIndex

Karsten Otto created JAMES-3799:
-----------------------------------

             Summary: Optimize memory requirements of SimpleMessageSearchIndex
                 Key: JAMES-3799
                 URL: https://issues.apache.org/jira/browse/JAMES-3799
             Project: James Server
          Issue Type: Improvement
          Components: MailStore &amp; MailRepository
    Affects Versions: master
            Reporter: Karsten Otto


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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org