solr autoSoftCommit会开新搜索者吗?

时间:2013-06-17 12:19:34

标签: java search solr lucene full-text-search

这是我的solrconfig.xml部分:

 <autoCommit> 
    <maxTime>15000</maxTime> 
    <openSearcher>false</openSearcher>
  </autoCommit>
   <autoSoftCommit> 
    <maxTime>1000</maxTime>
  </autoSoftCommit>

这是测试添加文档命令:

curl http://localhost:8983/solr/AluSupply/update/json 
-H 'Content-Type:application/json' 
-d '[{ "CompanyRoleId": 1, 
    "Description": " hello test", 
    "CityId": 1404, 
    "CompanyId": 32733,
    "SupplyTitle": "this is title", 
    "Id":399998}]'

我观察了autoSoftCommit,总是打开一个新的org.apache.solr.search.SolrIndexSearcher,这是否会严重影响它的性能呢?

这是日志信息:

9117 [commitScheduler-7-thread-1] INFO org.apache.solr.update.UpdateHandler - start commit {,optimize = false,openSearcher = true,waitSearcher = true,expungeDeletes = false,softCommit = true,prepareCommit =假}

9142 [commitScheduler-7-thread-1] INFO org.apache.solr.search.SolrIndexSearcher - Opening Searcher @ 648353f6 main

9143 [commitScheduler-7-thread-1] INFO org.apache.solr.update.UpdateHandler - end_commit_flush

9144 [searcherExecutor-4-thread-1] INFO org.apache.solr.core.SolrCore - QuerySenderListener向Searcher发送请求@ 648353f6 main {StandardDirectoryReader(segments_nf:3441:nrt _194(4.3):C2 / 1 _19n( 4.3):C1)}

9144 [searcherExecutor-4-thread-1] INFO org.apache.solr.core.SolrCore - QuerySenderListener已完成。

9147 [searcherExecutor-4-thread-1] INFO org.apache.solr.core.SolrCore - [AluSupply]注册新搜索者Searcher @ 648353f6 main {StandardDirectoryReader(segments_nf:3441:nrt _194(4.3):C2 / 1 _19n(4.3):C1)}

1 个答案:

答案 0 :(得分:2)

当solr执行autoSoftCommit时,它将打开一个基于RAMDirectory的新SolrIndexSearcher。

所以这不会影响性能。

autoCommit会将文件写入硬盘,并重新打开IndexSearcher,这会严重影响性能。