设为首页 收藏本站
查看: 933|回复: 0

[经验分享] Solr: Configuring Solr

[复制链接]

尚未签到

发表于 2016-12-14 08:15:00 | 显示全部楼层 |阅读模式
  
DSC0000.png
  DSC0001.png
 
  
DSC0002.png
 
DSC0003.png
 
DSC0004.png
 
  
DSC0005.png
 
--------------------------------------------------------------------------------------------------------------------------------------
Query request handling

  
DSC0006.png
 
DSC0007.png
 
DSC0008.png
------------------------------------------------------------------------------------------------------------------------------------
Managing searchers

  In Solr, queries are processed by a component called a searcher. There is only one “active” searcher in Solr at any given time. All query components for all search request handlers execute queries against the active searcher.
  The active searcher has a read-only view of a snapshot of the underlying Lucene index. It follows that if you add a new document to Solr, then it is not visible in search results from the current searcher. This raises the question: How do new documents become visible in search results? The answer is to close the current searcher and open a new one that has a read-only view of the updated index. A commit creates a new searcher to make new documents and updates visible. 
  Because precomputed data, such as a cached query result set, must be invalidated and recomputed, it stands to reason that opening a new searcher on your index is potentially an expensive operation. This can have a direct impact on user experience.Solr supports the concept of warming a new searcher in the back-ground and keeping the current searcher active until the new one is fully warmed.
  --------------------------------------------------------------------------------------------------------------------------------------
Cache management

  Cache fundamentals
  There are four main concerns when working with Solr caches:


  • Cache sizing and eviction policy
  • Hit ratio and evictions
  • Cached-object invalidation
  • Autowarming new caches
  Filter cache
  In Solr, a filter restricts search results to documents that meet the filter criteria, but it does not affect scoring.Autowarming the filter cache requires Solr to re-execute the filter query with the new searcher. Consequently,autowarming the filter cache can be a source of performance and resource utilization problems in Solr.
  
DSC0009.png
 

  
DSC00010.png
Query result cache

  The query result cache holds result sets for a query. If you execute a query  more than once, subsequent results are served from the query result cache,rather than re-executing the same query against the index.

<queryResultCache class="solr.LRUCache"
size="512"
initialSize="512"
autowarmCount="0"/>



  • QUERY RESULT WINDOW SIZE
  Imagine your application shows 10 documents per page and in most cases your users only look at the first and second pages. You can set <queryResultWindowSize> to 20 to avoid having to re-execute the query to retrieve the second page of results.


  • QUERY RESULT MAX DOCS CACHED
  You have to set a maximum size for Solr caches; but this doesn’t affect the size of each individual entry in the cache. As you can imagine, a result set holding millions of documents in the cache would greatly impact available memory in Solr. The <queryResultMaxDocsCached> element allows you to limit the
number of documents cached for each entry in the query result cache. Users only look at the first couple of pages in most search applications, so you should generally set this to no more than two or three times the page size.


  • ENABLE LAZY FIELD LOADING
  A common design pattern in Solr is to have a query return a subset of fields for each document. For instance, in our example query, we requested the name,price, features, and score fields. But the documents in the index have many more fields, such as category, popularity, manufacturedate, and so forth. If your application adopts this common design pattern, you may want to set <enableLazyFieldLoading> to true to avoid loading unwanted fields.
  Document cache
  The query result cache holds a list of internal document IDs that match a query, so even if the query results are cached, Solr still needs to load the documents from disk to produce search results. The document cache is used to store documents loaded from disk in memory keyed by their internal document IDs. It follows that the query result cache uses the document cache to find cached versions of documents in the cached result set.
  
This raises the question of whether it makes sense to warm the document cache.There’s a good argument to be made against autowarming this cache, because there’s no way to ensure the documents you are warming have any relation to queries and filters being autowarmed from the query result and filter caches. If you are constantly indexing, and the documents a query returns are constantly changing, you could be spending time recreating documents that may not benefit your warmed filter and query result caches.  Onthe other hand, if most of your index is relatively static, the document cache may provide value.
  Field value cache
  The last cache we’ll mention is field value, which is strictly used by Lucene and is not managed by Solr. The field value cache provides fast access to stored field values by internal document ID. It is used during sorting and when building documents for the response.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-313918-1-1.html 上篇帖子: zookeeper solr 下篇帖子: solr传说-前言和solr简介,solr
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表