User Load Testing: The Nitty-Gritties

Reading Time: 4 minutes

Imagine you create an application in isolation, which fails to deliver when put against real-life scenarios. It will be a great downer, isn’t it?

So load testing is a ‘One Step Ahead’ solution, where the performance of an application is measured by creating an environment using a certain volume of users and real-life scenarios.

The purpose of load testing is to identify:

  • The optimum capacity (operational) of an application
  • Sustainability of the infrastructure to run the application
  • The capacity of the application to handle peak user load
  • Scalability of the application, to increase the number of users accessing it.
  • Number of concurrent users that an application can support

What is the need for Load Testing?

Even the most popular websites get overwhelmed by massive traffic and face downtime issues because they aren’t scalable. We have covered it separately in another write-up of ours. Do give it a read.

Let’s take an example of E-commerce websites that put a lot of money in their advertising campaigns, but don’t enough muscle for Load Testing.

When their marketing efforts bring a huge volume of traffic, there have been instances where websites have failed to perform optimally.

Toysrus and Britannica faced the same fate.

Britannica made a promotional offer where they allowed free access to their online database. But they weren’t able to handle the huge volume of traffic for weeks that resulted because of the offer.

There are so many sites that experience delayed load times during heavy traffic.

Coming back to the question, why Load Testing?

The first and foremost objective of load testing is to identify the bottlenecks, which appear under stressful scenarios, like too many concurrent users. It’s better to weed out such bottlenecks before an application goes into an environment where stakes are high.

Moreover, you can determine the response time for each transaction, the individual performance of system components under different loads, and the network delay between the client and the server.

But it’s important to do your homework before putting your application under Load Test. In this regard, the most crucial metric is response time. So before you commence the process:

  • Have a quantitative analysis of the response time
  • Check whether the response time is relevant to your business process
  • See whether the response time is realistic or not
  • Make sure the response time is easily measurable using a stopwatch

The bottlenecks you find depends entirely on the quality of simulation or how realistic it is.

There are many variables that affect the quality of Load Test, with the most important being the number of concurrent users. Although there is no cap on the number of virtual users that you can have, load testing software is priced on the number of virtual users.

So you need to have an idea of the ‘Good Enough’ number.

How many concurrent virtual users do we need?

It’s not an easy task to zero in on this number. Let’s understand what Virtual Users are.

They are programs that behave like real users, by sending requests to an application. You can use any number of virtual users and create scenarios for them. You can select the browser, the connection speed, and fix other parameters using load testing tools.

Each virtual user can have a specific set of parameters, or there can be common parameters for all virtual users of the group.

The equation between concurrent users and requests per user:

(concurrent users) x (requests per user per minute) = total requests per minute

Let’s take an example to understand the significance of this equation.

Say there are 10,000 virtual users for a load test, with each of them making 3 requests per minute. So if we put these values in the above equation, you will get 30,000 requests per minute.

Now the thing is, the cost of carrying out a load test is proportional to the number of virtual users. So if you reduce the number of virtual users and increase the number of request per second you can still get the same result. In other words, you can still hit the back end with the same number of requests.

Lets see some of the scenarios:

(10,000) x (3) = 30,000
(5,000) x (6) = 30,000
(1,000) x (30) = 30,000
(10) x (3,000) = 30,000

How many real users do you need?

It’s always difficult to gauge real user-traffic for websites that haven’t launched yet.

You can always go for a soft launch (beta) to understand user behavior. Not just that, you can get an idea of the traffic-volume as well as usage patterns.

You can also do an analysis of similar websites. By doing this, you may realize that you are overdoing things and have resources that aren’t needed. It’s always better to get rid of the excess baggage in the initial stages.

Let’s see some of the popular Load Testing Tools

1. Locust

It’s an open source framework that is Python-based. You can write performance scripts purely in Python. Primarily web applications and web-based services are tested using Locust, but if you have mastered Python scripting, anything can be tested then. Its simulations are based on ‘Events Approach’.

This is why even on a laptop, you can simulate thousands of users. You can easily execute complicated scenarios having various steps.

By the virtue of being Python-based, it’s a cross-platform platform in nature. Due to its events based implementation, it’s highly scalable.

2. Gatling

It’s a free and open source performance testing tool, that has a basic GUI that’s limited to test recorder only.

That said, you can use domain-specific language to develop tests that are easily readable and writable.

It has a self-explanatory DSL for test development. Moreover, there are multiple input sources for data-driven tests.
Its assertion system is quite powerful and flexible at the same time. The load reports generated are a comprehensive and informative load.
peace

3. Apache Jmeter

It is a desktop application. The highlight of this tool is its user-friendly GUI, which makes developing tests and debugging very easy.

It has been seen as a good alternative (open source) to solutions like LoadRunner.

Its structure is modular, having plugin extensions. The plugins are developed by Apache Sofware Foundation as well as online contributors, which are incorporated as features.

It is also cross-platform in nature and can be run with Java on any operating system. It makes use of inbuilt as well as external listeners to analyze the test results.

 

We hope this write-up gave you considerable insight into the process of load testing. Do share your views and queries in the comment section.

Sadanand is a content curator and strategist. He understands the Startup gamut, be it ideation, product development, team building, sales, or marketing, and likes to keep up with the trend. His lucid writing style makes up for an intriguing read. His writeups are greatly followed and admired in various communities.