Getting Started with JMeter Load Testing: A Step-by-Step Guide

Salami Faizah
8 min readMay 7, 2023

--

Load testing is the ultimate stress test for your application. It’s like putting your website or software through a grueling boot camp, pushing it to its limits and beyond. Why would you do this? Because you want to make sure your application can handle the heat when the going gets tough. So buckle up and get ready to learn all about load testing — the essential tool for any developer or tester looking to deliver a top-performing application.

Table of content

  • Introduction to Load Testing
  • Introduction to JMeter
  • Installation of JMeter software
  • Key terms involved when performing load testing with JMeter
  • Step-by-step process of load testing with JMeter
  • Conclusion

Introduction to Load Testing

In today’s fast-paced digital world, downtime can be disastrous for businesses, resulting in lost revenue, unhappy customers, and even reputational damage. Load testing is a critical process that determines the ability of a system to handle anticipated and unanticipated user traffic. It’s the practice of simulating real-world user activity on a software application to evaluate its performance under stress.
In this technical article, we will explore load testing in-depth and provide valuable insights on how to perform load testing effectively, with the help of the popular open-source tool, JMeter.

Introduction to JMeter

JMeter is a popular open-source software tool that is used for load testing, performance testing, and functional testing of software applications. Developed by Apache Software Foundation, JMeter is a versatile tool that supports various protocols, including HTTP, FTP, JDBC, LDAP, and many more. It allows developers and testers to model numerous user situations and assess an application’s performance under varied load circumstances.

Installation of JMeter software

The first step to using JMeter to carry out load testing is to download and install the JMeter software. However, before you can make use of JMeter, you have to install Java. Java is a prerequisite for JMeter installation and usage. JMeter is a Java-based application, which means it requires the Java Runtime Environment (JRE) or Java Development Kit (JDK) to be installed on the system where it will be used.

JMeter uses Java libraries to function, and it runs on the Java Virtual Machine (JVM). Without Java installed, JMeter will not be able to run, and you will not be able to perform any load testing.

Installation of Java

To install Java on your system, simply follow the steps below:

  1. Go to the Oracle website or click on the link below:

2. Download the version that is compatible with your operating system. In this case, we will be downloading the version for my Windows OS.

3. Once the download is complete, locate the downloaded file and double-click on it to start the installation process.

4. The installer will prompt you to accept the license agreement. Read the agreement and click on the “Agree” button to proceed.

5. Once the installation is complete, the installer will display a message confirming that Java has been installed successfully.

6. To verify that Java is installed correctly, open a command prompt and type “java -version”. This will display the version of Java that is installed on your system.

With that, we have successfully installed Java.

Now let’s continue with the installation of JMeter

  1. Visit https://jmeter.apache.org/download_jmeter.cgi to download the latest version of JMeter.
  2. Download the zip file under Binaries and wait for the download to be complete.

Note: In installing JMeter on your device, it does not require the normal way of installation. All we need is to download the software, unzip it and launch it for use.

3. Once the download is complete, extract the contents of the downloaded zip file to a location of your choice.

4. Navigate to the bin directory of the extracted JMeter folder

5. Locate the ApacheJMeter file, double-click on it, and wait for the software to launch.

Once JMeter is launched, it looks like this:

Key terms involved when performing load testing with JMeter

Here are some key terms that are commonly used when performing load testing with JMeter:

  1. Test Plan: This is the main container for all the elements that define a load test in JMeter.
  2. Thread Group: A group of virtual users that generate requests to the server as part of a test plan.
  3. Sampler: A component that simulates a user request to the server, such as an HTTP request or FTP request.
  4. Listener: A component that displays the results of a test run in various formats, such as the Graph Results or the Summary Report.
  5. Ramp-up period: The time taken by JMeter to start all the threads in the Thread Group.
  6. Throughput: The number of requests that can be processed by the server in a given time period, typically measured in requests per second.
  7. Response time: The time taken by the server to respond to a request, typically measured in milliseconds.
  8. Concurrent users: The number of users accessing the application simultaneously.

Step-by-step process of load testing with JMeter

  1. Plan your test: Determine the objectives of your load test, the metrics you want to capture, and the user scenarios you want to simulate.

In this case, we are going to simulate the sign-in functionality of the popular Netflix website. We want to simulate a certain number of concurrent users signing in to the Netflix website. By performing load testing for the sign-in functionality of the Netflix website, the objective is to ensure that the website can handle the expected user traffic and provide a smooth and seamless sign-in experience to users.

2. Create a test plan: Create a new test plan and give it a name, in this case, we will name it Netflix Sign In Functionality Load Test.

3. Add Thread Group: To do this,

  • Right-click on the Test plan
  • Place the cursor on Add
  • Place the cursor on Thread (Users)
  • Click on Thread Group

4. Set up Thread Group: In the “Thread Group” window, you can configure the following settings:

  • Number of Threads (users): This specifies the number of virtual users or threads that will be used to simulate load on the system. In this case, we are simulating 100 users.
  • Ramp-Up Period (seconds): This is the time period it takes for the number of threads specified in the Thread Group to start up and reach the maximum number of threads specified. For example, if the Thread Group is set to have 100 threads and a ramp-up period of 20 seconds, JMeter will start a new thread every 200 milliseconds (20 seconds divided by 100 threads). This means that it will take 20 seconds to start all 100 threads. In this tutorial, we have set the ramp-up period to 5 seconds.
  • Loop Count: This specifies the number of times each thread will execute the test plan. We have set the loop count to one because we want the test to execute once for each thread.

5. Add a Sampler: Add an HTTP Request sampler to the Thread Group to simulate an HTTP request to the Netflix sign-in page.

  • Right-click on the Thread Group
  • Place the cursor on Add
  • Place the cursor on Sampler
  • Double-click on HTTP Request
  • Add the link to the website, including the server name and path to the functionality to be tested.

6. Add a Listener: Add one or more listeners to capture and analyze test results. For example, you can use the Summary Report listener to display a summary of test results.

  • Right-click on the Thread Group.
  • Place the cursor on Add.
  • Place the cursor on Listener.
  • From the drop-down menu, select the type of Listener you want to add, such as “View Results Tree” or “Summary Report”. In this tutorial, we will make use of the Summary Report.

7. Run the test and view the results of the listener

  • Click on the green play button.
  • Wait for the test to be completed, and view the results.

8. Analyze the results: Analyze the test results and identify any performance issues. Use the KPIs you identified in Step 1 to evaluate the performance of the sign-in functionality of the Netflix website.

After carrying out the load test and analyzing the results, use the results of the load test to optimize the functionalities tested. This may involve making changes to the system architecture, optimizing database queries, or optimizing code.

Lastly, ensure to repeat the load test after making changes to the system to ensure that the performance has improved.

This article has provided a step-by-step guide on how to get started with JMeter Load Testing. By following these steps, you should be able to create a basic load test plan that can be used to test the performance of web applications, web services, and databases. However, load testing is a complex process, and there are many advanced features and techniques that can be used to optimize the load test. It is important to have a good understanding of load testing principles and best practices to create effective load tests.

--

--