JavaMail: Fast mail searching

Discussion in 'Java' started by Tim Terry, Mar 14, 2005.

  1. Tim Terry

    Tim Terry Guest

    I currently maintain a web based email client which uses the JavaMail
    API to interface with POP3 mailboxes. I'm using the standard sun POP3
    provider. I have created a user definable filter for message's subject
    or sender address. I've found that using the 'folder.search(SearchTerm)'
    method to be slow on mailboxes with more than 500 messages. I'm
    considering using a temp table in a database to filter messages in SQL,
    but i will still have to get the messages into and out of the table. Are
    there any POP3 providers with faster methods for searching? I'm
    interested in how use of the JavaMail can be optimised for faster
    performance regards searching messages.

    Thanks in advance,

    Tim
     
    Tim Terry, Mar 14, 2005
    #1
    1. Advertising

  2. Tim Terry wrote:
    > I currently maintain a web based email client which uses the JavaMail
    > API to interface with POP3 mailboxes. I'm using the standard sun POP3
    > provider. I have created a user definable filter for message's subject
    > or sender address. I've found that using the 'folder.search(SearchTerm)'
    > method to be slow on mailboxes with more than 500 messages.


    Before you start to optimize find out what exactly is it that slows
    things down. If it is e.g. the POP3 server, than all your optimization
    on the client side is a waste of time.

    /Thomas


    --
    The comp.lang.java.gui FAQ:
    ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
     
    Thomas Weidenfeller, Mar 15, 2005
    #2
    1. Advertising

  3. Tim Terry

    Tim Terry Guest

    Thomas Weidenfeller wrote:
    > Tim Terry wrote:
    >
    >> I currently maintain a web based email client which uses the JavaMail
    >> API to interface with POP3 mailboxes. I'm using the standard sun POP3
    >> provider. I have created a user definable filter for message's subject
    >> or sender address. I've found that using the 'folder.search(SearchTerm)'
    >> method to be slow on mailboxes with more than 500 messages.

    >
    >
    > Before you start to optimize find out what exactly is it that slows
    > things down. If it is e.g. the POP3 server, than all your optimization
    > on the client side is a waste of time.
    >
    > /Thomas
    >
    >

    Thanks for the reply. From what I can see the slow down is due to disk
    activity when reading the user's mailbox, as the POP3 server (qmail) is
    on the same host as tomcat this would rule out network problems
    (hopefully). The Java processes are also not using up much CPU time
    while the filtering is taking place. This is Linux box running XFS if
    that helps. Could reading the mailbox be made quicker without upgrading
    hardware such as faster disks? I'm not interested in the content of each
    email just the subject and from address headers.

    Tim
     
    Tim Terry, Mar 15, 2005
    #3
  4. Tim Terry

    GaryM Guest

    Tim Terry <> wrote in
    news:4236e9f3$0$8743$:

    > Thanks for the reply. From what I can see the slow down is due to
    > disk activity when reading the user's mailbox, as the POP3 server
    > (qmail) is on the same host as tomcat this would rule out network
    > problems (hopefully). The Java processes are also not using up
    > much CPU time while the filtering is taking place. This is Linux
    > box running XFS if that helps. Could reading the mailbox be made
    > quicker without upgrading hardware such as faster disks? I'm not
    > interested in the content of each email just the subject and from
    > address headers.


    Javamail should not be grabbing the bodies of the message. So it should
    not be a disk intensive process to retrieve a mere 500 message headers,
    assuming the machine is not underpowered. You might want to run tcpdump
    and ensure the bodies are not being accessed.
     
    GaryM, Mar 15, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nicola Trevisan
    Replies:
    14
    Views:
    16,314
  2. Sheila Dunphy
    Replies:
    2
    Views:
    762
    Sheila Dunphy
    Oct 19, 2004
  3. Neil Daniell
    Replies:
    0
    Views:
    559
    Neil Daniell
    Jan 4, 2005
  4. Replies:
    15
    Views:
    156,161
    abhishek-technicalwork
    Jul 11, 2012
  5. Replies:
    1
    Views:
    912
    Roedy Green
    Apr 13, 2006
Loading...

Share This Page