Skip to content

test(load): add rate-limiter, event-listener, GraphQL, and webhook load scenarios#1186

Merged
Emmyt24 merged 1 commit into
nova-launch01:mainfrom
Fidelis900:test/load-ratelimiter-accuracy-event-listener-graphql-webhook
May 28, 2026
Merged

test(load): add rate-limiter, event-listener, GraphQL, and webhook load scenarios#1186
Emmyt24 merged 1 commit into
nova-launch01:mainfrom
Fidelis900:test/load-ratelimiter-accuracy-event-listener-graphql-webhook

Conversation

@Fidelis900

Copy link
Copy Markdown
Contributor

Summary

Adds four load-test scenarios (k6) and their vitest-testable helper libraries covering issues #1095#1098. Each scenario ships with:

  • A k6 scenario file under load-tests/scenarios/
  • A pure helper module under load-tests/lib/ (no k6 runtime dependency)
  • Vitest unit tests under load-tests/scripts/

135 unit tests added; all passing.


#1098 — Rate-limiter accuracy under high concurrent request pressure

Scenario: load-tests/scenarios/ratelimiter-accuracy.js

  • Fires 50 VUs concurrently (≈5× the default 100 req/min budget) for one full 60 s window.
  • Custom metrics: rl_allowed_requests, rl_denied_requests, rl_error_requests, rl_denied_rate.
  • Assertions: allowed count is within ±5 % of the configured budget; all over-budget responses return HTTP 429.
  • Helper: lib/ratelimiter-helpers.jsclassifyResponse, withinTolerance, buildRateLimitReport, formatRateLimitSummary (28 unit tests).
Parameter Value
Concurrency 50 VUs
Window 60 s
Budget 100 req/window
Tolerance ±5 %

#1097 — Stellar event-listener stability under sustained ingestion load

Scenario: load-tests/scenarios/event-listener-sustained.js

  • Drives 20 VUs posting synthetic Stellar events for 120 s to the ingest endpoint.
  • Measures ingestion lag per request (dispatch → ack round-trip).
  • Assertions: p95 lag < 500 ms, zero lag violations, ack rate ≥ 99 %.
  • Helper: lib/event-listener-helpers.jscomputeLagMs, isLagWithinThreshold, buildLagReport, formatLagSummary (23 unit tests).
Parameter Value
VUs 20
Duration 120 s steady-state
Lag threshold 500 ms

#1096 — GraphQL query performance under sustained concurrent load

Scenario: load-tests/scenarios/graphql-performance.js

  • Issues a representative query mix at 20 VUs for 60 s to POST /api/graphql.
  • Query mix: 40 % tokens_list · 25 % token_detail · 20 % streams_list · 15 % proposals_list.
  • Latency thresholds: p50 < 200 ms · p95 < 500 ms · p99 < 1 000 ms · error rate < 1 %.
  • Helper: lib/graphql-helpers.jsselectGraphQLQuery, computePercentile, meetsLatencyThresholds, buildLatencyReport, formatLatencySummary (25 unit tests).

#1095 — Webhook delivery throughput benchmark

Scenario: load-tests/scenarios/webhook-throughput.js

  • Generates a sustained stream of webhook-triggering POSTs at 20 VUs for 60 s.
  • Supports a configurable test sink via WEBHOOK_SINK_URL.
  • Thresholds: throughput ≥ 50 deliveries/sec · error rate ≤ 1 % · p95 delivery latency < 2 000 ms.
  • Helper: lib/webhook-helpers.jscomputeThroughput, computeErrorRate, passesThresholds, buildThroughputReport, formatThroughputSummary (27 unit tests).

Files changed

