lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <apa...@elyograg.org>
Subject Re: SolrJ Solr Cloud timeout
Date Tue, 30 Aug 2016 13:06:54 GMT
On 8/29/2016 10:22 PM, Brent P wrote:
> Is there any way to set a timeout with a CloudSolrClient?

There are a couple of potential timeouts that you might be talking
about, but the one that seems most likely to be of interest to you is
the Socket Timeout.  This is a low-level timeout on the TCP connection,
and represents the amount of time the TCP connection can be idle before
it will be disconnected forcefully.  Such a disconnect will throw an
exception.

If that's what you're after, here's some sample code:

  String zkHost = "zk1:2181,zk2:2181,zk3:2181/mysolr";
  RequestConfig rc = RequestConfig.custom().setConnectTimeout(15000)
    .setSocketTimeout(900000).build();
  HttpClient httpClient = HttpClients.custom()
    .setDefaultRequestConfig(rc).setMaxConnPerRoute(300)
    .setMaxConnTotal(5000).disableAutomaticRetries().build();
  CloudSolrClient = new CloudSolrClient(zkHost, httpClient);

Another possibility that you might want is the "timeAllowed" parameter,
which you can add to requests.  If the request type supports this
parameter, Solr will do its best to honor it.  It won't always succeed.

http://wiki.apache.org/solr/CommonQueryParameters#timeAllowed

Thanks,
Shawn


Mime
View raw message