Oleg, Both didn't make a difference. I have attached the CPU profile that is generated using -Xprof. The profile for Sun will be attached to this email, another mail will be sent for the Windows profile. Any help would be appreciated. Thanks, Ben Sun Solaris 8 on Sparc ---------------------- Flat profile of 17.72 secs (450 total ticks): main Interpreted + native Method 5.6% 18 + 6 java.math.BigInteger.mulAdd 3.3% 14 + 0 sun.security.provider.SHA.computeBlock 3.0% 13 + 0 java.math.BigInteger.addOne 2.8% 11 + 1 sun.nio.cs.StreamDecoder.read 1.9% 0 + 8 java.lang.Throwable.fillInStackTrace 1.6% 0 + 7 java.net.Inet4AddressImpl.lookupAllHostAddr 1.4% 6 + 0 java.math.BigInteger.montReduce 1.4% 0 + 6 sun.nio.cs.UTF_8$Decoder.decodeArrayLoop 1.2% 0 + 5 com.telstra.deon.test.HttpClientPerformance.main 1.2% 3 + 2 sun.nio.cs.StreamDecoder.read0 1.2% 0 + 5 org.apache.commons.httpclient.HttpMethodBase.<init> 0.9% 0 + 4 java.lang.String.charAt 0.9% 2 + 2 sun.text.ComposedCharIter.findNextChar 0.7% 0 + 3 sun.nio.cs.ISO_8859_1$Decoder.decodeArrayLoop 0.7% 0 + 3 java.lang.ClassLoader.defineClass0 0.7% 1 + 2 java.lang.System.arraycopy 0.7% 0 + 3 java.lang.String.length 0.7% 0 + 3 java.lang.StringBuffer.expandCapacity 0.5% 2 + 0 java.util.HashMap.hash 0.5% 0 + 2 java.nio.Buffer.position 0.5% 0 + 2 java.util.zip.Inflater.inflateBytes 0.5% 0 + 2 java.lang.ref.Reference.get 0.5% 2 + 0 org.apache.log4j.spi.LoggingEvent.<init> 0.5% 0 + 2 java.lang.StringBuffer.setLength 0.5% 1 + 1 java.lang.String.getChars 44.9% 96 + 96 Total interpreted (including elided) Compiled + native Method 10.0% 40 + 3 java.lang.StringBuffer.append 7.0% 30 + 0 sun.nio.cs.StreamDecoder.read0 6.5% 8 + 20 org.apache.commons.httpclient.Wire.wire 6.5% 28 + 0 java.lang.Integer.toUnsignedString 6.3% 27 + 0 java.nio.charset.CoderResult$Cache.get 3.0% 13 + 0 sun.nio.cs.StreamDecoder$CharsetSD.implRead 2.8% 12 + 0 sun.nio.cs.StreamDecoder.read 2.3% 10 + 0 java.lang.Integer.hashCode 2.1% 9 + 0 sun.nio.cs.US_ASCII$Decoder.decodeArrayLoop 1.4% 6 + 0 java.nio.charset.CharsetDecoder.decode 1.2% 5 + 0 sun.nio.cs.US_ASCII$Decoder.decodeLoop 1.2% 5 + 0 java.nio.CharBuffer.put 0.9% 3 + 1 java.lang.StringBuffer.expandCapacity 0.5% 2 + 0 java.math.BigInteger.mulAdd 0.5% 2 + 0 java.nio.Buffer.<init> 0.2% 1 + 0 java.nio.Buffer.position 52.6% 201 + 24 Total compiled Thread-local ticks: 4.9% 22 Blocked (of total) 2.3% 10 Class loader 0.2% 1 Unknown: no last frame Flat profile of 0.02 secs (1 total ticks): DestroyJavaVM Thread-local ticks: 100.0% 1 Blocked (of total) Global summary of 17.82 seconds: 100.0% 463 Received ticks 1.7% 8 Received GC ticks 57.9% 268 Compilation 2.2% 10 Class loader 0.2% 1 Unknown code -----Original Message----- From: Kalnichevski, Oleg [mailto:[EMAIL PROTECTED] Sent: Tuesday, 17 February 2004 12:27 AM To: Commons HttpClient Project Subject: RE: GetMethod Performance Ben, Try the following: (1) disable stale connections check SimpleHttpConnectionManager connman = new SimpleHttpConnectionManager();
connman.setConnectionStaleCheckingEnabled(false); HttpClient client = new HttpClient(connman); http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/ httpclient/SimpleHttpConnectionManager.html#setConnectionStaleCheckingEn abled(boolean) (2) configure HttpClient to use HTTP/1.0 instead of HTTP/1.1 GetMethod get = new GetMethod("http://192.168.0.1/commons-httpclient-2.0-final.zip"); get.setHttp11(false); http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/ httpclient/HttpMethodBase.html#setHttp11(boolean) See if any these options makes any difference Oleg -----Original Message----- From: Ben Wong [mailto:[EMAIL PROTECTED] Sent: Monday, February 16, 2004 06:41 To: [EMAIL PROTECTED] Subject: GetMethod Performance Hi, I have noticed significant performance difference between using HttpClient and Socket. I tried to use GetMethod to download a 2MB file from a Webserver sitting in the LAN. When I do it with HttpClient, it takes around 13-15 seconds while it will only take less than half a second with Socket. I was running the code below on a Sun Blade 100 with Solaris 8 installed. J2SDK1.4.2_03 and HttpClient 2.0 final were used. Any help would be appreciated. Thanks, Ben HttpClient code: ---------------- HttpClient client = new HttpClient(); GetMethod get = new GetMethod("http://192.168.0.1/commons-httpclient-2.0-final.zip"); int statusCode = client.executeMethod(get); System.out.println("Status Code: " + statusCode); int size = 0; InputStream in = get.getResponseBodyAsStream(); byte [] data = new byte[10000]; int read = 0; while ((read = in.read(data)) > 0) { size += read; } in.close(); get.releaseConnection(); Socket Code: ------------ Socket soc = new Socket("192.168.0.11", 80); InputStream in = soc.getInputStream(); OutputStream out = soc.getOutputStream(); String command = "GET http://192.168.0.1/commons-httpclient-2.0-final.zip HTTP/1.0\nUser-Agent: Jakarta Commons-HttpClient/2.0final\nHost: 10.0.3.11\n\n"; byte [] send = command.getBytes(); out.write(send); byte b[] = new byte[4096]; int size = 0; int count = 0; while( (size = in.read(b)) >= 0) { count += size; } in.close(); out.close(); soc.close(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]