You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Prometheus v2.41.0内存持续上涨,咨询内存限制配置及是否正常

Prometheus v2.41.0内存占用异常问题求助

环境与配置

通过kube-prometheus-stack Helm Chart安装Prometheus v2.41.0,使用的配置如下:

prometheus:
  prometheusSpec:
    retention: 30d
    retentionSize: 49GiB
    storageSpec:
      volumeClaimTemplate:
        spec:
          resources:
            requests:
              storage: 50Gi

运行现象

  • 内存使用:运行数天后内存持续上涨,无停止趋势,认为无需将所有数据一直驻留内存,希望了解可限制内存占用的配置项。
  • PVC存储:占用量约为内存的两倍,符合预期。
  • pprof堆数据:
Fetching profile over HTTP from http://localhost:55947/debug/pprof/heap
File: prometheus
Type: inuse_space
Time: Jun 12, 2023 at 2:54pm (CEST)
Entering interactive mode (type "help" for commands, "o" for options)
(pprof) top
Showing nodes accounting for 216MB, 69.80% of 309.47MB total
Dropped 147 nodes (cum <= 1.55MB)
Showing top 10 nodes out of 135
      flat  flat%   sum%        cum   cum%
   58.55MB 18.92% 18.92%    58.55MB 18.92%  github.com/prometheus/prometheus/model/labels.(*Builder).Labels
   39.97MB 12.92% 31.84%    39.97MB 12.92%  github.com/prometheus/prometheus/scrape.newScrapePool.func1
   24.51MB  7.92% 39.76%    24.51MB  7.92%  github.com/prometheus/prometheus/model/textparse.(*PromParser).Metric
      23MB  7.43% 47.19%       31MB 10.02%  github.com/prometheus/prometheus/tsdb.newMemSeries
   17.50MB  5.66% 52.84%    17.50MB  5.66%  github.com/prometheus/prometheus/tsdb/chunkenc.NewXORChunk
   12.50MB  4.04% 56.88%    18.02MB  5.82%  github.com/prometheus/prometheus/tsdb.(*memSeries).mmapCurrentHeadChunk
   11.83MB  3.82% 60.71%    11.83MB  3.82%  github.com/prometheus/prometheus/scrape.(*scrapeCache).trackStaleness
   10.51MB  3.39% 64.10%    10.51MB  3.39%  github.com/prometheus/prometheus/tsdb/chunkenc.(*bstream).writeByte
    8.84MB  2.86% 66.96%     8.84MB  2.86%  github.com/prometheus/prometheus/scrape.(*scrapeCache).addRef
    8.79MB  2.84% 69.80%     8.79MB  2.84%  github.com/golang/snappy.Encode
  • TSDB数据:数据表现符合对应监控图表展示的状态。

疑问

pprof显示堆内存仅使用309MB,但实际进程内存占用达3-4GB,对此感到困惑。请问这是Prometheus的正常表现吗?是否有办法限制其内存需求?此前查找过类似问题,但未找到合适的解决方案。

内容的提问来源于stack exchange,提问作者vitas-pm

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 12:43:17