We are experiencing a very strange problem with HTTP uploads on jboss4/tomcat. When uploading large files from IE over the network, upload speed is capped at about 70kbytes/sec even though the network allows for much higher speeds. Neither CPU nor disk access appears to be the bottleneck. When using FireFox browser, upload speed is about 4000kbytes/sec. When using IE from the server through loopback adapter, speed is 7000kbytes/sec.
This problem is happening on 2 separate servers. One is a win 2000 box with a freshly installed OS. The other one is a brand new windows server 2003 enterprise edition.
There is one machine which runs file-for-file identical jboss installation under the same version of java. When accessing that machine with IE from other boxes, uploads go fast.
I tried apache fileupload library and o'reilly MultipartRequest. I also tried reading directly from InputStream with this JSP page:
<%@ page import = "java.util.*" %>
<%@ page import = "java.io.*" %>
<%
InputStream is = request.getInputStream();
byte buffer[]=new byte[128*1024];
int bytes=0;
int total=0;
long totalbytes=0;
long t1=System.currentTimeMillis();
while (0 < (bytes = is.read(buffer))) {
total++;
totalbytes+=bytes;
}
long t2=1+System.currentTimeMillis();
%>
<%if (total > 0) {%>
time(ms): <%=t2-t1%><br>
total buffer reads: <%=total%><br>
total bytes: <%=totalbytes%><br>
chunks per second: <%=total*1000/(t2-t1)%><br>
bytes per second: <%=totalbytes*1000/(t2-t1)%><br>
average bytes per chunk: <%=totalbytes/total%><br>
<%}%>
<form method=post ENCTYPE="multipart/form-data">
<input type=file name=a>
<input type=submit>
</form>