prometheus/prometheus

remote read: support sharding

オープン

#11,231 opened on 2022/08/30

 (2 件のコメント) (0 件のリアクション) (0 人の担当者)Go (10,408 件のフォーク)batch import
component/remote storagehelp wantedkind/featurepriority/P3

Repository metrics

Stars
 (64,042 個のスター)
PR merge metrics
 (平均マージ 11d 5h) (30d で 118 merged PRs)

説明

Thanos as of the latest version supports vertical query sharding (https://github.com/thanos-io/thanos/pull/5342, https://github.com/thanos-io/thanos/pull/5561). With Sidecar it is done at the Sidecar level i.e. Sidecar retrieves all of the metrics matching the selectors from Prometheus via the remote read interface and then filters out unneeded metrics according to the given shard info. In essence, this means that the amount of data retrieved from Prometheus increases by N where N is the number of shards. This is not ideal on bigger queries because there are a lot of allocations that are immediately freed.

We actually have had an incident where OOM killer killed Prometheus on nodes that have Prometheus+Sidecar running. During one query, RAM usage shot up high, and then OOM killer killed Prometheus as it used the most RAM on that machine.

I propose moving the sharding functionality into the Prometheus remote read interface. I'm not sure but I think that Thanos Sidecar mostly uses that interface so perhaps there wouldn't be any opposition to this?

It should be pretty straightforward - we want to be able to tell Prometheus to only give us X/N of the matching series where X is the shard number and N is the shard count. What do you think?

コントリビューターガイド