hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Akka + httpclient vs httpasyncclient
Date Sun, 17 Jun 2012 14:07:03 GMT
On Sun, 2012-06-17 at 09:16 -0400, Jason Weden wrote:
> This week I had the pleasure of wrapping my httpclient.execute() call of httpcomponents
httpclient in an akka future. I'm no expert but I think with this and the oncomplete() callback,
I made the sending of http requests and receiving of the replies both asynchronous and non-blocking.
(I'm using the threadedclientconnmanager and hope to upgrade to poolingconmanager when I move
to version 4.2.)
> 
> My question is why not pose this as a solution rather than build httpasyncclient? Httpasyncclient
 doesn't appear to use akka and so you don't get all the benefits and performance of akka.
I am very curious therefore to understand the benefits and drawbacks of my solution vs that
of httpasyncclient architecture.  Thanks in advance and Happy Fathers Day to the fathers on
this list.
> 
> Regards,
> 
> Jason Weden

Hi Jason

A blocking HTTP client used in conjunction with an asynchronous
execution framework such as Akka is a very reasonable approach for a lot
of applications. However, there are several special types of
applications (such as HTTP proxies and gateway) that often have to
maintain several thousand outgoing HTTP connections most of which stay
idle most of the time. In such a case the cost of context switching of
several thousand threads blocked in an I/O operation can become
prohibitive. 

Basically, HttpClient is a general purpose HTTP agent well suited for
the majority of applications where the total number of concurrent
connections remains relatively low (fewer than 500). HttpAsyncClient is
a special purpose HTTP agent primarily intended for HTTP proxies and
HTTP gateways that need to maintain over 2000 concurrent connections
that stay idle most of the time.

Hope this helps somewhat.

Oleg

PS: Happy Fathers Day! 

   


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


Mime
View raw message