Timing out a query in Solr

帅比萌擦擦* 提交于 2019-12-30 02:18:15

问题


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


回答1:


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 recieve 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 maybe 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>


来源:https://stackoverflow.com/questions/19557476/timing-out-a-query-in-solr

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!