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 "Yin,Shiwu (JIRA)" <se...@james.apache.org> on 2013/04/24 10:11:17 UTC

[jira] [Commented] (JAMES-1440) Imap receive mail when there are many mails

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

Yin,Shiwu commented on JAMES-1440:
----------------------------------

hi, Eric
  I met the same issue. Using JavaMail API with IMPA protocol, But it consumed 5s time to open INBOX mailbox that there are only 1000 mails in INBOX. I looked at the code and found some clues as follows:

org.apache.james.imap.processor.base.SelectedMailboxImpl

private void init() throws MailboxException {
       ...
        synchronized (this) {
            while(messages.hasNext()) {
                MessageResult mr = messages.next();
                applicableFlags.add(mr.getFlags());
                add(mr.getUid());
            }         
        ...
    }

In the loop, Invoking getFlags method will costs about 5ms every time. in AbstractJPAMessage class, I found userFlags is a lazy-load strategy, which is the root cause. 

org.apache.james.mailbox.jpa.mail.model.openjpa.AbstractJPAMessage

    @OneToMany(cascade = CascadeType.ALL, fetch=FetchType.LAZY)
    @OrderBy("id")
    @ElementJoinColumns({@ElementJoinColumn(name="MAILBOX_ID", referencedColumnName="MAILBOX_ID"),
    @ElementJoinColumn(name="MAIL_UID", referencedColumnName="MAIL_UID")})
    private List<JPAUserFlag> userFlags;
                
> Imap receive mail  when there are many mails
> --------------------------------------------
>
>                 Key: JAMES-1440
>                 URL: https://issues.apache.org/jira/browse/JAMES-1440
>             Project: James Server
>          Issue Type: Bug
>          Components: IMAPServer
>    Affects Versions: 3.0-beta4
>         Environment: linux
>            Reporter: james
>              Labels: IMAP, mail
>
> hi,all
>         i have received mail from james that there are 30 thousand mails in inbox,using javamail api with imap protocol. But it consumed 22s time to open inbox mailbox,just open, not get messages.Then i changed the protocol to pop3,it only cost 40ms. Why? Do imap  not support good when lagre of mails?
>                                                                                                                               

--
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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org