Skip to content

Add k6 activity ramp benchmark#236

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

Add k6 activity ramp benchmark#236
rgarcia wants to merge 6 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 noob-friendly comments explaining the k6 execution model, VUs, scenarios, metrics, setup, teardown, and activity loop
  • move the benchmark make target into benchmarks/Makefile and document running it with make -C benchmarks
  • add hypervisor selection and tagging for cloud-hypervisor, firecracker, and qemu matrix runs
  • make benchmark setup compatible with image names containing slashes and preserve unique instance suffixes under long run IDs
  • record create admission rejections separately with a short backoff so capacity limits do not look like script failures

Validation

  • make -C benchmarks -n bench-activity-ramp HYPEMAN_API_KEY=dummy
  • docker run --rm -v "$PWD":/src -w /src/benchmarks grafana/k6:latest inspect k6/activity-ramp.ts
  • git diff --check origin/main...HEAD
  • previously ran 24 matrix benchmark runs across m8i host sizes, gp3 settings, and cloud-hypervisor/firecracker/qemu
  • previously verified no active benchmark stacks remained after the matrix

CloudFormation quickstart options for ingress and gp3 tuning live separately in PR #237.


Note

Low Risk
Low risk: changes are additive benchmark tooling/docs plus ignoring local .bench/ artifacts, with no runtime or production code modifications.

Overview
Adds a new k6 TypeScript benchmark (benchmarks/k6/activity-ramp.ts) that ramps VUs running an instance lifecycle loop (create → wait for Running → HTTP probe via shared pattern ingress → delete), including setup/teardown cleanup and metrics for latency, success rates, and capacity rejections (409s) with backoff.

Introduces benchmarks/Makefile to run the benchmark via make -C benchmarks bench-activity-ramp, exporting HTML/JSON reports under .bench/k6, and documents usage/tuning in benchmarks/k6/README.md. Also updates .gitignore to exclude .bench/ output.

Reviewed by Cursor Bugbot for commit 8336845. 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.

Fix All in Cursor

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.

Reviewed by Cursor Bugbot for commit 8336845. Configure here.


function requiredEnv(name: string, fallback: string): string {
return envString(name, fallback);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

requiredEnv is identical to envString, adds no validation

Low Severity

requiredEnv is a direct pass-through to envString with no additional validation — the function body is just return envString(name, fallback). The "required" semantics are misleading: two of its three call sites (HYPEMAN_BASE_URL, HYPEMAN_IMAGE) supply non-empty fallbacks, so the variables are never truly required. Actual validation of HYPEMAN_API_KEY happens separately in checkRequiredConfig. A future contributor who calls requiredEnv('NEW_VAR', '') expecting it to fail on a missing value would get a silent empty-string default instead.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8336845. 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