On 10/22/2014 4:10 AM, Gopal Jee wrote: > What is best way to enable connection pooling in SolrJ client? > We have solrCloud setup with load balancer between Solr client and Solr > Server. We are using SolrJ 4.10.
SolrJ's HttpSolrServer implementation (and all of those implementations that use it internally, like CloudSolrServer, LBHttpSolrServer, ConcurrentUpdateSolrServer, etc) uses Apache httpclient, which has a connection manager that defaults to a multi-threaded implementation. The intent with SolrJ is that you create one SolrServer object and use it for all access to Solr. If you do use multiple SolrServer objects (normally only necessary when using multiple Solr cores that are *NOT* SolrCloud), it is a good idea to create one HttpClient object and share it among all SolrServer objects. I recently told someone else on this list how to accomplish that: http://apaste.info/GDJ Connection pooling and re-use (when it's possible) should be automatic via HttpClient, although I admit that I have not verified this. Connection pooling on SolrServer itself is not necessary -- you can simply use the same object throughout your code. Thanks, Shawn