2. Load Testing
2. Load Testing
Concurrent users are those who log in to the application and at the same
time, perform a set of activities together and log off the application at the
same time. On the other hand, virtual users just hop in and hop out of the
system irrespective of the other user activities.
Load Test Architecture
In the diagram we can see how different users are accessing the application. Here
each user is making a request over the internet, which is later passed through a
firewall.
After firewall, we have a Load balancer which distributes the load to any of the web
servers, and then passes to the application server and later to the database server
where it fetches the necessary information based on the user request.
Manual and Automated Load Testing
Load testing can be done manually as well as by using a tool. But manual
load testing is not advised as we don’t test the application for a lesser load.
Example: Let’s assume, that we want to test an online shopping application to see the response time
of the application for each user click i.e Step1 –Launch URL, the response time, Login to the
application and note the response time and so on like selecting a product, adding to the cart, making
payment and logging off. All these have to be done for 10 users.
So, now when we need to test the application load for 10 users then we can achieve this by manually
putting load by 10 physical users from different machines instead of using a tool. In this scenario, it
is advisable to go for a manual load test rather than investing in a tool and setting up an environment
for the tool.
Whereas imagine if we need to load test for 1500 users then we need to automate the load test using
any of the available tools based on the technologies in which the application is built and also based
on the budget that we have for the project.
Commercial tools and Open source tools
Meanwhile, there comes a peak day i.e let’s say the Thanks Giving
day and there are thousands of users who are logged in to the
system, the system is crashed all of a sudden and the users
experience a very slow response, some couldn’t even log in to the
site, a few failed to add to cart and some failed to check out.
Why Load Testing?
Hence on this big day, the company had to face a huge loss as it lost many
customers and much business too. All this happened just because they didn’t
predict the user load for peak days, even if they would have predicted there
was no load test done on the company website, hence they don’t know how
much load the application will be able to handle on the peak days.
Thus to handle such situations and in order to overcome huge revenue, it’s
advisable to conduct load test for such type of applications.
Thus always try to have a dedicated environment for Load testing which is similar to that
of a production environment.
Also, sometimes we have third-party applications which our system will call, hence in
such cases, we can use stubs as we can’t always work with the third-party vendors for data
refresh or any other issues or support.
Try to take a snapshot of the environment once it is ready so that, whenever you want to
rebuild the environment you can use this snapshot, which would help with time
management. There are some tools that are available in the market to set up the
environment like Puppet, Docker etc.
Approach
Before we start the Load test we need to understand if any Load
test is already done on the system or not. If there was any load
testing done earlier, then we need to know what was the
response time, client and server metrics collected, how much was
the user load capacity etc.
Also, we need information on how much is the current application
handling capability. If it’s a new application we need to
understand the requirements, what is the targeted load, what is
the expected response time and if it is really achievable or not.
If it is an existing application, you can get the load requirements
and the user access patterns from the server logs. But if it is a
new application then you need to reach out to the business team
to get all the information.
Approach Cont…
Once we have the requirements, we need to identify how
we are going to execute the load test. Is it done manually
or using tools? Doing a load test manually needs a lot of
resources and is very expensive too. Also repeating the
test, again and again, will be tough as well.
Hence, to overcome this we can either use Open source
tools or commercial tools. Open source tools are available
for free, these tools may not have all the features like the
other commercial tools but if the project has a budget
constraint, then we can go for open source tools.
Whereas commercial tools have many features, they
support many protocols and are very user-friendly.
Load Test approach will be as follows:
If it is a newly build application then we need to work with the business teams to understand the flow
patterns, application usage etc. Sometimes the project team will conduct workshops to give an overview or
details about each component of the application.
We need to attend the application workshop and note all the required information to conduct our load test.
Load Test approach Cont…
3) Work Load Modelling
Once we have the details about the business flows, user access patterns and the number of
users, we need to design the workload in such a way in which it mimics the actual user
navigation in production or as expected to be in the future once the application will be in
production.
The key points to remember while designing a workload model is to see how much time a
particular business flow will take to complete. Here we need to assign the think time in such
a way that, the user will navigate across the application in a more realistic way.
Overview of the application – Let’s assume an online shopping, where the users will log into the application and have a wide
variety of dresses to shop, and they can navigate across each product.
To view the details about each product, they need to click on the product. If they like the cost and make of the product, then
they can add to the cart and buy the product by checking out and making the payment.
Browse – Here, the user launches the application, Logs into the application, Browses through different categories and Logs
1.
Browse, Product View, Add to Cart – Here, the user logs into the application, Browses through different categories, views
2.
Browse, Product View, Add to Cart and Check out – In this scenario, the user logs into the application, Browses through
3.
different categories, views product details, adds the product to the cart, does check out and Logs out.
Browse, Product view, Add to cart Check out and Makes Payment – Here, the user logs into the application, Browses
4.
through different categories, views product details, adds the product to the cart, does check out, makes Payment and Logs out.
Load Test approach Cont…
Virtual User Transactions
S.No Business Flow Number of Load Response % Failure rate per hour
Transactions Time (sec) allowed
#5) Execute Load Test – Before we execute the Load test, make sure that the application is up and
running. The Load test environment is ready. The application is functionally tested and is stable.
Check the configuration settings of the Load test environment. It should be the same as the
production environment. Ensure all the test data is available. Make sure to add necessary counters to
monitor the system performance during test execution.
Always start with a low load and gradually increase the load. Never start with the full load and break
the system.
#6) Analyze the Load Test Results – Have a baseline test to always compare with the other test
runs. Gather the metrics and server logs after the test run to find the bottlenecks.
Some projects use Application Performance Monitoring Tools to monitor the system during the test
run, these APM tools help to identify the root cause more easily and save a lot of time. These tools are
very easy to find the root cause of the bottleneck as they have a wide view to pinpoint where the
issue is.
Load Test approach Cont…
Load testing finds its application in a wide array of scenarios across diverse industries and
applications. Here are several instances where load testing proves crucial:
• Online Retail Sites: For online retail websites, load testing is done to mimic heavy user activity
during peak shopping seasons like Black Friday or Cyber Monday. This process verifies the website's
ability to handle high traffic and transaction volumes without experiencing slow-downs or crashes.
• Online Gaming Platforms: Load testing in online multiplayer games simulates thousands of
simultaneous players interacting with the game. This helps to confirm that the game servers can
manage this load without any lags or downtime, thereby offering a smooth gaming experience.
• Streaming Platforms: In the case of streaming services, load testing emulates thousands of
users streaming content at the same time. This ensures the service can offer high-quality
streaming without any buffering, even during peak viewing hours.
• Banking Applications: For banking applications, load testing can replicate scenarios such as high
transaction loads at the end of the month. This makes sure the application can manage the surge
in activity without encountering any errors or delays.
• Mobile Apps: Load testing can mimic many users interacting with a mobile application
simultaneously. This helps ensure the app stays responsive and stable even under heavy load.
• Web Services or APIs: Load testing can be employed to test web services and APIs. This is
achieved by sending a large number of requests to check if the service or API can manage the load
and respond promptly
Examples of Load Testing
Load testing finds its application in a wide array of scenarios across diverse industries and
applications. Here are several instances where load testing proves crucial:
• Online Retail Sites: For online retail websites, load testing is done to mimic heavy user activity
during peak shopping seasons like Black Friday or Cyber Monday. This process verifies the website's
ability to handle high traffic and transaction volumes without experiencing slow-downs or crashes.
• Online Gaming Platforms: Load testing in online multiplayer games simulates thousands of
simultaneous players interacting with the game. This helps to confirm that the game servers can
manage this load without any lags or downtime, thereby offering a smooth gaming experience.
• Streaming Platforms: In the case of streaming services, load testing emulates thousands of
users streaming content at the same time. This ensures the service can offer high-quality
streaming without any buffering, even during peak viewing hours.
• Banking Applications: For banking applications, load testing can replicate scenarios such as high
transaction loads at the end of the month. This makes sure the application can manage the surge
in activity without encountering any errors or delays.
• Mobile Apps: Load testing can mimic many users interacting with a mobile application
simultaneously. This helps ensure the app stays responsive and stable even under heavy load.
• Web Services or APIs: Load testing can be employed to test web services and APIs. This is
achieved by sending a large number of requests to check if the service or API can manage the load
and respond promptly
Difference between Load Testing and Stress testing