JavaMail: Fast mail searching

T

Tim Terry

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
 
T

Thomas Weidenfeller

Tim said:
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
 
T

Tim Terry

Thomas said:
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
 
G

GaryM

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top