Performance and Load Testing with Apache JMeter
A website may work well for one person but slow down when many people use it. Performance testing measures speed, stability and the ability to handle more work.
A load test sends requests like many users at once. You measure reply times, completed requests and errors. These numbers help you find which part needs attention.
Performance testing measures how quickly and reliably a system works under a chosen amount of work. It can also check how the system handles more users or requests.
Booking a ticket at 3 a.m. is quick. At 10 a.m. on Tatkal booking time, lakhs of people click together and the site may slow down or fail. Performance testing is creating that 10 a.m. rush on purpose, before real users face it.
Types of performance test
| Type | Load pattern | Goal |
|---|---|---|
| Load test | The expected number of users at the same time | Does it meet the speed targets at normal peak? |
| Stress test | More than expected, until it breaks | Where and how does it fail? |
| Spike test | A sudden jump in users | Does it survive a flash crowd? |
| Soak (endurance) test | Normal load for many hours | Any memory leaks or slow decline? |
| Scalability test | Load increased step by step | Does adding servers add capacity? |
Key metrics
| Metric | Meaning | Good sign |
|---|---|---|
| Response time (latency) | Time from sending a request to getting the full answer | Low and steady |
| Average / median / 90th–99th percentile | The typical and the worst-case user experience | p90 within target |
| Throughput | Requests handled per second | Grows with users until the system is full (saturation) |
| Error % | Requests that failed | Near 0 % |
| Concurrent users | Users active at the same time | – |
| Resource utilisation | CPU (Central Processing Unit), memory, DB connections on the server | Below the limit |
Apache JMeter
Apache JMeter is an open-source Java tool for load-testing web applications and APIs (Application Programming Interfaces). It pretends to be many users (threads) sending requests, and measures the responses.
flowchart TB
TP[Test Plan] --> TG["Thread Group<br/>users · ramp-up · loop count / duration"]
TG --> CFG["Config elements<br/>HTTP Request Defaults, CSV Data Set, Cookie Manager"]
TG --> S1["Sampler: HTTP Request GET /home"]
TG --> S2["Sampler: HTTP Request GET /products"]
TG --> T["Timer<br/>think time between requests"]
S1 & S2 --> AS["Assertions<br/>response code 200, text contains…"]
TG --> L["Listeners<br/>Summary Report · Aggregate Report · View Results Tree · Graph"]
| Element | Purpose |
|---|---|
| Thread Group | The number of virtual users, the ramp-up period (how quickly they start), and the loop count or duration |
| Sampler | The request that is sent – usually an HTTP (Hypertext Transfer Protocol) Request |
| Config element | Shared settings – server name, CSV (Comma-Separated Values) test data, cookies |
| Timer | "Think time" so users behave like real people, not robots |
| Assertion | Marks a sample as failed if the response is wrong |
| Listener | Collects and shows the results – Summary/Aggregate Report, graphs |
Reading an Aggregate Report
| Label | # Samples | Average | 90% line | Error % | Throughput |
|---|---|---|---|---|---|
| GET /home | 5000 | 210 ms | 380 ms | 0.00 % | 82/sec |
| GET /products | 5000 | 640 ms | 1450 ms | 1.20 % | 79/sec |
How to read it: /products is the bottleneck (the slow point) – its p90 (1450 ms) and error rate (1.2 %) are high. Next steps: check the database query, add caching or indexes, then test again.
Know the difference between load, stress, spike and soak tests, define throughput and response time, and name the JMeter elements Thread Group → Sampler → Assertion → Listener. Ramp-up = the time taken to start all threads.
Practise it
Virtual lab · Testing Tools · 35 min
Load-test the VLP Demo Store with Apache JMeter
Build a JMeter test plan with a thread group, HTTP defaults, four samplers, think time, assertions and listeners, then run it with 50, 100 and 200 users and find the bottleneck from throughput, percentiles and error rate.
Quick revision
- Load = expected users; stress = beyond limits; spike = sudden jump; soak = long duration.
- Measure response time (percentiles), throughput and error %.
- JMeter: Test Plan → Thread Group → Samplers → Assertions → Listeners.
- Ramp-up controls how fast virtual users start.
- Find the bottleneck, fix it, and test again.
Practise this topic
Hands-on virtual lab
Apply what you just read in a realistic, guided simulation. Free with a verified account.
Create a free account to track your progress and unlock virtual labs.