Load testing a backend

Performance and scaling Mid-level Python 3.13+ PostgreSQL 17+ Reviewed By Best Latest Apps

Order the steps

Order a load test.

  • Prepare production-like data and a realistic request mix
  • Name the first bottleneck and fix or document it
  • Ramp arrival rate in steps with an open-model tool
  • Record percentiles, errors and dependency saturation
  • Write down the question and the SLO

Choose an answer, then open Show answer below to check it.

Show answer

Answer: E A C D B

  1. Write down the question and the SLO For example p99 < 300 ms at 2,000 rps.
  2. Prepare production-like data and a realistic request mix Avoid all-cache-hit runs.
  3. Ramp arrival rate in steps with an open-model tool Hold each step long enough to stabilise.
  4. Record percentiles, errors and dependency saturation Per step.
  5. Name the first bottleneck and fix or document it Then re-run.

30-second answer

Decide the question first: maximum throughput at an SLO, behaviour at expected peak, or how it fails past capacity. Use a production-like environment and data volume, realistic request mixes and think times, and an open-model generator (fixed arrival rate) so slow responses don't quietly reduce load. Ramp up in steps, watch latency percentiles, errors and saturation of every dependency, and find the first thing that breaks.

Practise saying it · 30 s. No recording, just a timer

Load-test well.

Say your answer out loud, then check which of these points you covered:

  • Question + SLO
  • Realistic data and mix
  • Open model
  • Step ramps
  • First bottleneck

Deep dive

Tools: k6, Locust, Gatling, wrk2 (constant-rate).

Closed-model tools (each user waits for the response) hide overload; that's coordinated omission.

Soak tests over hours find leaks and slow degradation.

Don't load-test third-party APIs you don't own; stub them.

Common mistakes

  • Testing on a tiny database.
  • Hammering one endpoint with the same request (all cache hits).
  • Reporting only average latency.

Senior take & follow-ups

Clear question, realistic environment and mix, open model, step ramps, find the bottleneck.

Follow-up questions

Think of your answer first, then open the hint.

  1. Open vs closed model?

    Show hint

    Open sends at a fixed rate regardless of responses, like real traffic.

  2. What's a soak test?

    Show hint

    Moderate load for hours to find leaks.

Suggest a fix if something here is wrong or out of date.