Getting started with Jmeter: Part 1

Getting started with Jmeter: Part 1

2019 / 8 / 12

Load Testing, Jmeter, Performance Testing, Installation

Installation and Executing JMeter in Different Modes

      Apache JMeter is an Open Source Software, a pure 100% Java Application developed for load testing and Performance Testing. For those who are new to JMeter, here is a step by step guide on How to Install JMeter and How to run JMeter in different Modes.

Steps to Install JMeter

Step 1: Install Java

Since JMeter is a 100% pure Java Application, One of the main prerequisites is JVM 6 or Higher. You can download and install the latest version of the Java SE Development Kit here.

After installation is completed, you can follow the following procedure to check whether Java JDK is successfully installed in your system-
  1. In Windows/ Linux, Open the Terminal.
  2. Enter the command java-version.

If Java JDK is successfully installed, you will see the following output screen:

JAVA version

If nothing displays, Please follow the step by step installation guide from Java Platform, Standard Edition Installation Guide.

Step 2: Download JMeter

After successful installation of Java JDK, the next step is to download the Apache JMeter Binaries here. Choose either zip/tgz file from the Binaries as shown in the figure below-

Step 3: Install JMeter

JMeter Installation is very easy. All you need to do is to unzip the zip/tgz file to the desired directory. There are no tedious steps to be followed, Just Unzip and You are ready to go!

Once Unzip is done, the Installation Directory structure looks like this-

JMeter

Before proceeding further we will have a brief discussion about the important components in the directory structure.
  1. /bin: This directory contains script files for starting JMeter
  2. /docs: Directory consists of JMeter Documentation Files.
  3. /extras: Directory consists of ant related extra files.
  4. /lib: Contains the required Java Library for JMeter.
  5. /lib/ext: This Directory consists of core jar files for JMeter and Protocols.

Step 4: Launch JMeter

JMeter can be launched in 3 ways, each mode catering a special requirement.

  1. GUI Mode

  2. Server Mode

  3. Command Line Mode

But do we really need these many modes or a single-mode can cater to all the scenarios? The answer is YES!!! We cannot use JMeter GUI Mode to perform Load testing. For this, we need less power consuming Command Line Mode. Similarly in a Distributed environment where there is Client-Server Architecture we need a special mode for the Server System.

So in a nutshell, a Single running mode for JMeter is not sufficed to handle all the environments.

Let’s begin with a detailed discussion of Modes. This will help you to gain insight into why different modes are required.

GUI Mode:

If you are using Windows, navigate to the bin folder in the installed directory. You will find a Windows Batch File under the name jmeter.bat

JMeter

Just execute this Batch File and You will see the Apache JMeter Windows.

JMeter Window

JMeter GUI

Server Mode:

Server Mode is designed for Distributed Testing Environment like a Client-Server Model, where Apache JMeter will run in Server Mode on Server Computer and in GUI Mode on Client Computer.

To start JMeter in Server Mode, just execute the Windows Batch File jmeter-server.bat in the bin directory.

JMeter Server

Command Line Mode:

Running JMeter in GUI Mode consumes a lot of computer memory. This is why it is not advisable to run JMeter in GUI Mode for Load Testing.

For saving resources, you may choose to execute JMeter in Command Line Mode.

  1. Open the command prompt.
  2. Navigate to the bin folder in the Apache JMeter directory.
  3. Execute the following command.

jmeter -n -t SampleTest.jmx -l testlog.jtl

JMeter command line

-n: Specifies JMeter to run in Non-GUI Mode.
-t: Specifies the name of JMX File containing the test plan.
-l: Specifies the name of JTL file to log test results.

Other than these options, there are so many parameters available. You can find the list of the parameter from Apache JMeter- User’s Manual.

Once your test is complete, you can see the log file using the GUI Mode.

  1. Open the JMeter in GUI Mode.
  2. Add any Listener by right clicking on Test Plan > Add > Listener > View Results Tree.
  3. Now click on the Browse button and select the log file. In our case it is testlog.jtl
  4. You should be able to see the result in the listener.

JMeter GUI

After having such a long discussion on JMeter, now you guys are ready to start installing JMeter and try running it in various modes.

Keep your system ready with JMeter, as in the next article we will be focusing on how to generate a Test Plan with the help of step by step visuals.


You might also like