Kinds of load testing and JMeter
Load testing checks the expected load, stress finds the limit and recovery, spike checks a sudden jump, and soak (endurance) checks stability over hours. Measure response-time percentiles (p95, p99), throughput and error rate rather than the average, together with server metrics. In JMeter a Thread Group sets users and ramp-up, a Sampler is a request, Assertions check the response, and a big test runs in non-GUI mode.
QA Fundamentals · Types of testing
The site handles 100 users. What happens when a mailing brings 10,000?
The page was checked by hand and on a test stand with a few people: everything is fast. On mailing day the site answers in thirty seconds, then starts returning 502. The different kinds of load testing exist precisely because "slow" has different causes: too many users, a sudden jump, long work without a break. The lesson covers these kinds, the metrics and how JMeter is organised.
How it works and why. In ISTQB performance is a non-functional characteristic (performance efficiency), and performance testing checks it under load. Different kinds answer different questions:
| Kind | Question | What we look for |
|---|---|---|
| Load | Does the system cope with the expected load? | Response time and errors within the SLA, for example 1000 concurrent users at peak |
| Stress | Where is the limit and how does the system behave beyond it? | The failure point, whether it recovers after the load drops |
| Spike | What if the load grows suddenly? | A sale or a mailing: queues, timeouts, autoscaling |
| Soak (endurance) | Is the system stable for hours? | Memory leaks, growing queues, degradation |
| Scalability | Will adding resources help? | How performance depends on the number of nodes |
Load profiles over time
The result is not "held or not" but a set of measurements: response time (the average misleads, so percentiles p95 and p99 are used), throughput (requests per second), error rate, resource usage (CPU, memory, database connections). Simple relations help planning: the number of requests in flight at once is roughly throughput times response time (Little's law): 200 requests per second at 0.5 s give about 100 concurrent requests.
Example: from "100 threads, average 280 ms" to a test you can believe.
A load test
100 threads, ramp-up 0, one user, average 280 ms
All threads start together, the same request hits the cache, there are no pauses, and only the average is looked at. "Passed" guarantees nothing.
A scenario by a real user profile
A gradual ramp-up, different data, pauses between actions, a mix of requests, thresholds on p95/p99 and the error rate. The test can be repeated and compared.
JMeter. A popular open-source tool for load testing at the protocol level (HTTP and others; it does not run a browser with JavaScript). The base is a Test Plan, where a Thread Group sets the number of virtual users (threads), the ramp-up (over what time they start) and the number of iterations or the duration. A Sampler is the request itself (for example an HTTP Request). Assertions check the response (status, text, time), Listeners collect results, Config Elements (CSV Data Set Config, HTTP Header Manager, HTTP Request Defaults) set data and shared settings, and Timers add pauses between actions (think time).
Test Plan
|- HTTP Request Defaults (server, port)
|- HTTP Header Manager (Authorization, Content-Type)
|- CSV Data Set Config (users.csv: login, password)
|- Thread Group (200 users, ramp-up 60 s, 10 min)
| |- HTTP Request: POST /login
| | '- Response Assertion (status 200, body has "token")
| |- Uniform Random Timer (think time 1-3 s)
| '- HTTP Request: POST /transfers
'- Summary Report
A real run is started in non-GUI mode, and the graphical interface is left for debugging the scenario:
jmeter -n -t plan.jmx -l results.jtl -e -o report/
Here -n is non-GUI, -t the plan file, -l the results file, -e -o generate an HTML report into the given (empty) folder. Heavy listeners such as View Results Tree are switched off for a large test: they create load on the generator themselves.
Limits and alternatives. A result on a smaller stand does not scale linearly to production. The load generator itself can become the bottleneck: if it is overloaded, the measured latency is wrong, and then the test is run distributed. Server metrics (CPU, memory, database) are watched as well, otherwise you see only the symptom. Without a goal (SLA, SLO) a test proves nothing. Alternatives to JMeter: k6 (scripts in JavaScript), Gatling, Locust (Python). Testing production should be done only by agreement and carefully.
Common mistakes.
- Ramp-up 0 and no pauses: an unrealistic burst that hardly resembles real users.
- The same data for everyone: the cache distorts the result.
- Looking only at the average: the tail of slow requests is lost.
- Running a big test from the GUI with heavy listeners: the generator becomes the bottleneck.
- Having no goal and thresholds: after the test it is unclear whether it is good or bad.
- Ignoring server metrics: we see "slow" but not the cause.
Check yourself
An 8-hour overnight test at normal load: the service memory grows from 2 to 7 GB. What kind of test is it and what did it show?
Answer
Soak (endurance) testing. It showed a sign of a memory leak: under steady load the resource is not released. A short load test would not have seen it, because the problem appears only over time.
The average response time is 280 ms, yet users complain about slowness. Why does the average not match?
Answer
The average hides the tail: a small share of very slow requests barely moves the average, but that is exactly what users feel. I look at percentiles p95 and p99, the breakdown by endpoint and the errors.