Load testing
The staging load test. What it simulates, how to start it, what it reports, and how to clean up after it.
.github/workflows/load-test.yml ("Staging load test") runs only against staging and only when started by hand. It seeds load-test teachers and administrators, signs their tokens with staging's key (no sign-in emails), and drives staging with three scripts at once.
Note the start time first
The test writes thousands of rows to staging. Cleanup is a Neon restore of the staging database to just before the run; the first step prints that time. staging-db.mjs refuses to connect to anything but the staging database.
What runs
| Script | Simulates |
|---|---|
staff-day.js (k6) | Teachers writing schemes and lesson plans, uploading files to R2 and asking Rover. Once per step, a wave of teachers asks Rover to edit a scheme at the same moment. In the second half of each step, administrators create classes and subjects and move teachers |
editors.mjs | Groups of people typing in the same scheme over the collaborative editor |
readings.mjs | Server readings taken through the run |
Supporting scripts: seed.mjs (people), mint-tokens.mjs (tokens), cleanup-files.mjs (deletes confirmed uploads through the API) and cleanup-r2.mjs (deletes every LOADTEST folder straight from the staging R2 bucket, including uploads that never finished).
Seeded people use Resend's test inbox (delivered+load-test-...@resend.dev), so notification emails are accepted and go nowhere.
Starting it
Run the workflow from the Actions tab. Inputs:
| Input | Default | Meaning |
|---|---|---|
mode | pilot | pilot: 20 staff for about 7 minutes, to check everything and see Rover's cost. full: the steps below. clean-up: only delete load-test files from R2 |
steps | 1000,1500,2000 | Staff at each step of a full run |
hold_minutes | 12 | Minutes held at each step (plus 4 to climb to it) |
rover_wave | 150 | Teachers in each simultaneous Rover wave (5 in a pilot) |
editor_groups | 50x2,25x4,10x20 | People per scheme × number of schemes (5x1 in a pilot) |
admins | 40 | Administrators doing set-up work (2 in a pilot) |
pilot_staff | 20 | Teachers in a pilot |
direct | true | Send traffic straight to Railway's staging address instead of through Cloudflare, which rate-limits one machine as an attack. Each host is checked first; one that doesn't answer falls back to Cloudflare |
A full run uses a larger runner and can take up to 150 minutes. Only one run at a time.
Results
The job summary and the log show summary.md, editors.md and readings.md; refused requests are counted by kind. The JSON, Markdown and logs are uploaded as the load-test-results artifact. Uploaded files are deleted from R2 even if the run fails (a database restore would leave them behind); the database still needs the Neon restore. To clear files from an earlier run, start the workflow in clean-up mode.
During the load test staging was raised to two worker copies with 30 Rover replies each. Since API 491254f1 staging is one worker with 20 replies and one API copy. At API main d0fbb403 production runs two API copies and two worker copies. Raise staging again before a rerun if it should match production (see Environments).