On 4/17/2013 3:46 AM, J Mohamed Zahoor wrote:
Hi
I am pumping parallel select queries using CloudSolrServer.
It looks like it can handle only certain no of max connections...
my Question is,
How many concurrent queries does a CloudSolrServer can handle?
Looking into the code for 4.x versions, I found that the default max
number of connections is 128, and the default max number of connections
per host is 32. This is set in the HttpSolrServer constructor.
An old thread tries to answer this by asking to give our own instance of
LBHttpSolrServer...
But it looks like there is no way from LBHttpSolrServer to up the maxConnection
of the httpClient it has...
Can someone let me know how to bump up the maxConnections and
maxConnectionsPerHost parameter for the httpCLient used by cloudSolrServer?
You should be able to create an instance of LBHttpSolrServer, which in
turn lets you use a custom HttpClient, where you could set the
connection limits. Then you could use the LBHttpSolrServer object to
create an instance of CloudSolrServer.
The following code MIGHT work (probably in a try block), but I haven't
tried to actually use it, so it might be horribly broken.
ModifiableSolrParams params = new ModifiableSolrParams();
params.set(HttpClientUtil.PROP_MAX_CONNECTIONS, 1000);
params.set(HttpClientUtil.PROP_MAX_CONNECTIONS_PER_HOST, 200);
HttpClient client = HttpClientUtil.createClient(params);
LBHttpSolrServer lbServer = new LBHttpSolrServer
(client, "http://localhost/solr");
lbServer.removeSolrServer("http://localhost/solr");
SolrServer server = new CloudSolrServer(zkHost, lbServer);
I would argue that CloudSolrServer (and therefore LBHttpSolrServer)
should have many of the setters available on HttpSolrServer, including
setDefaultMaxConnectionsPerHost and setMaxTotalConnections. Perhaps not
all of them, some of them are things that most people would never really
need, and some of them might not make sense for a clustered server object.
Side issue: shouldn't that be setMaxConnectionsPerHost instead of
including the word Default? If there's no objection, I would plan on
adding the renamed method and using a typical deprecation procedure for
the old one.
Thanks,
Shawn