我们什么时候应该在 SOLR 中应用硬提交和软提交? [英] When should we apply Hard commit and Soft commit in SOLR?

查看:22
本文介绍了我们什么时候应该在 SOLR 中应用硬提交和软提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在 SOLR 中我们什么时候应该做硬提交,什么时候应该做软提交.

I want to know when we should do hard commit and when we should do soft commit in SOLR.

谢谢

推荐答案

与您刚刚提出但已删除的问题相同,互联网上对此进行了彻底解释:

当您希望某些内容尽快可用而无需等待将其写入磁盘时,软提交.当你想确保它被持久化到磁盘时硬提交.

Soft commit when you want something to be made available as soon as possible without waiting for it to be written to disk. Hard commit when you want make sure its being persisted to disk.

来自上面的链接:

软提交

软提交是关于可见性,硬提交是关于持久性.最了解软提交的是它们将使文档可见,但需要付出一些代价.特别是顶级"缓存,包括您在 solrconfig.xml 中配置的内容(filterCache、queryResultCache 等)将失效!将在您的顶级缓存(例如 filterCache、queryResultCache)上执行自动预热,并且将执行任何 newSearcher 查询.此外,FieldValueCache 已失效,因此构面查询必须等到缓存刷新.对于非常频繁的软提交,通常情况下您的顶级缓存很少使用,并且在某些情况下可能会被消除.但是,用于函数查询、排序等的段级缓存"是按段"的,因此不会在软提交时失效;它们可以继续使用.

Soft commits are about visibility, hard commits are about durability. The thing to understand most about soft commits are that they will make documents visible, but at some cost. In particular the "top level" caches, which include what you configure in solrconfig.xml (filterCache, queryResultCache, etc) will be invalidated! Autowarming will be performed on your top level caches (e.g. filterCache, queryResultCache), and any newSearcher queries will be executed. Also, the FieldValueCache is invalidated, so facet queries will have to wait until the cache is refreshed. With very frequent soft commits it’s often the case that your top-level caches are little used and may, in some cases, be eliminated. However, "segment level caches", used for function queries, sorting, etc., are "per segment", so will not be invalidated on soft commit; they can continue to be used.

硬提交

硬提交关乎持久性,软提交关乎可见性.这里真的有两种风格,openSearcher=true 和 openSearcher=false.首先,我们将讨论在这两种情况下会发生什么.如果 openSearcher=true 或 openSearcher=false,以下后果最为重要:

Hard commits are about durability, soft commits are about visibility. There are really two flavors here, openSearcher=true and openSearcher=false. First we’ll talk about what happens in both cases. If openSearcher=true or openSearcher=false, the following consequences are most important:

  • tlog 被截断:一个新的 tlog 被启动.
  • 如果新的、关闭的 tlog 中有超过 100 个文档,旧的 tlog 将被删除.
  • 当前索引段已关闭并刷新.
  • 可以启动后台段合并.
  • 上述情况发生在所有硬提交上.

剩下的就是 openSearcher 设置

That leaves the openSearcher setting

  • openSearcher=true:重新打开 Solr/Lucene 搜索器,并且所有缓存都失效.自动预热完成等.这曾经是您查看新添加文档的唯一方式.
  • openSearcher=false:除了上述四点之外,没有进一步发生.要搜索文档,必须进行软提交.
  • openSearcher=true: The Solr/Lucene searchers are re-opened and all caches are invalidated. Autowarming is done etc. This used to be the only way you could see newly-added documents.
  • openSearcher=false: Nothing further happens other than the four points above. To search the docs, a soft commit is necessary.

这篇关于我们什么时候应该在 SOLR 中应用硬提交和软提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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