What is JMeter and How it Works

First of all, we should understand what Apache JMeter is. Apache JMeter is open-source software that is built using Java programming language. It was first developed by Stefano Mazzocchi of the Apache Software Foundation.

JMeter is designed to perform load testing and performance testing. Using this tool we can measure the performance of web applications. Now when we say performance testing, it means that heavy load of concurrent users is generated on the web application to measure its performance.

What is JMeter and How it Works
This is how JMeter works

Not only we do performance testing using JMeter, but also we are using it for functional testing, database server testing, etc.

Why JMeter?

Let us understand it using a scenario. Suppose we have the requirement that we need to test a web server and check how many concurrent users can it handle? Let us consider another scenario where we have a requirement to test any particular web application, say google.com for 1000 users. For that, we need to arrange 1000 people simultaneously accessing google.com at a time, which is very difficult to manage or almost impossible to manage. For that, we need a performance testing tool which generates and simulates a large number of concurrent user load on the web server. JMeter, being open source free tool, comes to rescue in such situations.

JMeter Advantages

JMeter has many advantages. Some of them are given below.

  • Open Source: JMeter is open source which means that JMeter is totally free. We do not need to purchase license for JMeter.
  • Friendly GUI: JMeter has very simple interface which makes it very easy to use.
  • Platform independent: One of the biggest advantages of JMeter is that it can run on multiple platforms. It is not limited to Windows or Linux or any particular operating system.
  • Full multithreading framework. – JMeter provides multi trading Framework which means that it allows execution of different threads simultaneously for simulating load of large number of users.
  • Visualize Test Result: JMeter write the facility to display the result in different formats such as chart, table, tree and log file which makes it is easy to analyse the result
  • Easy installation: JMeter is very easy to install. We just need to run the *.bat file available in downloaded JMeter folder to run JMeter. We don’t need to install it.
  • Highly Extensible: There are many plugins available for JMeter which makes it highly extensible and powerful.
  • Multiple testing strategies: JMeter supports various types of testing such as Load Testing, Distributed Testing, and Functional Testing.
  • Support multi-protocol: Being such a light weighted tool, JMeter does not only support web application testing but also is used to monitor database server performance. All basic protocols which are supported by licensed tools such as HTTP, JDBC, LDAP, SOAP, JMS, and FTP, are supported by JMeter which is really great.
  • Record & Playback – like other licensed tools which office facility of record and playback, JMeter also had the same facility which allows it to record the user action on the browser and replay the same action on the web application using JMeter.
  • Script Test: An important advantage of JMeter is that JMeter can be integrated with Bean Shell & Selenium for automated testing.

How JMeter works?

First thing that is done by the JMeter is that it creates request for target server which then simulates it for number of users after server receives request from JMeter, it sends the request back to JMeter for number of users, which is collected by JMeter which in turn returns statistical information from the target server through graphical diagrams

JMeter Version History

Version Description
1 first official release
2.13 Java 6+
3 Java 7+
3.1 Java 7+
3.2 Java 8+
3.3 Java 8
4 Java 8 / 9

System Requirement

JDK 1.6 or above.
Memory No minimum requirement.
Disk Space No minimum requirement.
Operating System No minimum requirement.

Let us look at the following steps in order to download and run JMeter.

Step 1: Verify Java Installation

For running JMeter, the first thing which is required is that Java should be installed on the system where we have to run JMeter. Let us understand how to verify whether Java is installed on the system or not. For that we need to go to console and execute the following commands for different operating systems.

OS Command
Windows c:\> java –version on Command Pompt
Linux $ java –version on Command Terminal
Mac $ java –version on Terminal

After getting above commands on the operating systems, as given above, we get to know of the Java version which is installed on the system. It will also give a message like no Java version is installed on the system if java is not installed on the system. We need to install it before moving to the next step which is to setup a java environment variable in the system.

Step 2: Set Java Environment

Next important thing is to set JAVA_HOME environment variable which refers to the location where Java is installed on the system. We can set this variable As given below for different operating systems.

Windows OS: Need to create environment variable JAVA_HOME and Set its value to C:\Program Files\Java\jdk1.7.0_25.

Linux:Export JAVA_HOME=/usr/local/java-current

Mac: Export JAVA_HOME=/Library/Java/Home

Next important thing is to add Java compiler location to System Path.

Windows: Need to add another string- C:\Program Files\Java\jdk1.7.0_25\bin to the end of the system variable: Path.

Linux: Export PATH=$PATH:$JAVA_HOME/bin/

Mac: Not required

In the example above we have installed jdk1.7.0_25 version of Java on our system. So we are setting environment variables accordingly. We need to set the java version according to the version installed on our system. After setting environment variables we can verify which version of Java is installed on the system using commands which we did earlier.

Step 3: Download JMeter

Download the latest version of JMeter from https://jmeter.apache.org/download_jmeter.cgi.

We can download it to any directory. But for this tutorial we have downloaded apache-jmeter-2.9 and copied it into C:\>JMeter folder.

Step 4: Run JMeter

Now after downloading JMeter, we are required to run JMeter. For that we need to go to the bin directory. In this case, it is / folder name am where Apache JMeter has been copied/apache-jmeter-2.9/bin. Now when we are in Bin folder, we need to click on the following depending on the type of operating systems, as given below.

OS File Name
Windows jmeter.bat
Linux jmeter.sh
Mac jmeter.sh

Let us take the example of Windows operating system, we need to click on jmeter.bat file which is a batch file and resides inside bin folder. After clicking on this batch file, JMeter window will open and after opening of this window we have graphical user interface ready for performance testing. Now that we have seen the steps on how to download and open JMeter GUI, we can easily say that it is very easy to install.

In the next tutorial, you will learn how to install JMeter in Windows 10