You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Sachin Nikumbh <Sa...@mathworks.com> on 2010/05/24 21:43:35 UTC

A basic question about httpclient and httpcore

Hi,

I want to implement an http client that supports non-blocking server calls. I know that httpclient does not support non-blocking calls. So, I have started off with going through the httpcore document. I am in search of some document that will describe the differences/relation between these 2 components. A document that will answer the basic question of "how to decide whether I should use httpclient or httpcore" would be useful. Is there any architectural diagram where httpclient and httpcore dependencies are made clear?

There's a lot of information on the Apache web site, I just want to be pointed in the right direction.

I have tried searching through the archive but couldn't find anything.

Thanks
Sachin

Re: A basic question about httpclient and httpcore

Posted by Ken Krugler <kk...@transpac.com>.
Hi Sachin,


On May 24, 2010, at 12:43pm, Sachin Nikumbh wrote:

> Hi,
>
> I want to implement an http client that supports non-blocking server  
> calls. I know that httpclient does not support non-blocking calls.  
> So, I have started off with going through the httpcore document. I  
> am in search of some document that will describe the differences/ 
> relation between these 2 components. A document that will answer the  
> basic question of "how to decide whether I should use httpclient or  
> httpcore" would be useful. Is there any architectural diagram where  
> httpclient and httpcore dependencies are made clear?

1. I believe Oleg has a first cut of this - see http://svn.apache.org/repos/asf/httpcomponents/httpasyncclient/trunk/

2. What's the specific requirement for non-blocking? Often good thread  
management and the current HttpClient 4.x will work.

3. Have you looked at the asynchttp client code released by Ning? It's  
built on top of Netty, and might provide some ideas for your project.

-- Ken

>
> There's a lot of information on the Apache web site, I just want to  
> be pointed in the right direction.
>
> I have tried searching through the archive but couldn't find anything.
>
> Thanks
> Sachin

--------------------------------------------
Ken Krugler
+1 530-210-6378
http://bixolabs.com
e l a s t i c   w e b   m i n i n g





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


Re: A basic question about httpclient and httpcore

Posted by mi...@thedeanda.com.
Quoting Sachin Nikumbh <Sa...@mathworks.com>:

> Hi,
>
> I want to implement an http client that supports non-blocking server  
>  calls. I know that httpclient does not support non-blocking calls.

Why not setup a threadpool and...

threadpool.execute(new Runnable() {
   public void run() {
     //your httpclient code here
     //call your callback code here
   }
});

maybe i misunderstood.

> Thanks
> Sachin
>




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


Re: A basic question about httpclient and httpcore

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2010-05-24 at 15:43 -0400, Sachin Nikumbh wrote:
> Hi,
> 
> I want to implement an http client that supports non-blocking server calls. I know that httpclient does not support non-blocking calls. So, I have started off with going through the httpcore document. I am in search of some document that will describe the differences/relation between these 2 components. A document that will answer the basic question of "how to decide whether I should use httpclient or httpcore" would be useful. Is there any architectural diagram where httpclient and httpcore dependencies are made clear?
> 
> There's a lot of information on the Apache web site, I just want to be pointed in the right direction.
> 
> I have tried searching through the archive but couldn't find anything.
> 
> Thanks
> Sachin

Sachin,

First off, you need to ask yourself whether you really need asynchronous
HTTP client based on the non-blocking I/O model. Contrary to a very
common misconception NIO is significantly slower than blocking I/O as
long as the number of simultaneous connections is less than several
thousands. Asynchronous I/O is also significantly more complex than
blocking I/O and implies a completely different programming model based
on callbacks / events. In most cases using dedicated worker threads to
execute HTTP requests will be a lot faster and simpler.

If you are convinced you need fully asynchronous HTTP client handler,
then the best way to start is by familiarizing yourself with HttpCore
NIO tutorial

http://hc.apache.org/httpcomponents-core-4.0.1/tutorial/html/nio.html

There is also an experimental async HTTP client implementation based on
HttpCore NIO. It is still very basic and not even ALPHA quality but
something you might want to check out:

http://svn.apache.org/repos/asf/httpcomponents/httpasyncclient/trunk/ 

Hope this helps

Oleg


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