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

[经验分享] Solr Configuration Best Practices and Troubleshooting Tips

[复制链接]

尚未签到

发表于 2015-7-17 10:01:40 | 显示全部楼层 |阅读模式
  https://support.datastax.com/entries/38367716-Solr-Configuration-Best-Practices-and-Troubleshooting-Tips
  
Configuration Best Practices
  (Straying from these recommendations is the root cause of 90% of issues)
  Hardware

  • Provide as much memory as you can afford
  • Use SSDs if possible

    • If using mechanical disks, setup at least 4 volumes with a set of dedicated heads for each: OS, commit log, SSTables, Solr data
    • If using SSDs you can choose either RAID10 or JBOD

  • Additional cores are helpful because it will increase query/indexing throughput
  Hardware/Cluster Sizing

  • Setup DSE with Solr enabled
  • Create a CF with the proposed schema and configurations
  • Load one thousand mock/sample records
  • Get the index size for the Solr core: http://localhost:8983/solr/admin/cores?action=STATUS&memory=true
  • Extrapolate from those numbers the index size for the expected total record count
  Example
If your index size is 1GB, and you expect one million records then your index size will be 1000GB. Your cluster must be large enough so that the total cluster memory is large enough to cache the total index size, and hot dataset, subtracting for the JVM heap and OS overhead. Assume 1GB of memory for the OS and 14 GB of memory for the JVM heap, or an overhead of 15GB.
Sizing Equation
((Nodes * Memory Per Node) - (15GB * Nodes)) / (Index Size * (Expected Rows / 1000))

  • If the value is less than 1 then you can expect problems. You won’t have enough memory to cache the index, let alone cache the rows. Every query will hit the disk multiple times
  JVM Heap

  • Set the heap to 14G
  • Set the new heap to 100mb per core with a max of 800mb
  Row Cache & Key Cache

  • Disable the row cache
  • Leave the key cache at default values unless load testing dictates otherwise
  
SolrConfig.xml Recommendations (See attached example)
  Soft Commit Threshold

  • Set the soft autocommit max time to 10s. This is the maximum amount of time between a document being inserted and it entering the queue to be indexed. Only after it’s been indexed will the document become visible to queries
  • If you can tolerate a larger value feel free to increase
  • This is one of the most effective knobs you have
  Filter Cache

  • DSE 3.1 uses a custom per-segment filter implementation which uses the filter cache
  • The filter cache is the only meaningful cache, all others should be disabled
  • Start with a filter cache setting of 256; 512 is often too big for a 14G heap and will cause GC pressure
  • Don’t enable auto warming unless you have frequently used filters
  Document and Query Cache

  • Document and query result caches are disabled. They were flushed with every soft commit so they were mostly useless except for read-only use cases
  Merge Factor

  • Merge factor of 10. This is a good compromise value, for read only use cases you might lower this value to 5 or 2, for write heavy or balanced use cases leave it at 10
  Lucene Version

  • Set the Lucene version to the most recent version supported by the release, this is currently LUCENE_43
  • If this value is changed the index should be rebuilt
  DSE Type Mapping

  • Set the type mapping to the most recent version supported by the release, this is currently 1
  • If this value is changed the Solr metadata must be removed from the CF, and Solr must be re-enabled
  • Don’t ever change this value if at all possible
  Schema.xml Recommendations
  The guide to the Solr schema can be found here. There is too much to cover in this document, instead we're going to focus on tips and tricks.
  Schema Version

  • The schema version is defined in the root node of the XML document
  • Avoid specifying a schema version if possible
  • if you specify an older version it will most likely result in undesirable behavior
  • For example, if you specify “1.0” all fields are multi-valued by default
  Dynamic Fields

  • Avoid or limit the use of dynamic fields
  • Lucene allocates memory for each unique field (column) name
  • This means if you have a row with columns A,B,C, and another row with B, D, E, Lucene will allocate 5 chunks of memory
  • Do this for millions of rows, and it’s fairly easy to blow the heap
  • CopyField Directive: Instead of using dynamic fields you can copy field contents using the CopyField directive, and then perform queries against the combined field
  • FieldInputTransformer: In the same vein as the CopyField directive there is an interface that you can implement which allows for the interception of a document (row), prior to indexing and rewrite columns
Troubleshooting
  GC pressure, frequent garbage collections

  • Heap is too small, or caches are too big. See recommended setup
  Slow Queries

  • Slow is relative. Results in 20ms or less is considered good. Less than 10ms is very good. Under load with large datasets it’s not uncommon to see latencies of 100ms to 200ms.
  • Common causes for slow queries include:

    • Disk/file system is laid out incorrectly
    • Not enough memory to cache Solr index files and hot dataset

      • Check IOwait metrics in top/vmstat/iostat.

    • GC pressure can result in high latency variance
    • Double check your queries

  Poor Indexing Performance

  • If you have small document (row) sizes, have a high indexing throughput use case, and experience a slowdown in indexing performance over time then decrease the SSTable size

    • After a document is indexed it goes into the docsPending queue, and is eventually flushed when the memtable is flushed to disk
    • If the documents are small, then the time between flushes for an SSTable can be large causing the docsPending queue to grow resulting in an indexing performance degradation

  Slow Startup Times

  • Decrease the commit log/sstable size as Data replayed via the commit log must be re-indexed
  Inconsistent Query Results

  • If you are seeing data inconsistency be sure to run repairs regularly (within GC grace)
  Repair Causing High System Load

  • Using OpsCenter 4.0 new range repair service will likely improve this
  Dropped Mutations

  • If you are seeing consistently dropped mutations and you've followed all other recommendations here, the system load is probably too high for the hardware/cluster size. Upgrading hardware or adding additional nodes will alleviate dropped mutations
  Read/Socket Timeout

  • Decrease max_solr_concurrency_per_core in dse.yaml to 1 per CPU core
  Out Memory Errors


    • There can be several root causes to this problem
    • The most common are:

      • heap size set too low
      • cache sizes set too large
      • heavy use of dynamic fields



运维网声明 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-87554-1-1.html 上篇帖子: Solr与tomcat整合,并添加中文分词器 下篇帖子: django全文搜索学习心得(二)solr 篇
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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