On 2/27/2014 11:32 AM, solr2020 wrote:
We are using DefaultHttpClient 4.2 .3 on solrj side to send parallel queries to Solr. But the connection manager associated with this (PoolingHttpClientConnectionManager) by default allows 2 concurrent connections only.How to send more than 2 parallel queries/how to establish more than 2 connections?.
First, if you just create SolrJ server objects without specifying the HttpClient, they will by default allow a LOT more connections than that. I don't have the numbers handy, but it is a lot more than two.
Here's how you can create objects (either HttpSolrServer or CloudSolrServer) that allow even more connections:
ModifiableSolrParams params = new ModifiableSolrParams(); params.add(HttpClientUtil.PROP_MAX_CONNECTIONS_PER_HOST, "300"); params.add(HttpClientUtil.PROP_MAX_CONNECTIONS, "5000"); HttpClient httpClient = HttpClientUtil.createClient(params); String myUrl = "http://localhost:8983/solr/collection1"; SolrServer hServer = new HttpSolrServer(myUrl, httpClient); String zkHost = "zoo1:2181,zoo2:2181,zoo3:2181/mysolr"; LBHttpSolrServer lbServer = new LBHttpSolrServer(httpClient); SolrServer cServer = new CloudSolrServer(zkHost, lbServer); Thanks, Shawn