随笔 - 41  文章 - 29  trackbacks - 0
<2008年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

常用链接

留言簿(5)

随笔分类(28)

随笔档案(23)

收藏夹(6)

Inside JVM

Java

java performance

Solr

搜索

  •  

最新评论

阅读排行榜

评论排行榜

This article is to explain how solr cache works.

Please also refer to http://wiki.apache.org/solr/SolrCaching.

How does cache works? When does it expire?

Solr caches are associated with an Index Searcher — a particular ‘view’ of the index that doesn’t change. So as long as that Index Searcher is being used, any items in the cache will be valid and available for reuse. Caching in Solr is unlike ordinary caches in that Solr cached objects will not expire after a certain period of time; rather, cached objects will be valid as long as the Index Searcher is valid.

How does a new index searcher start to work?

The current Index Searcher serves requests and when a new searcher is opened, the new one is auto-warmed while the current one is still serving external requests. When the new one is ready, it will be registered as the current searcher and will handle any new search requests. The old searcher will be closed after all request it was servicing finish. The current Searcher is used as the source of auto-warming. When a new searcher is opened, its caches may be prepopulated or “autowarmed” using data from caches in the old searcher.


Cache Type Filter Cache Query Result Cache Document Cache
Description This cache stores unordered sets of document IDs This cache stores ordered sets of document IDs — results of a query ordered by some criteria. The documentCache stores Lucene Document objects that have been fetched from disk.
Key basic query, filter query treated as different keys org.apache.solr.search.QueryResultKey, including basic query, sort fields, filter(as a Query object), and nc_flags Solr Doc Unique Id
Value org.apache.solr.search.HashDocSet org.apache.solr.search.DocSlice doc
Purpose First, the filter cache stores the results of any filter queries (“fq” parameters) that Solr is explicitly asked to execute. (Each filter is executed and cached separately. When it’s time to use them to limit the number of results returned by a query, this is done using set intersections.) for the same query, no need execute query again no need fetch from disk again, if it is already in cache
Purpose2 Second, the filter cache is used for faceting in some cases. (In particular, when the TermEnum method is used, a filterCache entry is added for each term tested.) N/A N/A
Purpose3 Finally, the filter cache may be used for sorting if the config option is set to true in solfconfig.xml. N/A N/A
queryResultWindowSize impact to cache N/A When a search is requested, a superset of the requested number of document ids are collected. For example, of a search for a particular query requests matching documents 10 through 19, and queryWindowSize is 50, then documents 0 through 50 will be collected and cached. Any further requests in that range can be satisfied via the cache. N/A
posted on 2008-11-11 15:05 Justin Chen 阅读(1699) 评论(0)  编辑  收藏 所属分类: Solr

只有注册用户登录后才能发表评论。


网站导航: