您的位置:首页 > 其它

ElasticSearch性能优化

2016-12-28 11:45 281 查看

1. 亿级规模的ES查询优化实战

能用filter就不用query

filter拿到相应的doc后不计算score不用排序

query会对符合条件的doc计算score并进行排序

filter的查询速度比query快很多

2. 增加相关cache的配置

indices.cache.filter.size: 30%

indices.fielddata.cache.size: 60%

index.cache.field.type: soft

indices.breaker.fielddata.limit: 70%

3. 优化方案——总结

能用filter就不用query

增加冗余字段将部分range aggregation查询变成terms aggregation

为常用字段增加配置,将fielddata的loading设成eager,尽量多加载到内存

增加集群的缓存资源,把内存尽量多的用起来

Global ordinals

Index warmer

调整aggregation的collect_mode

上SSD

elasticsearch一些使用经验以及优化方法

Elasticsearch索引速度优化

index.refresh_interval :-1

index.number_of_shards : X

index.number_of_replicas : 0

index.translog.sync_interval : 30s

index.translog.durability : “async”

index.translog.flush_threshold_size: 4g

index.translog.flush_threshold_ops: 50000

其它

去掉_all字段可节省一半空间

开启索引压缩可
4000
节省空间,但会有10%-20%的性能损耗

不需分词的字符串字段设成not_analyzed
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: