ElasticSearch性能优化

来源:互联网 发布:淘宝直播申请入口关闭 编辑:程序博客网 时间:2024/06/05 19:47

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

  1. 能用filter就不用query
  2. filter拿到相应的doc后不计算score不用排序
  3. query会对符合条件的doc计算score并进行排序
  4. filter的查询速度比query快很多

2. 增加相关cache的配置

  1. indices.cache.filter.size: 30%
  2. indices.fielddata.cache.size: 60%
  3. index.cache.field.type: soft
  4. indices.breaker.fielddata.limit: 70%

3. 优化方案——总结

  1. 能用filter就不用query
  2. 增加冗余字段将部分range aggregation查询变成terms aggregation
  3. 为常用字段增加配置,将fielddata的loading设成eager,尽量多加载到内存
  4. 增加集群的缓存资源,把内存尽量多的用起来
    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字段可节省一半空间
开启索引压缩可节省空间,但会有10%-20%的性能损耗
不需分词的字符串字段设成not_analyzed

1 0
原创粉丝点击