Skip to content
Tutorials Center
My learning

Topics

Lesson 2 of 37 ยท Getting Started

Performance Testing Basics: Load, Stress, Spike and Soak

Understand the key performance testing types, the metrics that matter (response time, throughput, errors, percentiles) and how to set goals before you touch JMeter.

Before you click anything in JMeter, you need to know what question you are asking. "Is the site fast?" is not a testable question. "Can the checkout API answer 95% of requests in under 800 ms while 300 users are active?" is. This lesson gives you the vocabulary and the habits of performance testing so your JMeter tests produce answers rather than numbers.

Honesty note. The runnable blocks are plain JavaScript calculators that teach the arithmetic. They are not JMeter and do not measure a real server.

The main kinds of performance test

Type Question it answers Typical shape of the load
Smoke Does the test itself work? 1 to 5 users for a minute
Load Does the system meet its goals at expected traffic? Steady expected load for 15 to 60 minutes
Stress Where does it break, and how does it fail? Load increased step by step until errors rise
Spike Can it survive a sudden surge, and recover? Sharp jump (for example 10x in seconds), then back
Soak (endurance) Does it leak memory or degrade over hours? Moderate steady load for 4 to 24 hours
Scalability Does adding servers add capacity? Repeat load tests at different system sizes
flowchart TD
  A["Smoke: does the script work?"] --> B["Load: meets goals at normal traffic?"]
  B --> C["Stress: find the breaking point"]
  B --> D["Spike: sudden surge"]
  B --> E["Soak: hours of steady load"]

Start small and widen: never begin with a stress test on an untested script.

The metrics that matter

Response time (elapsed). Time from sending a request until the last byte of the response arrives. JMeter also reports latency (time to the first byte) and connect time.

Throughput. Completed requests per second (or per minute). It is the capacity number: how much work the system finishes.

Error rate. The percentage of failed requests. "Failed" includes HTTP 5xx, timeouts and assertion failures, so what counts as an error is something you define.

Concurrency. How many users are active at once. Not the same as throughput!

Percentiles. The 90th percentile (p90) is the time that 90% of requests beat. The 95th and 99th show the slow tail. A mean of 200 ms can hide a p99 of 3 s, and real users notice the tail.

Resource usage. CPU, memory, disk, connection pools on the server. JMeter shows you symptoms; server monitoring shows causes.

Why averages lie

Imagine 100 requests: 95 take 100 ms and 5 take 3000 ms. The average is 245 ms, which sounds fine, yet five users in a hundred waited three seconds. Run the stand-in to see it.

JS Stand-in: mean versus percentiles

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Pay attention to where the jump happens: the tail only appears at p96 and above. If your requirement says "p95 under 800 ms", this data passes, yet the p96 does not. Always choose the percentile that matches what users feel.

Little's Law: connecting users and throughput

A useful rule from queueing theory: N = X ร— (R + Z), where N is the number of concurrent users, X is throughput (requests per second per user flow), R is response time in seconds and Z is think time (the pause between actions). Rearranged, X = N / (R + Z).

If 200 users each wait 0.5 s for a response and think for 9.5 s, the system sees 200 / 10 = 20 requests per second. This explains why "200 users" does not mean 200 requests per second: think time matters a great deal.

JS Stand-in: Little's Law calculator

Press Run (or Ctrl + Enter) to see the console output here.

No output.

With no think time, 200 users produce 400 req/s: twenty times more pressure. Forgetting think time is the commonest reason a test overloads a server that real users would never stress.

Set goals before you test

Write your acceptance criteria first, in numbers. A good set looks like:

  1. At 300 concurrent users with realistic think time, p95 of "Add to cart" is at most 800 ms.
  2. Error rate is below 1% over a 30-minute run.
  3. Throughput reaches at least 40 orders per minute.
  4. Server CPU stays below 75%.

Such goals are called SLOs (service level objectives) or non-functional requirements. Without them, a test report is just a pile of charts.

A healthy test process

  1. Define goals and the user journeys that matter (the top ones, not every page).
  2. Prepare a test environment resembling production in size and data volume. Never test a third-party site you do not own.
  3. Script and debug with one user, then a few.
  4. Run baseline, load, then stress tests, changing one thing at a time.
  5. Monitor the server while the test runs.
  6. Analyze, fix, re-test. A fix is only a hypothesis until a repeat test confirms it.

Keep test conditions repeatable: same data, same ramp-up, same duration. Compare runs against each other, not against your hopes.

Common mistakes

  • Testing from the same machine as the server (the load generator steals CPU).
  • Ignoring warm-up: the first minute includes cold caches and JIT compilation, so exclude it from the numbers or ramp up gently.
  • Reusing one user account for every thread, which hits caches unrealistically.
  • Reading only the average.
  • Testing production without permission or a rollback plan.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which test type raises load step by step until the system fails?

    A stress test pushes beyond normal load to find the breaking point and see how the system fails.
  2. 2. A run has a mean of 245 ms but a p99 of 3000 ms. What does that suggest?

    The mean hides the tail. Percentiles show what the slowest users experience.
  3. 3. With Little's Law, 100 users with 1 s response time and 9 s think time produce about how many requests per second?

    X = N / (R + Z) = 100 / (1 + 9) = 10 requests per second.
  4. 4. Why should you write performance goals before testing?

    Numeric goals (for example p95 under 800 ms) turn measurements into a decision.

Summary

  • Smoke, load, stress, spike and soak tests each answer a different question.
  • Track response time (with percentiles), throughput, error rate, concurrency and server resources.
  • Averages hide slow tails; use p90, p95 and p99.
  • Little's Law: throughput = users / (response time + think time).
  • Define numeric goals first, test a realistic environment, and change one variable at a time.

Next: Installing JMeter