HttpClient vs HttpURLConnection:
Below is the code used for comparison:
Performance wise HttpURLConnection is much faster than HttpClient, results are shared below.
Test parameters:
15 threads
10 Loop Counts
Average time take by Connection to complete 150 requests: 7.61 milliseconds
15 threads
10 Loop Counts
Average time take by Connection to complete 150 requests: 7.61 milliseconds
Average time take by HttpClient to complete 150 requests: 85.89 milliseconds
Even thought the performance of HttpURLConnection is much faster , it does not give good control over managing the Http connections, it is always feasible to use HttpClient in production environment, when high volume of transactions are expected.
For comparison refer to: http://www.innovation.ch/java/HTTPClient/urlcon_vs_httpclient.html
1 comments:
You are comparing Apache's HTTPClient against URLConnection, but you're providing a link to the (discontinued) innovation.ch HTTPClient which is a completely different implementation.
Post a Comment