2010-10-20 98 views
3

我在我的数据库中看到极其缓慢的Solr更新。该数据库只有900个文件。我们在一段时间自动提交使用自动提交以下设置,一旦是需要长时间阻塞更新:Solr更新很慢

<autoCommit> 
    <maxDocs>10000</maxDocs> 
    <maxTime>1000</maxTime> 
</autoCommit> 

世界上有什么可以发生74秒900页的文件。

想法?

这里是日志片段:

2010年10月18日上午十一时52分46秒org.apache.solr.core.SolrCore执行 INFO:[] web应用=/solr的路径= /更新PARAMS = { }状态= 0 QTIME = 59569 2010年10月18日上午11点52分46秒org.apache.solr.update.SolrIndexWriter getDirectory

2010年10月18日上午11点53分21秒org.apache.solr。 core.SolrCore执行 INFO:[] webapp =/solr path =/update params = {} status = 0 QTime = 33586 Oct 18,2010 11:53:21 AM o rg.apache.solr.update.processor.LogUpdateProcessor完成

2010年10月18日上午11点54分40秒org.apache.solr.core.SolrCore执行 INFO:[] web应用=/solr的路径= /更新PARAMS = {}状态= 0 QTIME = 76098 2010年10月18日上午11点54分41秒org.apache.solr.update.DirectUpdateHandler2提交

和提交日志:

2010年10月18日11 :54:上午12点org.apache.solr.update.DirectUpdateHandler2提交

INFO:开始提交(优化= F ALSE,waitFlush =真,waitSearcher =真)

2010年10月18日上午11点54分00秒org.apache.solr.search.SolrIndexSearcher

INFO:打开搜索器@ 29b003主

年10月18 2010年上午11时54分00秒org.apache.solr.update.DirectUpdateHandler2提交

信息:end_commit_flush

2010年10月18日上午11时54分00秒org.apache.solr.search.SolrIndexSearcher温暖

INFO:autowarming Searcher @ 29b003 main Searcher @ 718c93 main filterCache {lookups = 0,hits = 0,hitratio = 0.00,inserts = 512,evictions = 0,size = 257,warmupTime = 19294,cumulative_lookups = 3330661,cumulative_hits = 12 5437,cumulative_hitratio = 0.03,cumulative_inserts = 3207537,cumulative_evictions = 3184094}

2010年10月18日上午11点54分20秒org.apache.solr.search.SolrIndexSearcher温暖

INFO:用于autowarming结果Searcher @ 29b003 main filterCache {lookups = 0,hits = 0,hitratio = 0.00,inserts = 256,evictions = 0,size = 256,warmupTime = 19739,cumulative_lookups = 3330661,cumulative_hits = 12 5437,cumulative_hitratio = 0.03,c umulative_inserts = 3207537,cumulative_evictions = 3184094}

2010年10月18日上午11点54分20秒org.apache.solr.search。SolrIndexSearcher温暖

INFO:autowarming搜索器@从搜索器29b003主@ 718c93主 queryResultCache {查找= 0,命中= 0,hitratio = 0.00,插入= 256,驱逐= 0,大小= 256,warmupTime = 18604,cumulative_lookups = 3084,cumulative_hits = 996,cumulative_hitratio = 0.32,cumulative_inserts = 2313,cumulative_evictions = 0}

2010年10月18日上午11点54分四十零秒org.apache.solr.search.SolrIndexSearcher温暖

INFO: searchcher @ 29b003主要 queryResultCache {lookups = 0,hit = 0,hitratio = 0.00,inserts = 256,逐出= 0,size = 256,warmupTime = 19925,cumulative_查找= 3084,cumulative_hits = 996,cumulative_hitratio = 0.32,cumulative_inserts = 2313,cumulative_evictions = 0}

2010年10月18日上午11时五十四分40秒org.apache.solr.search.SolrIndexSearcher温暖

INFO :autowarming搜索器@ 29b003 main来自Searcher @ 718c93 main documentCache {lookups = 0,hit = 0,hitratio = 0.00,inserts = 0,evictions = 0,size = 0,warmupTime = 0,cumulative_lookups = 41846,cumulative_hits = 33712, cumu lative_hitratio = 0.80,cumulative_inserts = 8134,cumulative_evictions = 0}

二零一零年十月十八日上午11时54分40秒org.apache.solr.search.SolrIndexSearcher温暖

INFO:authowarming for Searcher @ 29b003主结果 documentCache {lookups = 0,hits = 0,hitratio = 0.00,inserts = 0,evictions = 0,size = 0,warmupTime = 0,cumulative_lookups = 41846,cumulative_hits = 33712,cumu lative_hitratio = 0.80,cumulative_inserts = 8134,cumulative_evictions = 0}

二○一○年十月一十八日上午十一点54分40秒org.apache.solr.core.SolrCore registerSearcher

INFO:[]注册新搜索者搜索者@ 29b003主

2010年10月18日上午11:54:40 org.apache.solr.search.SolrIndexSearcher关闭

+0

取决于Solr需要做什么样的分析......你可以发布你的schema.xml吗? – 2010-10-20 15:43:47

+0

这没什么特别的 - 每个文档有十几个字段。 5个方面。 – user43685 2010-10-20 23:55:26

+0

有趣的是,有一个搜索者有很大的热身时间,为什么会这样呢? – user43685 2010-10-20 23:58:40

回答

7

随着<maxTime>1000</maxTime>,你将在每秒钟提交一次。每次Solr进行提交时,都会发生以下几件事情:索引搜索器关闭并重新打开,缓存与旧缓存一起加热,一些查询可能会自动启动(请参阅solrconfig中的'newSearcher'设置) 。在某个时候,你可能会有重叠的提交。如果发生这种情况,Solr通常会很慢。

所以问问自己,你是否真的需要在每一秒做出承诺。如果是的话,那么从'newSearcher'中删除所有查询可能会更好,因为承诺经常导致它们无用。

+0

我认为在提交之前数据不可用于搜索。所以逻辑就是经常以不同步的方式应用少量变化。其次,我认为DirectUpdateHandler2似乎连续处理更新请求(包括提交) - 不重叠。 – user43685 2010-10-20 23:56:39

+0

为什么? “逻辑是经常异步地应用少量变化” - >这是实时的,在正常情况下绝对没有必要。对于你的第二个问题:问题是索引需要一段时间+加热查询(如果cachesize!= 0)=>你会得到很多updaters =>很快达到thos更新的最大值=>性能瓶颈!只需设置1000到60000 – Karussell 2010-11-03 10:33:57

+1

这应该是被接受的答案。或者,您可以从执行更新的代码执行手动提交(SolrServer.commit())。那么不需要自动提交。 – Frans 2012-10-11 07:24:12