The concept of load testing seems simple. You just run a test against your app, API or site and see how it performs under a simulated user load. But the reality is slightly more complex. There are three load tests you must run to optimize performance.
We’ve learned the three load tests through our experience helping thousands of customers, and now you can benefit from those insights.
We recommend you run tests in this order:
- Ongoing “TEAR” testing.
1. Baseline Tests
Especially if this is your first time load testing, your first test should be a baseline test. A baseline test helps you understand performance under optimal conditions with low simulated, virtual users (VUs). When you set up your testing schedule with your CI / CD tools, establishing your benchmark performance makes it easy to set pass/fail thresholds for automated testing. (For a concrete example of how to set this up with CircleCI, see our article here.)
Run a baseline test anytime there’s a new project, a major update, or any other significant change to code. It’s a low-impact way to identify any major performance issues without in-depth performance analysis and tuning. Plus, it gives you the chance to set a target for performance, seeing how your app, API or site performs under low stress.
2. Stress Tests
After you’ve worked through baseline test(s), try a stress test. As the name implies, here you’re trying to test your project’s performance under stress, increasing the load step by step. With a stress test, you learn what could happen when everything goes wrong (or very very right) - how your site or app performs when a huge level of users visit. It helps you identify what the worst case scenario is - and where the weak points in your code or systems are.
Iterate as you step up to different simulated, virtual user (VU) levels, fixing any performance issues along the way. The idea is to go until something breaks, fix it, and keep going. (Find more example configurations here.)
3. Iterative Tests (TEAR)
After these efforts, we suggest you continually verify your project’s performance with load tests. As with every test, our customer success team recommends you “TEAR” into your load tests. TEAR means Test -> Evaluate -> Adjust -> Repeat.
After each test, especially your scheduled benchmark tests, evaluate the results. Did the test pass your minimum benchmark? If not, adjust accordingly: which piece of code or system element changed? Then, as with all tests, repeat regularly.