Skip to main content
Latency Waterfall
p50 · p90 · p99 · p99.9 per hop

Metrics Platform: Latency Waterfall

Break down end-to-end latency by hop and percentile. Understand where the p99 tail comes from — DNS, network, cache lookup, database query, serialization. Real requests have wildly different paths depending on cache-hit location.

Back to Metrics Platform

Latency Waterfall

Break down end-to-end latency by hop (network, application, database, cache) and percentile (p50/p90/p99/p99.9). Real requests have wildly different paths depending on cache-hit location — pick a scenario to see the full waterfall.

Amara Google 2009: every 100ms of latency = 1% revenue lost. Understanding WHERE the tail comes from is the difference between random optimization and targeted engineering.

Show percentile:
Aggregate p99: 375.0 ms

Metric scrape — Prometheus polling (100% of ingest)

Prometheus scrapes /metrics endpoint every 15s.

100% of requests
Prometheus → target /metrics
network
40.0 ms
p50 5msp90 15msp99 40msp99.9 150ms

HTTP GET to /metrics.

Target: emit metrics (in-process counter/gauge/histogram)
application
10.0 ms
p50 1msp90 3msp99 10msp99.9 40ms

Serialize + return.

Prometheus: parse + append to TSDB
database
25.0 ms
p50 3msp90 8msp99 25msp99.9 80ms

Time-series append.

Async: forward to M3DB long-term
queue
300.0 ms
p50 30msp90 100msp99 300msp99.9 1000ms

Remote write to M3DB.

End-to-end aggregate
p50 39.0 ms
p90 126.0 ms
p99 375.0 ms
p99.9 1270.0 ms
Key insight

Scrape is **~50-500ms end-to-end**. Async replication to long-term. 15s scrape interval balances freshness + cost.

Scenario 1 of 3

Bottleneck summary

Metrics platform latency: **ingest ~50-500ms (scrape + append)**, **query ~100ms-2s (cardinality-bounded)**, **alert evaluation ~500ms**. Cardinality is #1 cost + latency factor. High-cardinality labels (user_id) cause explosion. **The critical trade**: retention length + resolution + cardinality bound cost + query performance.

Optimization tips (this architecture)

  • **Cardinality limits per team**: Prevent explosion. 100K series max per team.
  • **Precompute aggregates**: Common queries cached. 10x faster.
  • **Time-range indices**: Only scan relevant time.
  • **M3DB for high-cardinality**: Purpose-built. Scales to 100M+ series.
  • **AI anomaly detection**: Replaces static thresholds. 60% fewer false-positives.
  • **15s scrape interval**: Standard. Higher = missed spikes. Lower = 2x cost.
  • **Histograms for percentiles**: t-digest, HDR-histogram. Accurate p99.
  • **Long-term storage tiers**: 30d hot + 1y warm + 5y cold.

Where to go next

Now that you can see where latency comes from, trace how the architecture EVOLVES to handle 10x more traffic. Or dive into the masterclass for the full ADR + business exercise + incident narrative.