commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sandy McArthur" <sandy...@apache.org>
Subject Re: [FileUpload] Large file uploads are slow
Date Sun, 12 Mar 2006 00:00:08 GMT
On 3/11/06, Chris Rose <chris@microserf.org.uk> wrote:
> >> I am using a DiskFileItemFactory, and the only thing I do to it is
> >> mandate that the ServletFileUpload object created by the factory does
> >> not have a limit on the size of the file being uploaded. The
> >> transfer is
> >> going via HTTPS.
> >
> > I'm a little confused by this.
>
> [Snip]
>
> Sorry---it was a Friday and I was tired; here's a snippet:
>
>
>                  DiskFileItemFactory factory = new DiskFileItemFactory
> ();
>                  ServletFileUpload upload = new ServletFileUpload
> (factory);
>                  upload.setSizeMax(-1); // No maximum upload size.
>                  List fileItems = upload.parseRequest(request);
>
> Then later I write the uploaded data to disk using fileItem.write
> (File). As I said in my original email, it's parseRequest() that
> takes a long time.
>
> > Second, an unlimited file size is the default, so you
> > shouldn't be configuring anything if that's what you want.
>
> I added that code in case the default changes at a later date and to
> make it explicit in the code that there is no maximum file size.
>
> So, is it possible to make an upload go faster? 20 seconds is an
> awfully long time...

I took the latest FileUpload from svn and ran it though a profiler and
didn't find much helpful. I tested with a 600Meg iso I have on my
machine.

Of the time spend in FileUpload, 63% was waiting on
org.apache.catalina.connector.CoyoteInputStream.read(byte[], int, int)

So I tried growing the byte[] buffer passed to read(...) from the
default of 4K to 4Meg and it only changed the upload time from 4m29s
to 4m26s. Considering my machine's CPU wasn't pegged I'd say I was IO
bound more than anything else.

Comparatively speaking you were getting about 2 megs/second and I was
getting 2.2 megs/second. If you need more speed I think you need to
look at Tomcat or your hardware.

Here are some results of my profiling:
http://people.apache.org/~sandymac/fileupload/profile/

--
Sandy McArthur

"He who dares not offend cannot be honest."
- Thomas Paine

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message