Skip to content

nextship-loadtest: a separate command that load tests any site with k6 - #8

Open
gowtham472 wants to merge 2 commits into
mainfrom
feat/loadtest
Open

gowtham472 wants to merge 2 commits into
mainfrom
feat/loadtest

Conversation

@gowtham472

@gowtham472 gowtham472 commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

A separate command, nextship-loadtest, that reports how many users at once a site holds. Asked for by a reader on r/nextjs who wanted to know what an app can take before deploying it.

What it does

nextship-loadtest https://example.com/          # shows the plan, sends nothing
nextship-loadtest https://example.com/ --yes    # runs it
  • k6 does the work. The package writes the k6 script, runs k6 from PATH or from the official image (grafana/k6:2.3.0), and reads the summary back. k6 is run as a separate process and never bundled.
  • Rising steps. The users asked for are reached in up to five steps. A step is held when at most 1% of its requests fail and 95% finish within a second, and the headline is the last step held. The rule is printed with every result.
  • Plan first. Nothing is sent until --yes. At most 1000 users and 600 s. An address carrying credentials is refused.
  • A target that never answers is an error, not a result.
  • Its own package, packages/loadtest, with no dependency on the CLI in either direction, so it works on any site without nextship. Marked private: nothing here publishes it.

How it was verified

  • 39 unit tests, and the workspace's typecheck and tests pass.
  • packages/loadtest/scripts/e2e.mjs, 7 of 7 checks against a server that answers one request at a time, in each of these:
    • k6 2.3.0 on PATH, on Windows
    • Docker Desktop on Windows (Docker 29.7.2), the server on the same machine requested as host.docker.internal
    • Docker on Linux, then k6 on PATH on Linux: the new Load test command CI job, which passed on this pull request

Not yet verified

  • Docker Desktop on macOS. It takes the path that passed on Windows; nobody has run it there.

Publishing, the npm name and a site page are in docs/roadmap.md. Design record: docs/design.md §15.

🤖 Generated with Claude Code

nextship-loadtest takes an address and reports how many users at once
the site holds. It writes the k6 script, runs k6 from PATH or from the
official Docker image, and reads the summary back: up to five rising
steps, each held when at most 1% of its requests fail and 95% finish
within a second. It prints its plan and sends nothing until --yes, and
a target that never answers is an error rather than a result.

In its own package with no dependency on the CLI, so it can be used
without nextship. Not published. 39 unit tests, and an end-to-end
script that passes with k6 2.3.0 on PATH and that CI runs with Docker
and with k6 on PATH.
scripts/e2e.mjs docker passes with Docker Desktop (Docker 29.7.2) on
Windows, with the server on the same machine requested as
host.docker.internal. macOS is the one path still not run.
@gowtham472
gowtham472 requested a review from Ragul2105 October 9, 2026 15:45
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
nextship 3346fbd Commit Preview URL

Branch Preview URL
Oct 09 2026, 03:45 PM

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