File Purpose
load-tests/scenarios/ratelimiter-accuracy.js k6 rate-limiter load scenario
load-tests/lib/ratelimiter-helpers.js Pure helpers for #1098
load-tests/scripts/ratelimiter-helpers.test.js 28 unit tests
load-tests/scenarios/event-listener-sustained.js k6 event-listener load scenario
load-tests/lib/event-listener-helpers.js Pure helpers for #1097
load-tests/scripts/event-listener-helpers.test.js 23 unit tests
load-tests/scenarios/graphql-performance.js k6 GraphQL benchmark
load-tests/lib/graphql-helpers.js Pure helpers for #1096
load-tests/scripts/graphql-helpers.test.js 25 unit tests
load-tests/scenarios/webhook-throughput.js k6 webhook throughput benchmark
load-tests/lib/webhook-helpers.js Pure helpers for #1095
load-tests/scripts/webhook-helpers.test.js 27 unit tests

Test plan

  • cd load-tests && npx vitest run — 135 tests across 5 test files, all passing
  • k6 run scenarios/ratelimiter-accuracy.js — requires k6 + running backend
  • k6 run scenarios/event-listener-sustained.js — requires k6 + running backend
  • k6 run scenarios/graphql-performance.js — requires k6 + running backend
  • k6 run scenarios/webhook-throughput.js — requires k6 + running backend + test sink

Closes #1095
Closes #1096
Closes #1097
Closes #1098

🤖 Generated with Claude Code

…ad scenarios

Implements four load-test scenarios and their supporting vitest-testable
helper libraries (135 unit tests added across 4 helper modules).

--- nova-launch01#1098 — Rate-limiter accuracy under high concurrent request pressure ---
- scenarios/ratelimiter-accuracy.js: fires 50 VUs (≈5× the default 100
  req/min budget) against the rate-limit endpoint for one full window (60 s).
  Asserts allowed count matches budget within ±5 % tolerance; denied requests
  are checked for HTTP 429.
- lib/ratelimiter-helpers.js: classifyResponse, withinTolerance,
  buildRateLimitReport, formatRateLimitSummary.
- scripts/ratelimiter-helpers.test.js: 28 unit tests.
  Concurrency: 50 VUs · Window: 60 s · Budget: 100 req/window · Tolerance: ±5 %

--- nova-launch01#1097 — Stellar event-listener stability under sustained ingestion load ---
- scenarios/event-listener-sustained.js: drives 20 VUs for 120 s posting
  synthetic events to the ingest endpoint. Measures ingestion lag per request
  and asserts p95 lag < 500 ms with zero violations.
- lib/event-listener-helpers.js: computeLagMs, isLagWithinThreshold,
  buildLagReport, formatLagSummary.
- scripts/event-listener-helpers.test.js: 23 unit tests.
  Duration: 120 s · VUs: 20 · Lag threshold: 500 ms

--- nova-launch01#1096 — GraphQL query performance under sustained concurrent load ---
- scenarios/graphql-performance.js: issues a representative query mix
  (40 % tokens_list, 25 % token_detail, 20 % streams_list, 15 % proposals_list)
  at 20 VUs for 60 s. Enforces p50 < 200 ms, p95 < 500 ms, p99 < 1 000 ms,
  error rate < 1 %.
- lib/graphql-helpers.js: selectGraphQLQuery, computePercentile,
  meetsLatencyThresholds, buildLatencyReport, formatLatencySummary.
- scripts/graphql-helpers.test.js: 25 unit tests.

--- nova-launch01#1095 — Webhook delivery throughput benchmark ---
- scenarios/webhook-throughput.js: generates a sustained stream of
  webhook-triggering POSTs at 20 VUs for 60 s against a configurable test
  sink. Asserts throughput >= 50 deliveries/sec and error rate <= 1 %.
- lib/webhook-helpers.js: computeThroughput, computeErrorRate,
  passesThresholds, buildThroughputReport, formatThroughputSummary.
- scripts/webhook-helpers.test.js: 27 unit tests.

Each scenario writes a JSON summary to load-tests/results/ and prints a
human-readable report to stdout. All k6 env-var overrides are documented
in each file header.

Closes nova-launch01#1095
Closes nova-launch01#1096
Closes nova-launch01#1097
Closes nova-launch01#1098

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented May 27, 2026

Copy link
Copy Markdown

@Fidelis900 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Emmyt24 Emmyt24 merged commit 1b43b50 into nova-launch01:main May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants