在Solr中超时查询 [英] Timing out a query in Solr

查看:558
本文介绍了在Solr中超时查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我命中了要通过自定义开发层进行Solr的查询,而我在该层中超时的一些查询仍在solr实例中. solr中是否有一个可用于使特定查询超时的参数

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

推荐答案

中所述客户端断开连接后,Solr查询是否继续?写在Solr FAQ中

在内部,Solr不会使任何请求超时-它使更新和查询都需要花费很长时间才能完全处理.

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

但是,用于运行Solr的servlet容器可能会对所有请求施加任意超时限制.如果发现该值太低,请查阅Serlvet容器的文档. (在Jetty中,相关设置为"maxIdleTime",以毫秒为单位)

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)

因此,您可以将容器配置为关闭长时间运行的请求,以使连接的HTTPClient关机.

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

但是,这可能还不够,Solr可能仍在内部运行,从而在服务器上产生了负载.因此,可以使用常用的timeAllowed参数

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-此参数指定完成搜索所允许的时间(以毫秒为单位).如果此时间在搜索完成之前到期,则将返回部分结果.

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.

在每个请求中,或者在solrconfig.xml中将其配置为默认值.

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>

这篇关于在Solr中超时查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