hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: httpclient performance
Date Sun, 18 Jul 2010 19:53:35 GMT
On Sun, 2010-07-18 at 02:04 -0400, Brooks, Kenneth S wrote:
> Oleg,
> We’re replacing a t3 solution with one that is similar to
> SpringRemoting.. Serializing POJOs over http.
> I’ve been able to optimize the CPU utilization and memory usage very
> well.. We’re running in a smaller memory footprint and less CPU than
> on t3.
> The one thing I’m struggling with is the actual response times.
> We’re about 2-6x slower over http.
> Keep in mind, the service itself can serve both t3 and http so its not
> an issue of the serverside.. it is responding consistently.
> One thing that I’m focusing in on is what Jprofiler is telling me
> about httpclient.
> Please see the attached html file.. it’s a Call tree output showing
> the CPU time for the call tree.
> It shows that 60% of my call time is buried in httpclient.execute.
> I would expect that, but what I don’t get is that when I drill down to
> doSendRequest and doSendResponse I find out that the majority of the
> time is eaten up by sendRequestHeader and receiveResponseHeader.. I
> would have thought that it would have been the retrieving the entity
> that would consume the majority of the time..

Right. But the response entity is not retrieved in the #execute method.
#execute reads the response head, constructs an HTTP entity bound to the
underlying HTTP connection and returns back without reading the entity.

> I understand that some of the overhead might be related to t3 being
> persistent and http not really (having to do the stale check, etc.. ).
> But the difference is pretty significant… 2000 invocations on t3 take
> 5300ms, 2000 invocations on http takes 30000ms.. 
> 14 of those 30 seconds are spent inside of httpclient (and that’s just
> CPU time).. 

Make sure you have the stale connection check disabled. It usually costs
50ms per request invocation. It is on per default.

> What in the world am I missing?
> Is that just to be expected.. or am I doing something wrong?
> What further information do you need from me?

A context log of the HTTP session would be most useful. 

Are you using multiple threads to execute requests concurrently or all
2000 requests are executed sequentially? 

If the transport you are developing does not require authentication,
HTTP state management and complex connection pooling, one possibility to
speed things up by approximately 40-50% would be using HttpCore directly
without all those additional services provided by HttpClient 

Hope this helps


To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message