Skip to content

Add k6 activity ramp benchmark#236

Open
rgarcia wants to merge 8 commits into
mainfrom
hypeship/k6-activity-benchmark
Open

Add k6 activity ramp benchmark#236
rgarcia wants to merge 8 commits into
mainfrom
hypeship/k6-activity-benchmark

Conversation

@rgarcia
Copy link
Copy Markdown
Contributor

@rgarcia rgarcia commented May 17, 2026

Summary

  • add a k6 TypeScript activity-ramp benchmark for Hypeman instance lifecycle load
  • add make -C benchmarks bench-activity-ramp with HTML and JSON report output under .bench/k6
  • document the required environment variables and the shared pattern-ingress probe setup
  • keep benchmark metrics grouped by stable operation names so large runs do not produce per-instance summary cardinality

Validation

  • make -C benchmarks -n bench-activity-ramp HYPEMAN_API_KEY=dummy
  • docker run --rm -v "$PWD":/src -w /src grafana/k6:latest inspect -e HYPEMAN_API_KEY=dummy benchmarks/k6/activity-ramp.ts
  • git diff --check

Note

Low Risk
Low risk: adds new benchmarking scripts/docs and ignores generated .bench/ output, with no changes to runtime server/CLI behavior.

Overview
Adds a k6 TypeScript activity ramp benchmark that repeatedly creates an instance, waits for Running, probes it via a shared pattern ingress, and deletes it, emitting stable per-operation metrics (including explicit tracking of capacity-rejected creates).

Introduces make -C benchmarks bench-activity-ramp to run the benchmark and export HTML/JSON reports under .bench/k6, documents required environment variables and ingress/probe tuning, and updates .gitignore to ignore .bench/ outputs.

Reviewed by Cursor Bugbot for commit 94b33cc. Bugbot is set up for automated code reviews on this repo. Configure here.

@rgarcia rgarcia marked this pull request as ready for review May 18, 2026 15:10
@firetiger-agent
Copy link
Copy Markdown

Firetiger deploy monitoring skipped

This PR didn't match the auto-monitor filter configured on your GitHub connection:

Any PR that changes the kernel API. Monitor changes to API endpoints (packages/api/cmd/api/) and Temporal workflows (packages/api/lib/temporal) in the kernel repo

Reason: PR adds k6 benchmarking infrastructure in the benchmarks directory, not changes to API endpoints (packages/api/cmd/api/) or Temporal workflows (packages/api/lib/temporal).

To monitor this PR anyway, reply with @firetiger monitor this.

@rgarcia rgarcia force-pushed the hypeship/k6-activity-benchmark branch from 197e498 to 1c64321 Compare May 18, 2026 15:15
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Autofix Details

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Ingress host port default mismatch between Makefile and TypeScript
    • Updated the loadConfig() fallback for HYPEMAN_INGRESS_HOST_PORT from 8081 to 80 so direct k6 runs match Makefile and README defaults.
  • ✅ Fixed: Instance body tags use per-VU config.runId instead of shared data.runId
    • Changed instance creation tags to use tags.run_id so created instances share the setup-provided run ID that teardown queries for cleanup.

Create PR

Or push these changes by commenting:

