Scaling Prometheus with Grafana Agent and Remote Write to a Scalable TSDB

Prometheus is excellent for short-term, single-node monitoring, but when you need long-term retention, global querying, or to support hundreds of clusters, the standard single-server model starts to break down. A modern, battle-tested pattern is: keep Prometheus (or a lightweight agent) for scraping, use remote_write to ship metrics, and store/query them in a horizontally scalable Prometheus-compatible TSDB such as Grafana Mimir. This article explains the why, the architecture, configuration examples, and practical best practices for making that pattern work reliably. (grafana.com)

Why move beyond standalone Prometheus?

Standalone Prometheus is optimized for local scraping and fast queries over a limited retention window. At larger scale you run into operational pain points:

A remote_write architecture decouples scraping from long-term storage: Prometheus or a lightweight agent scrapes, batches samples, and sends them to a scalable backend that can horizontally scale, replicate, and index time-series for long-term queries. Grafana Mimir is an example of a modern, multi-tenant TSDB designed for that purpose. (grafana.com)

Grafana Agent’s role

Grafana Agent is a remote_write-focused Prometheus-compatible agent that sits between scrapers (or acts as a scraper) and the remote store. It offers features suited for production remote_write pipelines:

Using Grafana Agent (or Prometheus configured for remote_write) keeps local Prometheus instances slim: short local retention for fast debugging plus reliable forwarding to the central store.

High-level architecture

This pattern gives you centralized querying and retention without forcing every Prometheus server to host years of data locally. Modern backends like Mimir also support OpenTelemetry metrics and are optimized for cost and query performance at scale. (grafana.com)

Minimal config examples

Prometheus (prometheus.yml) — remote_write stanza

global:
  scrape_interval: 15s

remote_write:
  - url: "https://mimir.example.com/api/v1/push"
    # add authentication headers or basic auth as required
    # remote_timeout, queue_config, and tls_config can be tuned
    queue_config:
      capacity: 10000
      max_shards: 200

Grafana Agent (agent.yaml) — prometheus.remote_write component

prometheus:
  wal_directory: /tmp/grafana-agent-wal
  remote_write:
    - url: "https://mimir.example.com/api/v1/push"
      send_batch_size: 1000
      batch_send_deadline: 5s
      timeout: 30s

These snippets illustrate the key pieces: the remote_write destination and a WAL-enabled agent for durability. Exact fields and names can vary between Grafana Agent and Prometheus; consult component docs for specifics. (grafana.com)

Practical tuning and best practices

Monitoring the pipeline

Treat the pipeline itself as an observability target:

These operational metrics let you detect problems early (for example, a consistently growing samples_pending is a clear sign the remote endpoint is overloaded). (prometheus.io)

Querying and dashboards

Once metrics are centralized, dashboards and alerting can move from per-cluster Prometheus to a single Grafana connected to the scalable TSDB. This simplifies long-range queries (e.g., 3–12 months) and cross-cluster comparisons, and it centralizes alert routing and templating.

Remember: running large-range queries is heavier than short-term ones. Use downsampling (if supported by the backend), query time windows, and dashboard panels that avoid asking for massive ranges on every refresh.

Caveats and trade-offs

Why this pattern is relevant now

Recent iterations of Grafana Mimir and agent tooling have focused on reliability and scale, making remote_write pipelines easier to run in production. Modern Mimir architectures emphasize performance, multi-tenancy, and native support for both Prometheus and OpenTelemetry metrics, while Grafana Agent provides WAL-backed reliably batching for remote_write use cases. Together, they make centralized, long-term Prometheus-compatible monitoring practical for large environments. (grafana.com)

Conclusion

For teams that outgrow single-node Prometheus, adopting a remote_write pipeline with Grafana Agent and a scalable TSDB delivers centralization, long retention, and global querying without sacrificing local scrape performance. The pattern pairs a low-footprint scraper/agent with a purpose-built backend that can scale horizontally, and it is supported by recent improvements in both agent behavior and backend architectures. Treat the pipeline as an observable system, tune buffering and batching to your environment, and control cardinality early to keep costs and query performance manageable. (prometheus.io)