如何配置Solr以提高索引速度

Avn*_*evy 13 solr solrj solr4

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

aru*_*run 11

看起来您正在将数据批量导入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>
Run Code Online (Sandbox Code Playgroud)

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

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

你与你的批量导入完成后也,减少maxTimemaxDocs,因此,任何增量的帖子,你会做的Solr将得到承诺更快.或者commitWithin像solrconfig中提到的那样使用.