This blog post is the first one in a three-part series. If you want, you can read the second and third parts as well. Let’s say you are building a website that allows users to create an account, upload photos and browse around. So you will go ahead and define the functionality, design the interface, build the core backend and add all the necessary infrastructure. But how will you know if your design is strong enough the handle everything? How will you know if the website will perform well when a lot of users use it simultaneously? This is where load testing comes into picture.
Wait a minute, why do I need to worry about all that?
As it turns out, there is no magic genie sitting behind all the websites granting them infinite power to handle everything. When you are building such a website, you need to know how your site will react under different situations. As of now, Amazon Web Services is doing a pretty good job of being that genie, but you still cannot be blatantly unaware of these things. You need to be aware of your resources and constraints. If you don’t design your site properly, then it will behave erratically when a lot of users simultaneously use it.
What exactly is load testing?
Load testing is also called endurance testing or volume testing, and is designed to test the non-functional requirements of a software application. It is used to test a system by constantly and steadily increasing the load on the system, until it reaches the threshold limit. This way, we know exactly what is going to happen and we can examine the behavior of a system when subject to both normal and extreme expected load conditions. It will help you design your site so that it behaves appropriately when it reaches the limit. It is actually the simplest form of testing, and we can use scripts and automation tools to achieve this.
Is it only used deep inside the code or is there a good demonstrative example?
How can there not be a good example? Of course there is. If we look around, we will always find good examples. Let’s say we want to check the email functionality of an application. It could be flooded with, say, 10,000 users at a time. Now, those 10,000 users can fire the email transactions in many different ways like reading, sending, deleting, forwarding, replying, etc. As far as the backend server is concerned, every one of those actions is treated as a transaction. If we take one transaction per user per hour, then we will have 10,000 transactions per hour for the server to deal with (because there are 10,000 users). Let’s say we simulate 10 transactions per user per hour, then it would mean the server has to deal with 100,000 transactions per hour. This way, we could load test the email server by giving it 100,000 transactions per hour and monitoring its behavior.
Another popular example would be testing an e-commerce website’s shopping cart capacity. Any kind of crash on an e-commerce site would be really bad for the business. It just doesn’t sit well with consumers! So you better load test it. Testing the hard disk drive capability to read and write as per its specifications is another example. Load testing basically helps to find out the maximum amount of load an application can withstand. The success criterion of load testing is based on the completion of all the test cases without any errors and within the allotted time frame.
What do we achieve by the end of all this?
The sole purpose of load testing is to assign the system the largest job it could possibly handle, and then monitoring the results. We test the system’s endurance and modify our design accordingly. Sometimes the system is just fed an with empty task to determine the behavior of the system in zero-load situation. Basically, the goals of load testing are to expose the defects in application related to memory leaks, buffer overflow and memory mismanagement. Another target of load testing is to determine the upper limit of all the components of application like database, hardware, network, etc so that it could manage the anticipated load in future. The issues that would eventually come out as the result of load testing may include load balancing problems, bandwidth issues, capacity of the existing system etc. These are very critical to the success of any site. If you do this right, nobody will notice anything. If you do this wrong, you will face the wrath of the angry users.
2 thoughts on “Why Do We Need Load Testing?”