@cursor push a5823bc801
Preview (a5823bc801)
diff --git a/benchmarks/k6/activity-ramp.ts b/benchmarks/k6/activity-ramp.ts
--- a/benchmarks/k6/activity-ramp.ts
+++ b/benchmarks/k6/activity-ramp.ts
@@ -139,7 +139,7 @@
 
 function loadConfig(): Config {
   const baseUrl = trimRight(requiredEnv('HYPEMAN_BASE_URL', 'http://127.0.0.1:8080'), '/');
-  const ingressHostPort = intEnv('HYPEMAN_INGRESS_HOST_PORT', 8081);
+  const ingressHostPort = intEnv('HYPEMAN_INGRESS_HOST_PORT', 80);
 
   return {
     baseUrl,
@@ -297,7 +297,7 @@
     tags: {
       benchmark: 'activity-ramp',
       hypervisor: config.hypervisor || 'server-default',
-      run_id: config.runId,
+      run_id: tags.run_id,
     },
     skip_kernel_headers: true,
   };

You can send follow-ups to the cloud agent here.

Comment thread benchmarks/k6/activity-ramp.ts Outdated
Comment thread benchmarks/k6/activity-ramp.ts
@rgarcia rgarcia force-pushed the hypeship/k6-activity-benchmark branch from 1c64321 to 8336845 Compare May 18, 2026 15:23
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: requiredEnv is identical to envString, adds no validation
    • requiredEnv now fails when the resolved value is empty, so missing required variables with empty fallback are enforced instead of silently defaulting.

Create PR

Or push these changes by commenting:

@cursor push cb21feedc7
Preview (cb21feedc7)
diff --git a/benchmarks/k6/activity-ramp.ts b/benchmarks/k6/activity-ramp.ts
--- a/benchmarks/k6/activity-ramp.ts
+++ b/benchmarks/k6/activity-ramp.ts
@@ -492,7 +492,11 @@
 }
 
 function requiredEnv(name: string, fallback: string): string {
-  return envString(name, fallback);
+  const value = envString(name, fallback);
+  if (value === '') {
+    fail(`${name} is required`);
+  }
+  return value;
 }
 
 function intEnv(name: string, fallback: number): number {

You can send follow-ups to the cloud agent here.

Comment thread benchmarks/k6/activity-ramp.ts
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Probe accepts client error responses
    • Updated the ingress probe success condition to only treat 2xx/3xx responses as ready so 4xx client errors no longer count as successful probes.

Create PR

Or push these changes by commenting:

@cursor push 7e39b6f3f9
Preview (7e39b6f3f9)
diff --git a/benchmarks/k6/activity-ramp.ts b/benchmarks/k6/activity-ramp.ts
--- a/benchmarks/k6/activity-ramp.ts
+++ b/benchmarks/k6/activity-ramp.ts
@@ -328,7 +328,7 @@
     });
     probeHTTPMs.add(res.timings.duration, tags);
 
-    if (res.status >= 200 && res.status < 500) {
+    if (res.status >= 200 && res.status < 400) {
       probeReadyMs.add(Date.now() - started, tags);
       probeOk.add(true, tags);
       return;

You can send follow-ups to the cloud agent here.

Comment thread benchmarks/k6/activity-ramp.ts
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: VU step zero hangs load
    • Added an early cfg.vuStep < 1 fail guard in rampStages so invalid zero-step configs fail immediately instead of entering a non-advancing loop during options evaluation.

Create PR

Or push these changes by commenting:

@cursor push aa58db4142
Preview (aa58db4142)
diff --git a/benchmarks/k6/activity-ramp.ts b/benchmarks/k6/activity-ramp.ts
--- a/benchmarks/k6/activity-ramp.ts
+++ b/benchmarks/k6/activity-ramp.ts
@@ -144,6 +144,9 @@
 }
 
 function rampStages(cfg: Config): Array<{ duration: string; target: number }> {
+  if (cfg.vuStep < 1) {
+    fail('HYPEMAN_BENCH_VU_STEP must be at least 1');
+  }
   const stages: Array<{ duration: string; target: number }> = [];
   for (let target = cfg.startVUs + cfg.vuStep; target <= cfg.maxVUs; target += cfg.vuStep) {
     stages.push({ duration: cfg.stageDuration, target });

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 94b33cc. Configure here.

if (cfg.vuStep < 1) {
fail('HYPEMAN_BENCH_VU_STEP must be at least 1');
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VU step zero hangs load

Medium Severity

export const options calls rampStages at module load, but checkRequiredConfig (which rejects HYPEMAN_BENCH_VU_STEP below 1) only runs in setup(). With HYPEMAN_BENCH_VU_STEP=0, the ramp loop never advances and the k6 process hangs before setup or any validation message.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 94b33cc. Configure here.

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.

1 participant