Elasticsearch调优篇-慢查询分析笔记

2020-01-08  本文已影响0人  独行侠梦

前言

慢查询现象

查询服务超时
大量连接被拒绝
file
查询延迟
主机CPU飙高
file file
优化方法
根据查询时间段动态计算索引
控制分片数量
注意from/to查询带来的深度分页问题
为你的索引配置索引模板
file
避免数据分桶太多

对于分桶数量太大的聚合请求,应该将所有数据切片,比如按时间分片,多次请求,来提高查询效率,并且避免内存OOM。

独立协调节点
Routing数据路由
适当的增加刷新间隔
配置慢查询日志
index.search.slowlog.threshold.query.warn: 10s
index.search.slowlog.threshold.query.info: 5s
index.search.slowlog.threshold.query.debug: 2s
index.search.slowlog.threshold.query.trace: 500ms

index.search.slowlog.threshold.fetch.warn: 1s
index.search.slowlog.threshold.fetch.info: 800ms
index.search.slowlog.threshold.fetch.debug: 500ms
index.search.slowlog.threshold.fetch.trace: 200ms

index.search.slowlog.level: info
配置熔断策略

indices.breaker.request.limit:请求中断的限制,默认为JVM堆的60%。

indices.breaker.total.limit:总体父中断程序的启动限制,如果indices.breaker.total.use_real_memory为,则默认为JVM堆的70% false。如果indices.breaker.total.use_real_memory 为true,则默认为JVM堆的95%。

network.breaker.inflight requests.limit 限制当前通过HTTP等进来的请求使用内存不能超过Node内存的指定值。这个内存主要是限制请求内容的长度。 默认100%。

script.max_compilations_rate:在允许的时间间隔内限制动态脚本的并发执行数量。默认值为75 / 5m,即每5分钟75。

欢迎来公众号【侠梦的开发笔记】 一起交流进步

上一篇下一篇

猜你喜欢

热点阅读