DEBUG.WIKI
阿里云;从建站到云上业务;云服务器 · 数据库 · 对象存储;查看产品 →
PanstarCloud:部署应用,接入 AI,云服务器与 AI 网关
IPPeak:从目标地区访问网页,住宅代理、SEO 监测、广告验证

解决 Prometheus 报错 remote_write resend buffer is full 故障

分析 Prometheus 远程存储推送报 resend buffer is full 诱因,详解 max_backoff、分片扩容与采样点丢弃排查方案。

问题现象

Prometheus 远程推流日志中持续输出警告,部分监控采样点丢失:

ts=2026-11-15T10:40:00.123Z caller=dedup.go:150 component=remote level=warn remote_name=remote-vm msg="Resend buffer is full, dropping samples" num_samples=8192

监控指标 prometheus_remote_storage_dropped_samples_total 呈现阶梯状上升。

触发根因

  1. 远端写入接口短时间抖动或限流导致重试积压:重试队列中的样本数量超过了 capacity 缓冲区容纳上限。
  2. Prometheus 单分片最大并发处理能力受限:max_shards 设置过小,无法快速消费重试队列。

诊断排查步骤

  1. 检查远端存储(如 VictoriaMetrics / Mimir)的响应延迟与错误状态:
curl -s http://127.0.0.1:9090/metrics | grep "prometheus_remote_storage_sent_batch_duration_seconds"

解决步骤与操作命令

步骤一:调大重试与暂存缓冲区容量

在 prometheus.yml 的 remote_write 中优化:

remote_write:
  - url: "http://remote-storage:8428/api/v1/write"
    queue_config:
      capacity: 100000           # 扩大重试缓冲区容量
      max_shards: 200            # 提升最大并发发送分片
      min_shards: 32             # 提高保底分片
      max_samples_per_send: 5000
      batch_send_deadline: 2s
      min_backoff: 50ms
      max_backoff: 2s

步骤二:热重载 Prometheus 服务

curl -X POST http://127.0.0.1:9090/-/reload

验证方法

监控指标丢弃情况: prometheus_remote_storage_dropped_samples_total 停止上升,队列平稳消化无延迟。