prometheusPrometheus

prometheus 查询长时间段数据时oom问题

2019-05-24  本文已影响4人  火头陀

问题描述

单一label的metric浏览长时间数据面板时(比如1周)查询失败并且导致prometheus oom

排障思路

思路落地

数据抽样

搜索grafana文档发下如下配置


image.png

参考文献:https://grafana.com/docs/features/datasources/prometheus/#query-editor

当查询到的样本数据量非常大时可以导致Grafana渲染图标时出现一些性能问题,通过Min Step可以控制Prometheus查询数据时的最小步长(Step),从而减少从Prometheus返回的数据量。
Resolution选项,则可以控制Grafana自身渲染的数据量。例如,如果Resolution的值为1/10,Grafana会将Prometeus返回的10个样本数据合并成一个点。因此Resolution越小可视化的精确性越高,反之,可视化的精度越低。

参考文献:https://yunlzheng.gitbook.io/prometheus-book/part-ii-prometheus-jin-jie/grafana/grafana-panels


URL query parameters:

参考文献:https://prometheus.io/docs/prometheus/2.7/querying/api/


限制内存使用以避免oom

从帮助文档里发现--query.max-samples=50000000 即:默认最多加载50000000 samples, 如超过此限制会拒绝query, 因此可根据机器内存合理配置此数值保证不会oom
ps: prometheus version:2.7.1

./prometheus --help
usage: prometheus [<flags>]
      --query.max-samples=50000000 Maximum number of samples a single query can load into memory. Note that queries will fail if they would load more samples than this into memory, so this also limits the number of samples a query can return.

参考文献:./prometheus --help

上一篇下一篇

猜你喜欢

热点阅读