k6 load testing

Calculate required virtual users

Hard120 pts~45 min
  • Little's law
  • Capacity planning
Practice app · Checkout Service

A load-testable checkout service with realistic latency that degrades under concurrency, plus a live metrics view.

BASE_URL
/api/practice
Console app
/lab/performance-testing-calculate-required-virtual-users

Your starter code already declares BASE_URL — call the API relative to it.

Objective

Compute the VU count needed for a target throughput with Little's law and run it.

Your task

  1. 1Target 15 requests/s; one iteration ≈ 0.2 s response + 0.4 s think time = 0.6 s.
  2. 2const TARGET_RPS = 15, ITERATION_SECONDS = 0.6; vus: Math.ceil(TARGET_RPS * ITERATION_SECONDS) (= 9), duration: '10s'.
  3. 3GET BASE_URL + "/perf/checkout", check status 200, sleep(0.4).

Acceptance criteria

  • GET /perf/checkout returns 200
  • vus is computed, not hardcoded
  • ≥ 80 requests are sent
  • At least 80 check() calls pass

Constraints

  • Runner limits: ≤ 50 VUs, ≤ 400 requests and ≤ 20 s per run — size options accordingly.

k6 load testing · Performance Testing · Workload modelling