What Is Stress Testing, and How Do You Run It?
Stress testing pushes a system past its normal load until it breaks. Here is how it differs from load testing, and how to run one before users meet the failure.
On this page
Short answer
Stress testing is a type of software testing that pushes a system beyond its normal load until it fails, so the team learns the breaking point, how the system fails and whether it recovers cleanly. It differs from load testing, which checks the system at expected load, because stress testing deliberately goes past the limit to find what breaks first.
What is stress testing?
Stress testing is software testing that applies more load, data or users than the system is designed to handle, and watches where it breaks. The goal is not to prove the system works, but to find the point where it stops working and to see how it behaves at that point.
A system under stress can fail in several ways: it can slow down, return errors, drop requests or stop entirely. The test records which failure appears first and at what load, because that tells the team what to fix before users meet the same failure in production.
Stress testing also checks recovery. After the extra load is removed, the system should return to normal on its own, without a restart or manual repair. A system that stays broken after the load drops has a deeper problem than a slow response. The system testing guide covers where stress testing sits among the other test levels.
How is stress testing different from load testing?
Stress testing and load testing look similar, but they answer different questions. Load testing asks whether the system handles the load it is expected to meet, while stress testing asks what happens when the load goes past that point. The table below compares them.
| Point | Load testing | Stress testing |
|---|---|---|
| Question | Does it handle expected load? | Where does it break? |
| Load level | Normal to peak, as designed | Beyond the designed limit |
| Goal | Confirm performance targets | Find the breaking point |
| Failure | Not expected | Expected and studied |
| Recovery | Not the focus | Must return to normal |
| When to run | Before each release | Before peak events |
Teams need both. Load testing proves the system meets its targets, and stress testing shows what happens on the day the targets are wrong, such as a sale that draws twice the expected traffic. The load testing tools guide covers the tools that run both kinds of test.
What does a stress test measure?
A stress test measures the breaking point, the failure mode and the recovery time. The breaking point is the load where errors start or response times pass the limit the team accepts, and it should be written down as a number, not a feeling.
The failure mode matters as much as the point. A system that slows down gracefully is safer than one that drops requests without a message, and a system that returns clear errors is safer than one that corrupts data. The team should record exactly what users would see at each load level.
Recovery time is the third measure. After the load drops back to normal, how long until errors stop and response times return to normal? A system that recovers in seconds is ready for a real spike, while one that needs a restart is not, even if it handled the same load for a while.
How do you run a stress test?
You run a stress test by starting at normal load, raising it in steps past the designed limit, and watching errors, response times and resource use at each step until the system breaks, then dropping the load and watching recovery.
- Set the limit. Write down the load the system is designed for and the error rate you accept.
- Build a realistic test. Use real user journeys, not a single page, so the load matches production.
- Raise the load in steps. Add users or requests gradually, and hold each step long enough to see the effect.
- Watch the whole system. Track errors, response times, CPU, memory and database load together.
- Record the breaking point. Note the load, the first failure and what users would see.
- Drop the load and watch recovery. Check that errors stop and the system returns to normal on its own.
Run the test in an environment that matches production as closely as possible. A test on a small staging server breaks at a lower load than production would, which teaches little about the real limit.
Example (hypothetical): stress testing a checkout
Example (hypothetical): a shop expects 5,000 checkouts an hour at peak, and the team runs a stress test with 10,000 virtual users, each sending one request every 10 seconds. That is 10,000 divided by 10, or 1,000 requests a second, far above the expected load.
The system holds until 800 requests a second, then errors start. At 1,000 a second, the error rate reaches 12 in every 100 requests, and the response time rises from 180 milliseconds to 2,400 milliseconds. The database is the bottleneck: its connection pool is full, and new requests wait and then time out.
When the load drops back to 200 requests a second, errors stop after 3 minutes and response times return to normal without a restart. The test found the breaking point at 800 a second, the failure mode, and a clean recovery, which is exactly what a stress test is for. The numbers are invented to show the arithmetic, not a real result.
What are the common mistakes?
The most common mistakes in stress testing are testing the wrong environment, raising the load too fast, and ignoring recovery. Each one wastes the test, because the result does not describe production.
- Testing a small staging server. It breaks at a lower load than production, so the breaking point is wrong.
- Raising load in one jump. A sudden jump hides the step where the first failure appears.
- Testing one page only. Real users follow journeys, and a single-page test misses the slow steps.
- Ignoring recovery. A system that needs a restart after a spike is not ready, even if it held the load.
- No owner for the result. A breaking point nobody acts on is just a report.
Fix the environment first, then the test. A stress test on a server that matches production is worth more than a perfect test script on a server that does not. The functional versus integration testing guide covers the test levels that run before stress testing.
How do you fix what a stress test finds?
You fix what a stress test finds by starting with the first failure, not the loudest one. The first failure is usually the bottleneck, and fixing it moves the breaking point higher, which is the point of the test.
Common fixes include raising the database connection pool, adding caching for the most-read data, splitting a slow step into a background job, and adding limits so one user cannot take all the capacity. Each fix should be tested again with the same stress test, so the new breaking point is measured, not guessed.
Some failures cannot be fixed by code alone. If the breaking point is close to the expected peak, the team may need more capacity or a queue that holds extra work until the system catches up. The decision is a trade-off between cost and risk, and the stress test gives the numbers to make it.
Key takeaways
- Stress testing pushes a system past its limit to find where it breaks
- Load testing checks expected load; stress testing finds the breaking point
- Record the breaking point, the failure mode and the recovery time
- Raise the load in steps and watch the whole system, not one metric
- Fix the first failure first, then re-run the same test
Frequently asked questions
How often should stress testing be done?
Run it before peak events, such as a sale or a launch, and after any change that affects capacity, such as a new feature or a database change. A regular schedule, such as once a quarter, catches slow drift in performance before it becomes a failure.
Is stress testing the same as spike testing?
No, though they are related. Stress testing raises the load past the limit and holds it there, while spike testing jumps the load up suddenly and drops it, to see how the system handles a sudden surge. Both are useful, and they test different weaknesses.
Can stress testing damage production data?
It can, which is why it is run in a test environment that mirrors production, with test data. Running a stress test against live production risks real users and real data, and should only be done with a plan, limits and a rollback.
What load should a stress test start from?
Start at the normal load the system sees on a busy day, then raise it in steps of about a quarter of the designed limit. Steps that are too large hide the exact point where the first failure appears, which is the number the team needs.
What if the system never breaks in a stress test?
That usually means the test did not push hard enough, or the test environment is stronger than production. Raise the load further, add more data, or check whether the test is really reaching the system it is meant to stress.
Who should own stress test results?
One person should own the result and the fixes, usually the lead developer or the performance owner. Without an owner, the breaking point gets written in a report and nothing changes before the next peak.