Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Thanos - Prometheus at Scale (OS Summit EU)

Bartek
October 22, 2018

Thanos - Prometheus at Scale (OS Summit EU)

https://osseu18.sched.com/event/FxWY/bof-thanos-high-availability-and-long-term-storage-of-prometheus-metrics-bartek-plotka-improbable

Prometheus has been thriving for several years. However, some questions were still largely unaddressed to this day. How can we store historical data at the order of petabytes in a reliable and cost-efficient way? Can we do so without sacrificing responsive query times? And what about a global view of all our metrics and transparent handling of HA setups?

Thanos takes Prometheus' strong foundations and extends it into a clustered, yet coordination free, globally scalable metric system. It retains Prometheus’s simple operational model and even simplifies deployments further. Under the hood, Thanos uses highly cost-efficient object storage that’s available in virtually all environments today. By building directly on top of the storage format introduced with Prometheus 2.0, Thanos achieves near real-time responsiveness even for cold queries against historical data.

Bartek

October 22, 2018
Tweet

More Decks by Bartek

Other Decks in Technology

Transcript

  1. 310 Founded: Games in Development: +19 2012 Employees: "Improbable’s platform,

    SpatialOS, is designed to let anyone build massive simulations, running in the cloud: imagine Minecraft with thousands of players in the same space or researchers creating simulated cities to model the behaviour of millions. Its ultimate goal: to create totally immersive, persistent virtual worlds." - WIRED, May 2017
  2. @bwplotka Prometheus Query Engine Scrape Engine Compactor Rule & Alert

    Engine Prometheus Service X Service X Services /metrics every 15s HTTP Query API Grafana Alertmanager Local storage
  3. @bwplotka Cluster Single Prometheus Prometheus Grafana Alertmanager Workloads you want

    to monitor 200 000 samples / sec = 1 CPU, 13 GB RAM = 3 mln series with 15s scrape interval.
  4. @bwplotka go_memstats_alloc_bytes_total{..., replica=A) Problem: Global View + HA Prometheus Prometheus

    go_memstats_alloc_bytes_total{..., replica=B) go_memstats_alloc_bytes_total{...} [deduplicated]
  5. @bwplotka Thanos Goals • Have a global view • Have

    a HA in place • Increase retention
  6. @bwplotka Store API service Store { rpc Series(SeriesRequest) returns (stream

    SeriesResponse); rpc LabelNames(LabelNamesRequest) returns (LabelNamesResponse); rpc LabelValues(LabelValuesRequest) returns (LabelValuesResponse); } message SeriesRequest { int64 min_time = 1; int64 max_time = 2; repeated LabelMatcher matchers = 3; } Sidecar Prometheus remote read Store API
  7. @bwplotka SSD Global View + Availability Prometheus Sidecar Targets SSD

    Sidecar Targets Prometheus SSD Sidecar Prometheus “replica”:”A” “replica”:”B” Querier Merge Deduplicate Store API
  8. @bwplotka Thanos Goals • Have a global view ✓ •

    Have a HA in place ✓ Prometheus Sidecar SSD Sidecar Prometheus Sidecar Prometheus Querier
  9. @bwplotka TSDB Layout Block 4 Block 3 Block 1 chunks

    chunks chunks chunks index T-10h T-16h T-4h T-2h T
  10. @bwplotka SSD Data saving Prometheus Sidecar Targets Object Storage Blocks

    Blocks Block --storage.tsdb.max-block-duration=2h --storage.tsdb.retention=12h
  11. @bwplotka Downsampling Decompressing one sample takes 10-40 nanoseconds. Decompressing 1000

    series @ 30s scrape interval for 1 year data takes 10-40 seconds alone. Plus your actual computation over all those samples, e.g. rate()
  12. @bwplotka Thanos Goals • Have a global view ✓ •

    Have a HA in place ✓ • Increase retention ✓
  13. @bwplotka Thanos Compactor Rule & Alert Engine Thanos Querier Thanos

    Querier Thanos Querier SSD Prometheus Sidecar SSD Prometheus Sidecar SSD Prometheus Sidecar
  14. @bwplotka Thanos Compactor Thanos Querier Thanos Querier Thanos Querier SSD

    Prometheus Sidecar SSD Prometheus Sidecar SSD Prometheus Sidecar Thanos Ruler Thanos Ruler
  15. @bwplotka Thanos Thanos Ruler Thanos Ruler Thanos Querier Thanos Querier

    Thanos Querier SSD Prometheus Sidecar SSD Prometheus Sidecar SSD Prometheus Sidecar Global Compactor
  16. @bwplotka Thanos Store Gateway Store Gateway Object Storage SSD Prometheus

    Sidecar SSD Prometheus Sidecar SSD Prometheus Sidecar Thanos Ruler Thanos Ruler Global Compactor Thanos Querier Thanos Querier Thanos Querier
  17. @bwplotka Example Deployment Cluster 1 Cluster 2 + Cluster n

    Cluster n+1 + ... + Monitoring Cluster Grafana Alertmanager Bucket Compactor Querier Querier Querier Ruler Store Statically configured / global discovery + + +
  18. @bwplotka Avoid magic: Gossip example • Easy to misconfigure •

    Hard to debug • Difficult cross cluster setup • Over-complicated for Thanos needs
  19. @bwplotka Thanos Goals • Have a global view ✓ •

    Have a HA in place ✓ • Increase retention ✓ • Join effort with community ✓
  20. @bwplotka Summary • Start small with just single Prometheus. •

    Extend your setup gradually. ◦ Just global querier. ◦ Federated global querier. ◦ Object storage. • Model your Thanos deployment. Generally: Share early, keep project focused and simple.
  21. github.com/improbable-eng/thanos Bartek Płotka @bwplotka improbable.io ...psst, join our slack workspace

    for more info! Credits: • Percona blog post about Prometheus 2 perf • Emojis designed by Freepik from Flaticon