Local benchmark harness for the cache demo on localhost:3002, using:
- the existing
cache-demosubgraphs - a dedicated Redis Docker container for L2 cache storage on
localhost:6399 - k6 for request load
- router Prometheus and pprof for runtime capture
gowith the repo’s expected toolchainpnpmk6docker- free local ports:
3002401240134014606080886399
benchmark/router-cache.redis.yaml: Redis-backed router config for the benchmarkbenchmark/scenarios/cache-demo.json: scenario manifestbenchmark/queries/*.graphql: canonical benchmark operationsbenchmark/fixtures/*.response.json: uncached router response fixturesbenchmark/k6/cache_demo.js: k6 runner with exact response assertion
article_simplearticles_by_ids_batchlisting_composite_keyvenue_nested_keyuser_profile_header_sensitivecatalogs_partial_loadrequest_scoped_viewer_articlesviewer_articles_deep_nested
The demo uses fake bearer tokens:
alice->Bearer token-alicebob->Bearer token-bobcharlie->Bearer token-charlie
Auth-sensitive scenarios must not fall back to anonymous requests.
Validate the manifest and checked-in fixtures:
make benchmark-cache-demo-validateRun the full suite with default load settings:
make benchmark-cache-demoRun one scenario with default load settings:
make benchmark-cache-demo-scenario SCENARIO=article_simpleRun one scenario with direct control over k6 stages:
pnpm dlx tsx benchmark/scripts/run_suite.ts \
--scenario article_simple \
--vus 10 \
--duration 30s \
--ramp-up 5s \
--ramp-down 5sResult bundles are written under:
benchmark/results/<timestamp>/<scenario>/<mode>/
Each mode directory contains:
summary.jsonk6-summary.jsonmetrics-before.prommetrics-after.prommetrics-delta.jsonredis-info-before.txtredis-info-after.txtredis-docker-stats-before.jsonredis-docker-stats-after.jsonequivalence.jsonpprof/router_cpu.pb.gzpprof/router_heap.pb.gz
summary.json also records the warmup request count, k6 stage config, parsed k6 summary, and selected Redis INFO and Docker stats values so downstream interpretation does not need to scrape raw artifacts first.
- The harness owns the stack. If the required ports are already in use, startup fails rather than benchmarking against a dirty environment.
- L2 cache storage is intentionally externalized to Redis so router memory measurements do not include the full L2 object footprint.
- The suite always performs deterministic uncached equivalence checks before load generation and serial warmup requests before each mode run.