A load test example

Load tests are used to check how an application will behave once it is used for a determined number of concurrent users; the number of concurrent users is given for the number of users that the application will have in production. You should always define a performance test suite that tests the whole application with tools such as the following:

  • Neoload
  • Apache JMeter
  • Load Runner
  • Load UI
  • Rational Performance Tester

We need to define a load test and profile as part of a pipeline of our applications, and run it before and after we work on performance improvement. We are going to create an example using Neoload to review these key recommendations in our application example.

First, we need to define a scenario to run a load test; in our case, we are going to take the banking application from Chapter 12, Monitoring, that is ready to use, and define a functional common scenario such as the following:

  1. The user is going to log in using the credentials: rene/rene.
  2. Then, the user will click on the menu notifications.
  3. And finally, the user is going to click on the logout link.

First, we are going to download Neoload from the following URL: https://www.neotys.com/download.

Neoload gives us a trial version where we can simulate up to 50 virtual concurrent users.

After installing Neoload, we are going to open the application and create a project:

Then, we are going to click on Start Recording, and choose the browser that we are going to use to record our application:

Then, in the browser, we are going to enter the URL of our application: http://localhost:8080/login, and navigate as a user to list the notification set of our customer. So the process is as follows:

  1. Log in
  2. Click on the menu notifications
  3. Click on logout

Select the host that we are recording, which in our case is localhost, and follow the next instructions until the end. Finally, we are going click on the Stop recording button and we should see in the left-hand menu that our actions are recorded:

We are then going to run the recorded scenario by clicking on the check icon that can be seen hovering over the user icon:

We should see that our scenario runs without errors, simulating one concurrent user, as in the following screenshot:

Now, let's generate load testing, creating a population (casual user simulated scenario):

Then, click on the Runtime icon to run the load test with 10 concurrent users for 2 minutes:

And then, click on the play icon:

Finally, after the test finishes, we can check the results; denoting that we visited 670 pages and made 890 requests during the load test time, using 20 concurrent users:

On the other hand, during the load test using VisualVM, we can check the performance of our application and see how it performs at checking the threads, as demonstrated in the following screenshot:

We are going to find that the JVM, memory, and threads, with a simulation of virtual users, look different than just navigating on the application.

It's worth monitoring all the resources of an application when you run load tests to identify where an issue can rise. 

Finally, we have learned that using a profiler tool or an APM, in addition to a load test tool, can guarantee that our applications and system work on performance improvements before we launch our code to production environments.

After adding code to improve the performance of an application, it is always a good idea to run performance tests in order to check how well the changes have been implemented.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.205.27