Skip to content

Commit

Permalink
feat(ch-bench-read): add script to run benchmark locally
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Jun 17, 2024
1 parent 3adaf57 commit a2414c4
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 28 deletions.
1 change: 1 addition & 0 deletions dev/local/ch-bench-read/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
record
/report.yml
/req.rwq
42 changes: 14 additions & 28 deletions dev/local/ch-bench-read/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ services:
- "127.0.0.1:9000:9000"
- "127.0.0.1:8123:8123"
volumes:
- ./clickhouse.xml:/etc/clickhouse-server/config.d/monitoring.xml
- ./clickhouse.xml:/etc/clickhouse-server/config.d/monitoring.xml:ro
healthcheck:
test: ['CMD', 'wget', '--spider', '-q', '127.0.0.1:8123/ping']
test: ["CMD", "wget", "--spider", "-q", "127.0.0.1:8123/ping"]
interval: 1s
timeout: 1s
retries: 30

prometheus:
image: "ghcr.io/go-faster/prom/prometheus"
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- "--config.file=/etc/prometheus/prometheus.yml"
volumes:
- './prometheus.yml:/etc/prometheus/prometheus.yml'
- "./prometheus.yml:/etc/prometheus/prometheus.yml:ro"
restart: unless-stopped

oteldb:
Expand All @@ -49,13 +49,13 @@ services:
- GOMAXPROCS=6
- GOMEMLIMIT=1500MiB
healthcheck:
test: ['CMD', 'wget', '--spider', '-q', '127.0.0.1:13133/liveness']
test: ["CMD", "wget", "--spider", "-q", "127.0.0.1:13133/liveness"]
interval: 1s
timeout: 1s
retries: 30
ports:
- "127.0.0.1:9090:9090" # promql
- "127.0.0.1:9010:9010" # pprof
- "127.0.0.1:9090:9090" # promql
- "127.0.0.1:9010:9010" # pprof
- "127.0.0.1:19291:19291" # prometheus remote write
depends_on:
- clickhouse
Expand All @@ -75,38 +75,24 @@ services:
depends_on:
- clickhouse

otelproxy:
build:
context: ../../../
dockerfile: otelproxy.Dockerfile
volumes:
- ./record:/record
environment:
- PROMETHEUS_URL=http://oteldb:9090
- PROMETHEUS_RECORD=/record/queries.jsonl
- OTEL_LOG_LEVEL=info
- OTEL_METRICS_EXPORTER=none
- OTEL_LOGS_EXPORTER=none
- OTEL_TRACES_EXPORTER=none
- OTEL_RESOURCE_ATTRIBUTES=service.name=go-faster.otelproxy
tempo:
image: "ghcr.io/go-faster/tempo"
command: [ "-config.file=/etc/tempo.yml" ]
command: ["-config.file=/etc/tempo.yml"]
ports:
- "127.0.0.1:3200:3200"
volumes:
- ./tempo.yml:/etc/tempo.yml
- ./tempo.yml:/etc/tempo.yml:ro

# https://opentelemetry.io/docs/collector/installation/#docker-compose
otelcol:
image: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.89.0
volumes:
- ./otelcol.yml:/etc/otelcol-contrib/config.yaml
- ./otelcol.yml:/etc/otelcol-contrib/config.yaml:ro
ports:
- "127.0.0.1:4317:4317"
command:
- '--config'
- '/etc/otelcol-contrib/config.yaml'
- "--config"
- "/etc/otelcol-contrib/config.yaml"

grafana:
image: "ghcr.io/go-faster/grafana:10.0.0"
Expand All @@ -122,8 +108,8 @@ services:
ports:
- "127.0.0.1:3000:3000"
volumes:
- ./grafana/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml
- ./grafana/dashboards.yml:/etc/grafana/provisioning/dashboards/default.yml
- ./grafana/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml:ro
- ./grafana/dashboards.yml:/etc/grafana/provisioning/dashboards/default.yml:ro
- ./grafana/dashboards:/etc/grafana/dashboards:ro
depends_on:
- oteldb
36 changes: 36 additions & 0 deletions dev/local/ch-bench-read/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

clean_up() {
ARG=$?
echo ">> Stopping"
docker compose down -v
exit $ARG
}
trap clean_up EXIT

set -e

echo ">> Setup oteldb locally"
docker compose up -d --remove-orphans --build --force-recreate

echo ">> Upload benchmark data"
wget -N -O req.rwq https://storage.yandexcloud.net/faster-public/oteldb/req.rwq
go run github.com/go-faster/oteldb/cmd/otelbench promrw replay -i req.rwq

queries_file="${BENCH_QUERIES:-testdata/node-exporter-selected.promql.yml}"

echo ">> Warmup"
go run github.com/go-faster/oteldb/cmd/otelbench promql bench \
-i "$queries_file" \
--warmup 10

echo ">> Benchmark"
OTEL_EXPORTER_OTLP_INSECURE="true" go run github.com/go-faster/oteldb/cmd/otelbench promql bench \
-i "$queries_file" \
-o report.yml \
--trace \
--allow-empty=false \
--count 5 \
--warmup 5

echo ">> Done"

0 comments on commit a2414c4

Please sign in to comment.