I've never dealt with this in Tomcat, but from other network apps:
        How are you using the ServletInputStream - are you calling int
read(), which reads the stream a byte at a time, or are you calling int
read(byte[])?  My experience is that you want to use the second option,
preferably with the byte[] size equal to 1500 (Reason for 1500 - its the MTU
(Maximum Transmission Unit) of Ethernet, probably the network the server is
attached to).
        Reason this speeds things up:  When calling int read(), to get 1500
bytes of input, Java has to make 1500 system calls.  If you use int
read(byte[]) then it can get 1500 bytes in one system call.  The reason you
want this byte[] to be the same length as the MTU - you can read each packet
as it arrives and be processing it as the next packet finds its way across
the network instead of waiting on the next one.

        One caveat: I have not looked at the source code for this class, but
from the JavaDoc it appears that all the methods we are talking about are
inherited from InputStream, so these techniques should work.

        Randy

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 04, 2001 6:13 PM
To: [EMAIL PROTECTED]
Subject: Slow upload speeds


Hi everyone.

I am using Tomcat-3.2.1 on W2K, Solaris with or without apache. Since I 
need to provide users with functionality to upload fairly big files (> 10 
MB), speed is essential.

My uploader is based on Jason Hunter code. Maximum upload speed I could 
achieve is between 40 and 60 Kbytes/s (even when client and server are on 
the same machine). Bottleneck (quiet predictable) seems to be in 
ServletInputStream misc. "read()" methods. Speed does not seem to be 
dependant on a platform or web server.

Anyone was able to achieve better speeds (at least around 100 kBytes/s)? 
Any ideas ?

Thanks

Andrus


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to