Install and Configure JMeter

Install and Configure JMeter

I'm not a test engineer but sometimes you got a task to do a load and performance test on servers that you are created.

Anyway let's first know what is the JMeter

The?Apache JMeter??application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

Advantages of JMeter

  • Easy to use without extensive knowledge of programming. It has a user-friendly UI and one can also use CLI.
  • Provides integration with Jenkins and reporting
  • Easy installation on any operating system
  • Key features like the Thread Group, helps to see whether software performance is good.
  • Test IDE allows test recording from browsers or native applications
  • Allows API testing, Database Testing, and MQ testing with ease
  • When there’s a high number of TPS, one can achieve more transactions per second given the hyper-limitations.
  • Can deploy on Kubernetes or AKS
  • Can monitor the results with Grafana
  • Can use many servers (Cluster)?

Disadvantages of JMeter

  • Automation is difficult with JMeter
  • JMeter output reports are difficult to understand without training
  • It doesn’t support JavaScript and AJAX requests.
  • Complex applications that use dynamic content or use JS to alter requests can be difficult to test using JMeter.
  • It’s difficult to get data from one place or to perform customizations.

In this article we will learn how to install JMeter on windows, Linux and Kubernetes

we also will learn how to create script, test the script and monitor the results using Grafana

  1. Install JMeter on windows/Linux

Open the following link to download binaries of JMeter

No alt text provided for this image

just unzip the file and also you need to install Java JDK because it's required to run JMeter

2. Configure JMeter Distribute on windows/Linux

No alt text provided for this image

you will prepare multi VMs and install JMeter on these machines then you will edit on the file jmeter.properties under bin folder and add all the slave servers at the line remote_hosts on Master VM only

No alt text provided for this image

you need to change the line server.rmi.ssl.disable from false to true in all slave machines

No alt text provided for this image

after finish the configuration you need to open jmeter-server on all slave machines

on the master server open jmeter.bat

No alt text provided for this image

you need to open Thread Group to start load testing

No alt text provided for this image
No alt text provided for this image

you need to create listeners to views the results of threads

No alt text provided for this image

Let’s discuss the objects of Aggregate listeners

No alt text provided for this image
No alt text provided for this image

How to Generate the script

there are two ways you can create a script automatically

  • JMeter Recording
  • BlazeMeter

let's create a JMeter Script Record

No alt text provided for this image

After you create Test Recorder you find the following page?

No alt text provided for this image

You will see in the global settings the JMeter listen on port 8888 and you can change the port as you like.

In the test plan creation at target controller, you can choose the target you want JMeter add the recording for now you can choose test plan.

No alt text provided for this image

In the request filtering at URL Pattern to Exclude you can add suggested excludes to avoid record not needed record.

So, you need to do two things so JMeter can recording?

  • ?You need to configure proxy on port 8888 as shown below

No alt text provided for this image

All you need to open Firefox for example then open setting and network settings then add the configuration.

After that you need to install JMeter certification on the Firefox?

After you run the JMeter recording you will find that you can’t access to any websites

No alt text provided for this image

View the certificate and download Pem file?

No alt text provided for this image

Then import the certificate to the browser the you will find the browser is working

Please make sure after you finish recording disable the proxy setting so you can use your browser.

  • the other way to create script is using BlazeMeter

You can use it as extension in Google Chrome you can download the extension?at the following link

No alt text provided for this image

how i can test jmeter

there are two you can test your thread

  • you can hit the following link to test your thread

No alt text provided for this image


  • You can download and install web tours sample from the following link Then after unzip the file you click on StartServer.bat Then go to browser and enter https://localhost:1080/webTours/

No alt text provided for this image

How to monitor JMeter using Grafana

First you need to install InfluxDB and its writer plugin

You can install the InfluxDB through the following link

You can install the InfluxDB-Writer through the following link and add the jar file in JmeterPATH/lib/ext


No alt text provided for this image

You can install the InfluxDB CLI though the following link


After install InfluxDB run the Influx.exe through powershell and browse it by localhost:8086

No alt text provided for this image

After adding the configuration you need to create a token access?

No alt text provided for this image

After generating save the token in the text file

Then create a database mapping this step should be used by Influx CLI

List the Database Influx v1 dbrp list –org For_Demo –token ------

No alt text provided for this image

Create mapping influx.exe v1 create –org-id -------?--bucket-id -------?--db -----?-rp ----- --token --------

No alt text provided for this image

Create User and Password for DB Access influx.exe v1 auth create –read-bucket ---- --write-bucket ---- --username --- --password --- --token -------

No alt text provided for this image

Open Grafana to integrate with InfluxDB through localhost:3000

Add datasource?

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Now you need to import the dashboard?

No alt text provided for this image

Add the 1152 in the import via Grafana.com?

No alt text provided for this image

Then add the name of dashboard and choose the database

No alt text provided for this image

Start you load testing but before you need to add backend listener to the thread group and add influxdb configuration

No alt text provided for this image
No alt text provided for this image

Install JMeter and InfluxDB in Kubernetes

Follow the steps as below :

git clone https://github.com/kubernauts/jmeter-kubernetes

cd jmeter-kubernetes/

chmod +x jmeter_cluster_create.sh dashboard.sh start_test.sh

./jmeter_cluster_create.sh

Before complete the installation change image of INfluxDB from influx:latest to influx:1.16.0-alpine

./dashboard.sh

./start_test.sh

Then enter you jmx file

Note it’s better to the script using blazemeter

you need to open Grafana portal through IP-ADDRESS:NODEPORT

and import the json file GrafanaJMeterTemplate.json you will find it in the directory that you are cloned .

No alt text provided for this image

I HOPE THIS ARTICLE HELP YOU IN YOUR CAREER ??

THANKS FOR READING

Mohamed Hosny

Cloud DevOps TL | People Lead | Deloitte Innovation Hub | Ex PwC | PMI-ACP | 3X Azure Expert

2 年

Great

要查看或添加评论,请登录

社区洞察

其他会员也浏览了