Zulfi Umrani and Ortwin Glück wrote:

I will appreciate if anyone answers my questions below.

-Does anyone has perfromance comparison between HTTPClient and JDK
HttpURLConnection?

I have done some comparisons. We do some concurrent requests to a tomcat servlet to fill JTables.
The communication is zip compressed and ssl encrypted. It is a real internet connection (dsl 256k).


A Sun HttpURLConnection (Java 1.4.2) request takes about 500-800 ms.
An Apache HttpClient (2.0-beta1) request takes about 170-350 ms (!).

I gues that HttpClient is faster becaus of
- tcp_nodelay,
- I use MultiThreadedHttpConnectionManager - I don't know what Sun does for reusing.
Maybe Sun has problems in reusing keep-alive connections - opening a new ssl connection takes
a while.


I remember there was a comment about that on the list some months ago. The guy said that HttpClient was slightly faster than HttpUrlConnection for what he was doing. But I don't remember all of it. Maybe check the mail archive.

that was me - but don't remember what I wrote in detail. I have tested a localhost connection. HttpClient was faster.


-Are there any performance techniques that can be used to improve the
performance of HTTPClient?


Not really. There are sime Timeouts you can set, and Nagling is disabled by default. So there is little you can do. HttpClient's performance is mainly affected by:
- The performance of the underlying streams (network, request input)
- The performance of the SSL implementation (if SSL is used)
- Authentication cycles
- Server roundtrips
- Connection stability


You see, the performance parameters are all *outside* HttpClient. So if you want to tune, use a profiling tool and track down the source of the performance problem.

Flushes and buffersizes are also important.
For me it was very important: During long requests I want to give some user-feedback and use the idleing
client to do something. My solution: I flush every two seconds.
A problem I had: I use XML-documents for communication. But XML documents must be complete.
So I use a "double-chunked" connection. The outer chunks can be changed by proxies in between and
the inner chunks stay complete. Buffersize and flush-time was very important for performance-improvements.
(by the way: My performance comparison Sun / Apache HttpClient were of course normal http connections without flushing and "double-chunking" ;-)


Derk



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



Reply via email to