I'm not sure if it's a function of the parsing of the multi part request
or what, but I haven't noticed any noticeable slowness in javax.mail
package.  I use an old version of JAMES on our web/mail server (a x86
400mhz I think), and we had a 19 meg email come through... it wasn't
instantaneous, but it was certainly much less than a minute to deliver. 
I can't tell where your input stream is coming from.... and you have 14
other things going on aside from MimeMessage getting constructed... (web
server processing multipart request, reading all the parts and dumping
those out, the uninformative processRequest(request, response)
method...), so I have to say this isn't very conclusive.  Federico
talked about rebuilding the mail API, but there's so much logic involved
in handling email messages, it seems like our very limited time is
better spent on other parts of the system.  And like I started, I
haven't seen any performance problems with javamail... it's a memory
hog, but that's another story.

Serge Knystautas
Loki Technologies
http://www.lokitech.com/

Dino Fancellu wrote:
> 
> I ask as I was using javax.mail to handle file upload on a browser(?!) amd
> although it worked, ot was VERY slow.
> 
> Using code like this, inside a doPost():
> 
> Properties props = System.getProperties();
>     Session session = Session.getDefaultInstance(props, null);
> 
>     // Dummy up a message header.
>     String headers
>     = "Content-Type: " + request.getContentType() +
>     "\r\n\r\n";
> 
>     InputStream messageIS =
>     new SequenceInputStream(new StringBufferInputStream(headers),
>     request.getInputStream());
>     System.out.println("Processing "+new java.util.Date().toString());
>     try
>     {
>     MimeMessage message = new MimeMessage(session, messageIS);
>     System.out.println("Got MimeMessage");
>     Object content = message.getContent();
>     if (content instanceof MimeMultipart)
>     {
>         MimeMultipart mm = (MimeMultipart) content;
>         System.out.println("Its multipart");
>         int nBodyParts = mm.getCount();
>         for (int i = 0; i < nBodyParts; i++)
>         {
>             BodyPart part = mm.getBodyPart(i);
>             System.out.println("Filename="+part.getFileName());
>         }
> 
>         processRequest(request, response);
>     }
>     }
>     catch (MessagingException ex)
>     {
> 
>     }
>     System.out.println("End "+new java.util.Date().toString());
> 
> On my Athlon850, not a slow machine, with JDK1.3, uploaded a 1.5 meg file in
> 5 minutes!!!!
> 
> Using hand cranked code to parse the incoming stream takes 40 seconds.
> 
> What gives?
> 
> The submitted jsp was like this:
> 
> <html>
> <head><title>File upload</title></head>
> <body>
> <%! int count=0; %>
> <%
>  System.out.println(count);
>  count++;
>  %>
> Please upload your pension data here<BR>
> 
> <FORM ACTION="/servlet/com.javelin.swinglets.demo.FileUploadServlet2"
> METHOD=POST ENCTYPE="multipart/form-data" >
> What is your name? <INPUT TYPE=TEXT NAME=submitter> <BR>
> Which file to upload? <INPUT TYPE=FILE NAME=file> <BR>
> <INPUT TYPE=SUBMIT>
> </FORM>
> 
>     <FORM ACTION="/servlet/com.javelin.swinglets.demo.FileUploadServlet"
> METHOD=POST ENCTYPE="multipart/form-data">
>     Which special file to upload? <INPUT TYPE=FILE NAME=file2> <BR>
>     <INPUT TYPE=SUBMIT>
> 
>     </FORM>
> 
> </body>
> </html>
> 
> The first version went to the javax.mail uploaded, the second to my hand
> cranked uploaded. The biggest hit was turning the
> input stream into a mime message, 5 minutes.
> 
> I was thinking, perhaps javax.mail is ok for sending, and for receiving
> personal emails, but not up to the job for handling large volumes?
> Has anyone looked at the code for creating a mime message from a stream?
> Seems odd that its 7.5 times slower than my own code,
> which I thought was pretty damn slow before I tried the javax.mail method.
> 
> Dino.
> 
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives and Other:  <http://java.apache.org/>
> Problems?:           [EMAIL PROTECTED]


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/>
Problems?:           [EMAIL PROTECTED]

Reply via email to