Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

slow attachments - imap design flaw or poor Sun implementation?

843830Nov 13 2006 — edited Nov 13 2006
I struggled with very slow downloads of email attachments until I found another article on this website which said to set the fetchsize property to something bigger than the default of 16k. I set mine to 256k and I was able to approach 200kb/sec download speeds of attachments from my imap server.

I looked at the code and read the imap RFC briefly, and it appears that you can fetch the message in chunks and I think that's what the sun implementation is doing. But if you have to turn around a TCP connection all the time you will see major performance hits, just as we're seeing. Bumping up the size to 256k improves the situation but it's still a lot slower than I would expect, plus the sun code seems to allocate and then free 256k buffers on a regular basis as a result of this. That's probably OK since this is the client side of the equation, but my question is, Does it have to be done this way?

Why, for example, isn't it possible just to request the entire attachment (or message body) in one go? My interface to it is an input stream, why does it have to be broken up into little pieces? Is it just a side-effect of the sun implementation, with its request/response objects?

I was thinking I'll turn off the partialfetch boolean (not really knowing what that means) and see if that helps, but I am worried that the Sun implementation might just allocate a big array and load the whole attachment into it.

Meanwhile, at first I thought it was a poor base 64 decoder that might be at fault, but should have know it wasn't that because my CPU was not pegged. Still, I decided to rewrite it in what I think is a much simpler and hopefully faster approach. Would there be any interest in seeing the code?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2006
Added on Nov 13 2006
3 comments
284 views