Skip to content

feat: export k6 latency percentiles as JSON summaries (#36) - #52

Merged
yashdotdev13 merged 1 commit into
yashdotdev13:mainfrom
ilker-ekin:feat/36-benchmark-latency-percentiles
Oct 19, 2026
Merged

yashdotdev13 merged 1 commit into
yashdotdev13:mainfrom
ilker-ekin:feat/36-benchmark-latency-percentiles

Conversation

@ilker-ekin

@ilker-ekin ilker-ekin commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Make k6 benchmark runs comparable without scraping console output: both scenarios now report p50/p90/p95/p99 and write a machine-readable JSON summary per run.

Related issue

Closes #36

Type of change

  • Bug fix
  • New feature
  • Documentation

What changed

  • Added load-tests/lib/summary.js, a shared k6 summary handler. It sets the trend stats (avg, min, p50, p90, p95, p99, max), prints a short console summary, and writes k6-summary-<scenario>-<timestamp>.json containing the scenario, the run parameters (script options and target URLs), latency percentiles, throughput, HTTP failure rate, check pass rate, each threshold with its pass/fail result, and the raw values of every k6 metric (including the distributed scenario's custom gateway and decision metrics).
  • load-tests/baseline.js and load-tests/distributed.js use the shared handler. Their requests, checks and thresholds are unchanged.
  • docs/benchmark-and-validation.md documents the artifact, how to compare two runs, and how to interpret results per environment (HTTP failures vs REJECTED decisions, Redis state, tail-latency sensitivity).

Note: because the scripts define handleSummary, k6's default end-of-test summary is replaced by the shorter custom one. Scripts must be run from a file path (not k6 run -) so the shared module resolves.

Validation

  • node --check on the three k6 scripts
  • Summary helper exercised with synthetic k6 summary data (percentiles, thresholds, artifact name, empty metrics)
  • k6 runs of baseline.js and distributed.js against the Docker Compose stack
  • ./mvnw -B verify: no Java changes in this PR; integration suite to be run with Docker

Distributed-systems impact

None on runtime behaviour. Only the load-test scripts and documentation change; no gateway, Redis, lease or metric code is touched.

🤖 Generated with Claude Code

Benchmark runs could only be compared by scraping k6 console output.

Both k6 scenarios now report p50/p90/p95/p99 via a shared
summaryTrendStats setting and use a shared handleSummary that prints a
short console summary and writes k6-summary-<scenario>-<timestamp>.json
with the scenario, run parameters, latency, throughput, HTTP failure and
check rates, threshold results and raw metric values.

Existing requests, checks and thresholds are unchanged. The benchmark
report documents how to compare runs and interpret results per
environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@yashdotdev13
yashdotdev13 merged commit fbb9a22 into yashdotdev13:main Oct 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add latency percentile reporting to benchmark scripts

2 participants