StoicBuilder
Later missionMission 44: Ten times the trafficYou can practise it now. It counts once you reach mission 44, after “The 1st of the month”.Back to HQ
Exit lesson
Load testing: finding the limitProLesson 39 of 45, about 8 min
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
0 XP

The app: Beacon, logs, metrics and traces

Beaconstagingload test: GET /api/dashboard
4 app serversDirect to Postgres

No run yet. The ramp takes 12 minutes on staging; here it takes a moment.

The test script, the setup and the log

load-test.js Kofi’s k6 scriptstaging
import http from "k6/http";
import { sleep } from "k6";
export const options = {
stages: [
{ duration: "2m", target: 50 }, // today’s peak
{ duration: "3m", target: 150 }, // 3x
{ duration: "3m", target: 300 }, // 6x
{ duration: "3m", target: }, // 10x
{ duration: "1m", target: 0 }, // ramp down
],
thresholds: {
http_req_duration: [],
http_req_failed: [],
},
};
export default function () {
http.get(`${__ENV.BASE_URL}/api/dashboard`);
sleep(1); // a person reads the page before the next click
}
$ k6 run -e BASE_URL=https://staging.harbor.example load-test.js
Setup between the users and the data
load balancer round robin over 4 app servers, health check GET /healthz
app servers 4, each with a pool of 25 connections
4 × 25 = 100 connections wanted
pgbouncer off: every app server connects straight to Postgres
postgres max_connections = 100
App server log from the last run

Nothing yet. Run the test.

The MagisterA partner will bundle Harbor next month: plan for ten times today’s traffic. Kofi wrote a k6 script. Virtual users, each a script acting like a person, ramp from today’s peak of 50 to 500, on staging with production-sized data. Tap the 10x target, then the rule that decides pass or fail on speed.

Step 1 of 7Read the test before you run it
  • Tap the 10x target
  • Tap the p95 threshold

You’re not signed in, so this lesson won’t be saved to your path. Sign in free to keep your XP.