All work
Personal project

JMeter Performance Testing: QuickPizza

Finding the breaking point, then tracing it to the code

Apache JMeter 5.6PythonBashGitHub ActionsQuickPizza (Go)
Users before the SLA breaks
75
Internal calls per request
9
Load profiles
5

Overview

Performance tests for QuickPizza, an open-source demo app from Grafana built for practicing load testing. I ran it locally from source and wrote one JMeter test plan that follows a realistic customer: log in, get a pizza recommendation, rate it, look at past ratings and browse the menu.

The same plan runs five profiles (smoke, load, stress, spike and soak) through properties, and a small Python script turns the results into a pass or fail against an SLA. The stress run found where the app breaks, and reading the source showed why.

Objective

Find how many concurrent users one QuickPizza instance can serve within the SLA, and explain what limits it.

Testing scope

  • User journey

    • Log in once and reuse the token
    • Get a recommendation and extract the pizza id
    • Rate that pizza, only when a pizza id came back
    • View past ratings (30% of iterations), browse doughs
  • Load profiles

    • Smoke: 5 users for 30 s, runs in CI on every push
    • Load: 20 users for 3 minutes
    • Stress: 10 up to 100 users in 60 s steps, stops at the first SLA breach
    • Spike: 300 users in 5 s. Soak: 30 users for 15 minutes

Test strategy

  • SLA per request: p95 under 800 ms for login, 500 ms for a recommendation, 300 ms for everything else, and under 1% errors.
  • Users come from a CSV and are registered in a setUp thread group, so the measured load never includes sign-up.
  • Token and pizza id are correlated with JSON extractors. An If Controller skips the rating when there is no pizza id, so one failure is not counted twice.
  • Gaussian think time of about 500 ms between requests, so the load looks like people rather than a loop.
  • The SLA script has its own small test, and CI puts the SLA table in the job summary.

Measurement integrity

My first stress runs failed at only 10 users, and the numbers would not repeat: 556 ms on one run, 1450 ms on the next. The CPU turned out to be at 100% before the test even started, because a browser and an IDE were open. With nothing else running, I timed a single client: a recommendation took 270 ms at the median and up to 4.4 s, while a plain menu read took 3 ms. Those early numbers were measuring my laptop, not the app, so I threw them away, closed everything and ran the tests again on a fresh server.

Architecture

  1. JMeternon-GUI, property driven
  2. QuickPizzaGo, localhost:3333
  3. results.jtlraw samples
  4. sla_check.pyp95 and error budget, exit 1 on breach
  5. GitHub Actionssmoke run, dashboard artifact

Implementation

The stress profile steps the load up and stops at the first step that breaks the SLA.
for users in 10 20 30 40 50 75 100; do
  if ! run "stress-$users" -Jthreads="$users" -Jrampup=20 -Jduration=60 "$@"; then
    echo ">>> SLA first broken at $users concurrent users"
    exit 1
  fi
done
The SLA check compares each request with its own p95 budget and the error limit.
P95_MS = {
    "01 Login": 800,  # password hashing makes login intentionally slower
    "02 Get recommendation": 500,
}
DEFAULT_P95_MS = 300
MAX_ERROR_RATE = 1.0  # percent, per request and overall

def breaches(stats):
    out = []
    for s in stats:
        if s["p95"] > s["p95_budget"]:
            out.append(f'{s["label"]}: p95 {s["p95"]} ms > {s["p95_budget"]} ms')
        if s["error_pct"] > MAX_ERROR_RATE:
            out.append(f'{s["label"]}: errors {s["error_pct"]:.2f}% > {MAX_ERROR_RATE}%')
    return out

Results

75

Users within the SLA

recommendation p95 159 ms

124 → 56

req/s at 100 users

throughput halved

26%

Recommendation errors at 100 users

5,800+

Requests in the load test

20 users, 0 errors

Evidence

JMeter HTML dashboard for the 100-user stress step: 10.13% of requests failed, recommendation has the lowest Apdex at 0.495
The 100-user step, where the SLA broke. Get recommendation has the worst Apdex by far. Its cause is in AddRecommendations: every request makes 9 sequential HTTP calls back into the same server for data that never changes, with no cache. Caching that data and running the remaining calls in parallel are the first two fixes I suggested.

Links