2013-03-27 41 views
10

我有一个客户端程序,它可以生成1-50百万个Solr文档并将它们添加到Solr。
我使用ConcurrentUpdateSolrServer从客户端推送文档,每个请求输入1000个文档。
文档相对较小(几个小文本字段)。
我想提高索引速度。
我试图增加“ramBufferSizeMB”到1G和“mergeFactor”到25,但没有看到任何改变。
我想知道是否有其他推荐的设置来改善Solr索引速度。
任何有关材料的链接将不胜感激。如何配置Solr以提高索引速度

回答

8

看起来您正在将数据批量导入Solr,因此您无需立即搜索任何数据。

首先,您可以增加每个请求的文档数量。由于您的文档很小,我甚至会将它增加到每个请求100K或更多的文档并尝试。

其次,您希望减少批量索引时发生的提交次数。在您的solrconfig.xml中查找:

<!-- AutoCommit 

    Perform a hard commit automatically under certain conditions. 
    Instead of enabling autoCommit, consider using "commitWithin" 
    when adding documents. 

    http://wiki.apache.org/solr/UpdateXmlMessages 

    maxDocs - Maximum number of documents to add since the last 
       commit before automatically triggering a new commit. 

    maxTime - Maximum amount of time in ms that is allowed to pass 
       since a document was added before automatically 
       triggering a new commit. 

    openSearcher - if false, the commit causes recent index changes 
    to be flushed to stable storage, but does not cause a new 
    searcher to be opened to make those changes visible. 
    --> 
<autoCommit> 
    <maxTime>15000</maxTime> 
    <openSearcher>false</openSearcher> 
</autoCommit> 

您可以完全禁用autoCommit,然后在发布所有文档后调用提交。否则,您可以按如下方式调整数字:

默认maxTime为15秒,因此如果存在未提交的文档,则每15秒会发生一次自动提交,因此您可以将其设置为较大的值,例如3小时(即3 * 60 * 60 * 1000)。您还可以添加<maxDocs>50000000</maxDocs>这意味着只有在添加了5000万个文档后才会进行自动提交。发布所有文档后,手动或从SolrJ调用一次提交 - 需要一段时间才能提交,但总体来说速度要快得多。

此外,在完成批量导入后,请减少maxTimemaxDocs,以便您对Solr执行的任何增量帖子都将更快提交。或者使用solrconfig中提到的commitWithin

+0

如果提交完全禁用,则可能会发生内存不足。但不重新开放搜索者是一个好主意。 – 2013-03-29 01:51:49

+0

嗨你能建议如何配置它,以便它不会重新打开搜索器? – Krunal 2013-12-12 14:05:50

+0

自动提交后, false不会打开新的搜索器。 – arun 2013-12-13 03:35:48