[ 
https://issues.apache.org/jira/browse/IMAP-371?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13629971#comment-13629971
 ] 

Andrzej Rusin commented on IMAP-371:
------------------------------------

Eric,
I was thinking about it more and my next idea is:
- SelectedMailbox is the context of "most" commands, esp in the context of the 
count of invocations,
- the MessageManager  from 
org.apache.james.mailbox.store.StoreMailboxManager.getMailbox(MailboxPath, 
MailboxSession) is mostly used for  
org.apache.james.mailbox.MessageManager.getMetaData(boolean, MailboxSession, 
FetchGroup)
- so maybe keeping/deriving a MessageManager in/from SelectedMailbox may 
totally eliminate getting the Mailbox from MailboxMapper in 
org.apache.james.mailbox.store.StoreMailboxManager.getMailbox(MailboxPath, 
MailboxSession)?
- especially that "most" commands inherit 
org.apache.james.imap.processor.AbstractMailboxProcessor, and this fact can 
somehow be used.

What do you think?

Still, my first solution reduces getting the Mailbox by fair amount.
                
> MailboxManager::getMailbox called very often
> --------------------------------------------
>
>                 Key: IMAP-371
>                 URL: https://issues.apache.org/jira/browse/IMAP-371
>             Project: James Imap
>          Issue Type: Improvement
>          Components: Processor
>    Affects Versions: 0.3
>            Reporter: Andrzej Rusin
>            Assignee: Eric Charles
>
> MailboxManager::getMailbox(MailboxPath mailboxPath, MailboxSession session) 
> is getting called extremely often. 
> On my custom RDBMS-based Mailstore implementation it is the biggest hot spot.
> I had to resort to caching the return value of it on Memcache, but even after 
> that it uses up around 15% of spent CPU time. It is far too much in my 
> opinion.  (before I started caching it, fully indexed RDBMS getting of the 
> mailbox was taking more than 50% of the global RDBMS load).
> My suspect is the method AbstractMailboxProcessor::addFlagsResponses(final 
> ImapSession session, final SelectedMailbox selected, final 
> ImapProcessor.Responder responder, boolean useUid).
> It gets the mailbox from MessageManager each time, even if it may be not 
> needed. 
> This method is called in many CommandProcessors during the 
> unsolicitedResponses phase.
> After I am able to really profile and confirm that it's the core of problem, 
> I will provide a patch.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to