On Wed, 2014-05-14 at 11:46 +0100, Daniel Feist wrote:
> Hi,
> 
> I spent a good part of yesterday testing and comparing HttpClient
> performance and the results are interesting:  HttpClient 3.1 is 20%
> faster than HttpClient 4.3 when both configured in the same way and
> when using 50 client threads!
> 

I do not think they are configured the same way. For one, HC 4.3 uses
content decompression by default whereas HC 3.1 does not. That obviously
skews the results. 

I stopped comparing HC 4.x to 3.1 a while ago because in my tests HC 3.1
was consistently slower. I can dig out that code and re-run the tests. 

> https://docs.google.com/a/mulesoft.com/spreadsheets/d/1Dqp2dH7K8nQeBzAC3S4hboYmSm67GXWO6AYgTYiVInQ/edit#gid=0
> 
> When profiling each version when running with 200 threads, this is what I see:
> 
> HttpClient4.3:
> -  Significant amount of contention due to creation of proxies as
> mentioned before.
> 
> HttpClient4.2   ->
>  - No blocked threads
> 
> HttpClient3.1:  ->
>  - Very significant amount of contention due to synchronized method:
> org.apache.commons.httpclient.params.DefaultHttpParams.getParameter(String)
> used multiple times for each request.
>  - Minimal contention getting/returning connections from pool.
> 
> 
> I think it's clear to see why 4.2 scale a bit better,

If you are reasonably sure that dynamic proxies are the culprit let's
get rid of them and re-run the tests.

>  but I'm unsure
> why 4.3 (when not using minimal) would perform worse than 4.3.. are
> there additional features in 4.3?
> 

Of course. HC 4.3 in full configuration simply does much more:
transparent content decompression, connection state tracking, auth
caching. You need to disable those features to have a fairer
comparison. 

> 
> Notes:
> ---------
> - I used your http client benchmark project referenced by Oleg
> - I ran tests on Amazon XL (32-core) VM, ensuring each test ran for 30s+.
> - I tweaked the Jetty configuration to make jetty perform slightly
> better (see below).  I verified changes were faster by testing before
> and after this change.

Can I incorporate these changes into the project? 

> - For each version of HttpClient i configured the same bufferSize,
> soTimeout and disabled stale connection checking.
> - Also recorded as the values for HttpClient4.3 minimal client.
> 
> 
> Be interested to hear you thoughts, and let me know if you'd like any
> more information.
> 

In my opinion any difference within 10% is simply unsubstantial and can
well be a fluke. Overall, based on these numbers I am happy with HC 4.3
performance. I will happily make it faster, though.

Oleg

> 
> thanks,
> Dan
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to