Hello Sajid, > If Sun's HttpURLConnection is used with HTTP 1.1 then by default HTTP > 1.1 uses persistent connection.The documentation of HTTPClient also > tells us that persistent connection is used. My question is what is the > exact difference in terms of persistent connection between java's > HttpURLConnection and HTTPClient.
You'll have to investigate Sun's implementation as well as ours to answer that question. I doubt that you'll find experts for HttpURLConnection on this mailing list. You are more likely to find people who switched from HttpURLConnection to HttpClient after the former didn't meet their needs anymore. One difference is obvious: with HttpURLConnection, you have only one pool of persistent connections per JVM. With HttpClient, each connection manager manages it's own pool and can be tuned for the application or component within the application that uses it. Implementing custom connection managers is an option with HttpClient, it is not with the HttpURLConnection. > which is better HttpClient. And HttpComponents will be even better. (Did you expect to get another answer from us? ;-) > how can we measure ? Set up a server. Define a scenario. Implement it with both HttpClient and HttpURLConnection. Run both implementations and track connection re-use on the server. Play with the parameters of the MultiThreaded- ConnectionManager for HttpClient, and the system properties you find in the Sun documentation for HttpURLConnection. http://java.sun.com/j2se/1.4.2/docs/guide/net/properties.html http://java.sun.com/j2se/1.5.0/docs/guide/net/http-keepalive.html Instead of setting up an extra server with monitoring, you can also use any server you want and track connection re-use with a network monitor on the client machine. Whenever a connection is not re-used, you'll see a "connect" for a new connection, and probably some kind of "close" for the old one. hope that helps, Roland --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
