How familiar are you with stress testing? 🧐 Let’s have an overview! In this article, we will discuss what it is, why we should perform it, a good strategy, and some pros and cons. You will also be provided with a list of tools to perform it. So let’s get started!
What Is Stress testing?
Stress testing is one of the non-functional testing types of performance testing. Stress testing is performed to determine the reliability and effectiveness of a machine, program, or network under unfavorable conditions 🔧
Unfavorable conditions cover running some high-processing applications on a single machine at the same time, flooding a server with numerous requests, making concurrent attempts to access a single website, DoS attacks, etc. This type of testing is generally done on critical software but can be used as per the requirement.
Stress testing focuses on robustness, availability, and error handling under a heavy load rather than on what is the behavior under normal situations. It is performed to ensure that the system does not completely crash under heavy traffic, and if it happens, the software can recover as soon as possible.
To cut a long story short, you need to put some ‘stress’ on a machine, program, or network to find out whether it survives and recovers from it or not.
Why Stress Testing?
Let’s look at a few examples to understand the importance of stress testing. Consider the following cases:
- A live-streaming site may witness a spike in traffic during excellent football league matches
- Flight booking websites are flooded with booking requests during festive seasons
- Spike in traffic on e-commerce sites during Black Friday sales
Heavy traffic on the sites or programs can occur at any point in time. It is a must to accommodate such traffic. If the program or site fails to make room for such traffic, it may result in a loss of revenue and reputation.
Reasons to Performe It
- To recognize whether the system can handle heavy traffic or not
- To inspect proper error handling while the system is under stress
- To potentially avoid enormous revenue loss caused by system failures
- To identify the breakpoint of the system
Stress testing should not only be considered for web apps, but also for native apps for the commonly used features.
Stress Testing Strategy
Start with identifying the scenarios, and functionalities that would be having heavy traffic and may break the system 🔎 Then identify the performance criteria i.e. identify the maximum and minimum load that the system can experience on a given day.
Use 3–4 different computer systems for testing with different memory settings, processors, etc. Then prepare realistic data that’s similar to the production environment to perform the stress tests. To execute the stress tests, use any tool to create the concurrent requests for identified functionalities.
Try to get the value of the breakpoint, the value below the breakpoint, and the value above the breakpoint. Also try to stress test with a slow network as well. Perform the same tests multiple times and then come to the conclusion for the breakpoint of the system.
Lastly, try to identify the behavior of the system at the breaking point. Whether the system can handle a few of the features like logging in, performing some action, etc., or is it not able to handle any requests at all.
Things to monitor
- Error logs– Number of errors generated while performing stress testing.
- CPU usage– CPU usage should be monitored. If it reaches 100 percent then we can say that the server is under heavy traffic.
- Memory usage– Memory usage during stress testing is used to identify whether the application, program or service consumes appropriate memory.
- Database connections– This observation helps to identify if any unnecessary database connections are open during stress testing. It should be maintained during the load.
- Response time of requests– This inspection is required to check whether the program is able to return the response within the expected time during the load.
- Disk I/O speed, transfer and read/write ratios– Disk I/O reads and writes much slower than memory does. It is better to observe these stats since slow I/O operations can affect the entire system.
- Network I/O speed, and transfer packet size– Read and write operation on network data is similar to the disk I/O. This stat should be observed during the stress tests because of the uncertainties of the network.
- The most resource consuming processes– Normally this stat is observed to identify which process consumes most of the resources. This can be monitored by the task manager.
Stress Testing Advantages
✅ Can prevent business loss, which might happen if the software is not capable enough to handle huge traffic.
✅ Stress testing can help determine that the software would work in normal as well as abnormal conditions.
✅ Helps in identifying memory leaks and loss of resource issues that cannot be found with other functional or non-functional tests.
✅ Helps to identify the system’s behavior after the failure, and makes sure it recovers quickly from the crashes.
✅ Helps to identify system bottlenecks & whether a system can store data before the crash.
Stress Testing Disadvantages
❌ Major concerns in stress testing are to simulate the testing environment and keep it close to the production environment as much as possible.
❌ It will need a good amount of scripting knowledge.
❌ Incorrectly performed stress testing can lead to a false performance matrix and waste of time.
Stress Testing Tools
🔨 NeoLoad– This is a popular tool available in the market to test web and mobile applications. This tool provides some out-of-the-box features. To name some: low-code or no-code approaches, automated script maintenance, automated CI pipeline. This tool can simulate thousands of users in order to evaluate the application’s performance. It is easy to use, cost-effective, and provides good scalability.
🔨 JMeter– JMeter is an open-source tool. It is a pure Java application for stress and performance testing. This tool can be used to generate stress on servers with multiple requests.
🔨 LoadRunner– LoadRunner is used to test applications, measure system behavior, and performance under load. LoadRunner supports performance testing for the widest range of protocols, 50+ technologies and application environments. Test results shaped by LoadRunner are considered a benchmark.
To conclude this article, we can say that it’s a best practice to perform stress testing before a launch. That is so we can improve the system and get ready for the worst that can happen 💪