How to Benchmark a Kerberos Web Server with JMeter

Apache JMeter is a load test tool commonly used for web server performance testing. There are lots of tutorials available regarding the use of JMeter. However, I found few guides have mentioned using Kerberos as a means of user authentication with JMeter, even though the tool perfectly supports it – in case you have not heard of it, Kerberos is a authentication protocol typically used for authenticating domain-joined clients when they are visiting intranet web applications. If you find it difficult to make JMeter work with Kerberos authentication, you may find this a step-by-step guide useful.

Setting up the environment

There are a number of pre-requisites to use JMeter for benchmarking a Kerberos web application. Remember to check the following configuration files before running the JMeter application.

#1) Edit krb5.conf

Edit krb5.conf file and change the configuration according to your Active Directory (AD) environment:

krb5 Configuration File
Locate krb5 Configuration File in JMeter Application Folder
krb5 Configuration File Edit
Edit the krb5 configuration file by notepad
Active Directory Domain Controllers
Check that the krb5 setting matches the domain controller(s) defined in Active Directory

#2) Edit system.properties

Open system.properties file and uncomment the following lines:

java.security.krb5.conf=krb5.conf
java.security.auth.login.config=jaas.conf

JMeter System Properties File
Locate JMeter system.properties File in JMeter Application Folder
JMeter System Properties File Edit
Edit JMeter System Properties File by notepad

#3) Edit jaas.conf

Check that the JAAS configuration file is set to load the Krb5LoginModule when running JMeter:

jaas Configuration File
Locate jaas Configuration File in JMeter Application Folder
jaas Configuration File Edit
Edit jaas Configuration File by notepad

Other Tips

Tips #1: You must install Java before starting JMeter application

JMeter Java Requirement
You can install Azul Zulu Java 8 to satisfy the requirements

Tips #2: Edit jmeter.bat to assign more system memory to JMeter application for running test cases

The Java HEAP size may need to be increased in order to avoid Java application running out-of-memory when running test cases.

After editing the jmeter batch file via Notepad, you can run the batch file and start the JMeter application in GUI mode.

JMeter Windows Batch File Configuration
JMeter Windows Batch File Configuration
JMeter Windows Batch File Edit
Search for the HEAP keyword can edit the setting accordingly

if not defined HEAP (
rem See the unix startup file for the rationale of the following parameters,
rem including some tuning recommendations
set HEAP=-Xms1g -Xmx4g -XX:MaxMetaspaceSize=4096m
)

By default only 1GB is configured for Java memory allocation. The above example demonstrates that 4GB of system memory can be allocated to Java HEAP.

Creating a JMeter Test Plan (.jmx)

Step 1) The Initial Test Plan Configuration

For the initial launch, JMeter displays a Test Plan with no element.

JMeter Initial Test Plan Configuration
Initial Test Plan Overview

Step 2) Add a Thread Group

To begin with, add a “Thread Group” element under Test Plan by right clicking “Test Plan”. Hover to “Add” and “Threads (Users)”. Select “Thread Group”.

JMeter add a Thread Group
Add a Thread Group

Optional: You can change the “Thread Group” element name to another one by specifying it in the “Name” field.

JMeter Change Element Name
Change the element name via the “Name” field

Step 3) Add a HTTP Authorization Manager

Next, add a “HTTP Authorization Manager” element under the “Thread Group” element.

JMeter add HTTP Authorization Manager
Add a HTTP Authorization Manager

In the “HTTP Authorization Manager”, click “Add” and fill in user credential, domain and realm information. Remember to change the mechanism to Kerberos.

JMeter HTTP Authorization Manager Configuration
Change the configuration inside HTTP Authorization Manager according to AD settings
Active Directory User Accounts
Check that the user exists under Active Directory Users and Computers

Step 4) Add a HTTP Request

After that, add a “HTTP Request” element under the “Thread Group” element.

JMeter add HTTP Request
Add a HTTP Request

After adding the “HTTP Request” element, you can fill in your web server URL path.

JMeter HTTP Request Configuration
Change the configuration inside HTTP Request

Step 5) Add a Listener – “View Results in Table”

Finally, add a listener to store the results in CSV format

JMeter add Listener - View Results in Table
Add a listener – View results in table

Upon adding the “View Results in Table” listener, a new page will be shown on the right hand side, select browse button and specify the file name, format and file path of your choice. Remember to add the file extension after the file name (like .csv).

JMeter select browse button
Select “browse” button
JMeter Browse File and Specify File Type
Specify the file name, type and path on the pop-up window

The Final Test Plan Configuration

After all elements are added to the test plan, we are ready to launch the benchmark.

JMeter Final Test Plan Overview
Final Test Plan Overview

Other Tips:

Tips #1: Remember to enable all necessary elements. By default, elements are enabled when added to JMeter test plan. It goes without saying that if you accidentally disabled an element, JMeter will skip the element when running.

JMeter Toggle Element
JMeter Toggle Element

Sample Results

If there is no configuration error, green icons will be shown under the status column after running the test script.

JMeter Sample Result in Console
This is a sample console output showing JMeter successfully reached the specified web page

The detailed test results will also be written to the specified file format

JMeter Sample Result in CSV format
JMeter Sample Result in CSV format

Save the Test Plan in a JMX file

After confirming the desirable test result can be generated, save the test plan in a JMX file format via “File”, “Save Test Plan As”.

JMeter save test plan
Save the Test Plan in .jmx file format

Run the Test Plan in CLI mode

Lastly, the test plan created via the JMeter GUI mode can be used by the application in CLI mode.

Why use CLI mode to run actual JMeter test plan?

As per official guideline, CLI mode should be used for actual load testing. For the GUI mode, it should only be used for creating a test plan (.jmx). You should always use Windows Command Prompt or Linux Terminal to run the test plan.

jmeter –n –t Test_Plan.jmx –l log.jtl

A sample command for running the test script in CLI mode, where “-n” means CLI mode; “-t” means the JMX file name and “-l” means the log result output. Replace “Test_Plan” with the your file name.

For more information about the parameters, please refer to JMeter user manual:

https://jmeter.apache.org/usermanual/get-started.html

JMeter CLI mode output
JMeter CLI mode output

After running the above command, a log.jtl file will be generated. You can find a sample test result shown as follows:

JMeter Sample Result in JTL format
JMeter Sample Result in JTL format