ASAPQuery is a drop-in accelerator that reduces query latency by 100x. It sits between Prometheus and Grafana and accelerates repeating PromQL queries. ASAPQuery is compatible with the Prometheus query API and integrates seamlessly with existing Grafana dashboards.
This quickstart simulates a typical monitoring deployment with components you might already have:
- Exporters - generating metrics
- Prometheus - collecting metrics from exporters and storing them in a time-series database
- Grafana - send queries to Prometheus and visualizing query results
Then it adds ASAPQuery's components on top:
- Query Engine - Prometheus-compatible API with sketch-based acceleration and built-in precompute engine
- asap-planner-rs - Automatically configures sketches from PromQL queries
Once you run the quickstart, you will see a pre-configured Grafana dashboard that compares Prometheues and ASAPQuery side-by-side. You will see almost indistinguishable results from Prometheus and ASAPQuery, with ASAPQuery's dashboard refreshing much faster.
- Docker & Docker Compose v2.0+
- Ports available: 3000 (Grafana), 8088 (ASAPQuery query), 9091 (ASAPQuery ingest), 9090 (Prometheus)
cd asap-quickstart
docker compose up -dThe docker-compose pulls official Prometheus and Grafana images, and pre-built ASAPQuery images. After pulling these images, it runs scripts to configure these components. This may take a few minutes.
- Go to http://localhost:3000
- If prompted, login with:
admin/admin - Navigate to Dashboards → ASAPQuery Dashboards folder
- Open "ASAPQuery vs Prometheus Comparison"
The dashboard shows 4 rows, each with 2 columns. Each row shows the same query executing on ASAPQuery (left panel) and Prometheus (right panel).
The dashboard auto-refreshes every 10 seconds. You will notice:
- ASAPQuery dashboard panels (left side) refresh almost instantaneously
- Prometheus panels (right side) lag considerably after each dashboard refresh
For reference, here are the 4 queries, one per row:
- "quantile by (pattern) (0.99, sensor_reading)"
- "quantile by (pattern) (0.95, sensor_reading)"
- "quantile by (pattern) (0.90, sensor_reading)"
- "quantile by (pattern) (0.50, sensor_reading)"
Take a coffee break and come back after 5 minutes. By now, Prometheus will have loaded more data. Open the dashboard and you will see that:
- ASAPQuery dashboards (left side) still refresh almost instantaneously
- Prometheus queries (right side) are severly lagging (~5 seconds to refresh)
docker compose downTo change the cardinality of data exported by each exporter, use set_data_cardinality.py.
Run python3 set_data_cardinality.py <M> <N> where M is the number of labels (currently configured to 3) and N is the number of unique values per label (currently configured to 30). The script changes all the fake-exporter-* services in docker-compose.yml to have:
- "--num-labels=M" # Number of label dimensions
- "--num-values-per-label=N" # Cardinality per labelTo modify the queries in the Grafana dashboard and run ASAPQuery against those:
Edit config/controller-config.yaml:
query_groups:
- id: 1
queries:
- "quantile by (label_0) (0.99, fake_metric)"
- "quantile by (label_0) (0.50, fake_metric)"
# Add your queries herepython3 generate_dashboards.pyThis automatically creates a new dashboard with panels for all your queries.
docker compose restartSee asap-dropin/ for a single-container setup that integrates with an existing Prometheus and Grafana deployment.
