The last time that I used the HTTPClient library, it was non-blocking. It doesn’t try to read from the socket until you ask for data from the response object. That allows parallel requests without threads.
Underneath, it has a pool of connections that can be reused. If the pool is exhausted, it can block. wunder Walter Underwood wun...@wunderwood.org http://observer.wunderwood.org/ (my blog) On Aug 23, 2015, at 8:49 AM, Shawn Heisey <apa...@elyograg.org> wrote: > On 8/23/2015 7:46 AM, Ashish Mukherjee wrote: >> I want to run few Solr queries in parallel, which are being done in a >> multi-threaded model now. I was wondering if there are any client libraries >> to query Solr through a non-blocking I/O mechanism instead of a threaded >> model. Has anyone attempted something like this? > > The only client library that the Solr project makes is SolrJ -- the > client for Java. If you are not using the SolrJ client, then the Solr > project did not write it, and you should contact the authors of the > library directly. > > SolrJ and Solr are both completely thread-safe, and multiple threads are > recommended for highly concurrent usage. SolrJ uses HttpClient for > communication with Solr. > > I was not able to determine whether the default httpclient settings will > result in non-blocking I/O or not. As far as I am aware, nothing in > SolrJ sets any explicit configuration for blocking or non-blocking I/O. > You can create your own HttpClient object in a SolrJ program and have > the SolrClient object use it. > > HttpClient uses HttpCore. Here is the main web page for these components: > > https://hc.apache.org/ > > On this webpage, it says "HttpCore supports two I/O models: blocking I/O > model based on the classic Java I/O and non-blocking, event driven I/O > model based on Java NIO." There is no information here about which > model is chosen by default. > > Thanks, > Shawn >