videogen/docs/loadtest/menivor-read-paths.js
caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

51 lines
1.8 KiB
JavaScript

// Safe load test for the Menivor API: read-only, unauthenticated, no renders,
// no provider calls, no DB writes. Hard caps: <= 20 VUs, <= 60 s.
// Aborts early if the API starts to struggle so it never degrades real users.
//
// k6 run -e BASE=https://api.menivor.com -e MAX_VUS=10 -e PAUSE_S=1 docs/loadtest/menivor-read-paths.js
import http from "k6/http";
import { check, sleep } from "k6";
const BASE = __ENV.BASE || "https://api.menivor.com";
const MAX_VUS = Math.min(Number(__ENV.MAX_VUS || 10), 20);
const PAUSE_S = Math.max(Number(__ENV.PAUSE_S || 1), 0.1);
export const options = {
scenarios: {
ramp: {
executor: "ramping-vus",
startVUs: 1,
stages: [
{ duration: "15s", target: Math.ceil(MAX_VUS / 2) },
{ duration: "30s", target: MAX_VUS },
{ duration: "15s", target: 0 },
],
gracefulRampDown: "5s",
},
},
thresholds: {
// Stop the run (not just fail it) if prod gets slow or errors.
http_req_failed: [{ threshold: "rate<0.05", abortOnFail: true, delayAbortEval: "10s" }],
http_req_duration: [{ threshold: "p(95)<8000", abortOnFail: true, delayAbortEval: "10s" }],
// Per-endpoint breakdown in the summary.
"http_req_duration{endpoint:healthz}": ["p(95)<8000"],
"http_req_duration{endpoint:styles}": ["p(95)<8000"],
"http_req_duration{endpoint:monthly_plans}": ["p(95)<8000"],
},
summaryTrendStats: ["min", "med", "avg", "p(90)", "p(95)", "max"],
};
const PATHS = [
{ name: "healthz", url: `${BASE}/healthz` },
{ name: "styles", url: `${BASE}/api/v1/styles` },
{ name: "monthly_plans", url: `${BASE}/api/v1/billing/monthly-plans` },
];
export default function () {
for (const p of PATHS) {
const res = http.get(p.url, { tags: { endpoint: p.name }, timeout: "15s" });
check(res, { [`${p.name} 200`]: (r) => r.status === 200 });
}
sleep(PAUSE_S);
}