Schema Design Considerations(数据模型方面考虑)
indexed fields
indexed fields 的数量将会影响以下的一些性能:
索引时的时候的内存使用量
索引段的合并时间
优化时间
索引的大小
我们可以通过 将 omitNorms=“true” 来减少indexed fields数量增加所带来的影响。
stored fields
Retrieving the stored fields 确实是一种开销。这个开销,受每个文档所存储的字节影响很大。每个文档的所占用的空间越大,文档就显的更稀疏,这样从硬盘中读取数据,就需要更多的i/o操作(通常,我们在存储比较大的域的时候,就会考虑这样的事情,比如存储一篇文章的文档。)
可以考虑将比较大的域放到solr外面来存储。如果你觉得这样做会有些别扭的话,可以考虑使用压缩的域,但是这样会加重cpu在存储和读取域的时候的负担。不过这样却是可以较少i/0的负担。
如果,你并不是总是使用 stored fields 的话,可以使用stored field的延迟加载,这样可以节省很多的性能,尤其是使用compressed field 的时候。
Configuration Considerations(配置方面考虑)
mergeFactor
这个是合并因子,这个参数大概决定了segment(索引段)的数量。
合并因子这个值告诉lucene,在什么时候,要将几个segment合并成为一个segment, 合并因子就像是一个数字系统的基数一样。
比如说,如果你将合并因子设成10,那么每往索引中添加1000个文档的时候,就会创建一个新的索引段。当第10个大小为1000的索引段添加进来的时候,这十个索引段就会被合并成一个大小为10,000的索引段。当十个大小为10,000的索引段生成的时候,它们就会被合并成一个大小为100,000的索引段。如此类推下去。
Read full article from Solr中国 » Blog Archive » Solr Performance Factors(Solr 性能因素) - 【Solr教程|Solr安装|Solr配置|Solr优化|Solr资料】
No comments:
Post a Comment