You know that your website is hosted on a server, whether it's in the cloud or in that cold closet on the other side of the office. Servers can only handle so much traffic before all of their resources are used up. Once those resources are at max capacity, users will have issues with the website and it will run extremely slow or crash. Before you get to that situation, consider doing some load testing.
What load testing is
Load testing is a specific kind of performance testing. You're usually trying to find out what the maximum operating capacity of an application is under real-world user conditions. Most site owners expect their traffic to grow over time and they want to know that their website can handle that extra traffic. Load testing tells you how the application behaves when a bunch of users are accessing it.
Typically, load testing is used for web-based applications because you are pushing the limits of a server. This is a non-functional kind of testing. With functional testing you can predict what results you'll get and they are only dependent on the test data. With a non-functional test like load testing, you never know what your results are going to be and it's completely dependent on the number of users in a system.
Why we do load testing at all
You don't want your website to go down when you start getting a lot of traffic, right? Load testing tells you the number of concurrent users your application can support and it lets you know if your server has enough resources to scale and run the application. Most businesses want to know this kind of information because they want to make sure that their website is always up.
When a website goes down because the server can't handle the user load, businesses lose a lot of money really fast. Even if the website loads, if it takes more than a few seconds people will leave. Load testing gives you the assurance that you are able to handle any users that come your way. It also tells you if there is any lag between the client and server.
Once you finish testing, you will be able to see where your system can be improved. That might mean buying more server resources, like memory, or making performance enhancements to the software. You learn all of this before your website gets that rush of users so you can be better prepared for them.
How load testing works
The specifics of load testing depends on the system you are working with. Most cloud services have their own tools, but there are third-party tools available too. Regardless of the tool you decide to use, there are some general steps you can take to perform a good load test.
First, you'll need to make a testing environment. This could be the development or QA environment if you have clearance to use them for this purpose. You never want to do load testing in production simply because there are real users accessing that application. After you have the test environment ready, decide what kinds of test transactions you want to use.
This includes any data you need, the number of users you want the system to simulate, any server configurations, which browsers and operating systems you want to target, and connection speeds. Another thing you need to know is what metrics you are looking at. Are you trying to see the max number of users your system can currently support or are you looking at the memory capacity? You need to know what you are looking for or else you won't get much value from the load test.
Once you have all of that information, you can go ahead and run the test. Then you'll analyze your results and be able to make recommendations on what to improve in the system and how to do so. Based on the feedback you get from others, probably from the business side, you'll make adjustments to the system until it gives you the results you want.
This might be classified as a task for DevOps, but a developer should have this in their toolbox as well. Has anyone gotten weird results from running a load test? Or does anyone have specific tools they would recommend for running load tests?
Hey! You should follow me on Twitter because reasons: https://twitter.com/FlippedCoding