Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timing out a query in Solr

Tags:

java

solr

lucene

I hitting queries to solr through a custom developed layer and few queries which i time out in my layer are still in the solr instance. Is there a parameter in solr which can be used to time out an particular query

like image 473
Benjamin Avatar asked Oct 24 '13 05:10

Benjamin


1 Answers

As stated in Solr query continues after client disconnects? and written in the Solr FAQ

Internally, Solr does nothing to time out any requests -- it lets both updates and queries take however long they need to take to be processed fully.

But at the same spot in the FAQ is written

However, the servlet container being used to run Solr may impose arbitrary timeout limits on all requests. Please consult the documentation for your Serlvet container if you find that this value is too low. (In Jetty, the relevant setting is "maxIdleTime" which is in milliseconds)

So you may configure your container to close a long-running request so that the HTTPClients connected receive a shutdown.

However that may not be enough, Solr could internally still be working though, generating load on your Server. Therefore the common timeAllowed parameter may be used.

timeAllowed - This parameter specifies the amount of time, in milliseconds, allowed for a search to complete. If this time expires before the search is complete, any partial results will be returned.

Either with each request or configured as default in your solrconfig.xml.

<requestHandler name="standard" class="solr.StandardRequestHandler" default="true">
    <lst name="defaults">
        <!-- other parts left out -->
        <!-- timeout (in milliseconds) -->
        <int name="timeAllowed">5000</int>
    </lst>
</requestHandler>
like image 63
cheffe Avatar answered Nov 07 '22 12:11

cheffe