Skip to content

aashitsharma/jmeter-maven

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Performance Testing Infrastructure using JMeter, Maven, Jenkins, Kubernetes, InfluxDB, and Grafana

This repository provides an end-to-end performance testing framework that utilizes a Kubernetes-managed environment integrating JMeter, Maven, Jenkins, InfluxDB, and Grafana. It supports distributed load testing, real-time data visualization, and automated test execution pipelines.


🚀 Tech Stack Overview

  • Maven Project: Uses jmeter-maven-plugin to run performance tests.
  • Jenkins: Automates test execution and generates HTML reports.
  • InfluxDB: Stores test result data in real-time.
  • Grafana: Visualizes performance metrics using InfluxDB as a data source.
  • JMeter Server: Generates load and enables distributed testing.
  • Kubernetes: Orchestrates services like Jenkins, InfluxDB, Grafana, and JMeter slaves.

☸️ Kubernetes Cluster Setup

Each component runs as a separate deployment in the Kubernetes cluster using YAML configuration files located at:

/environment/jmeter-kubernetes/jmeter-kubernetes

Common kubectl Commands

kubectl -n kubernauts get po                          # List all pods
kubectl -n kubernauts exec -ti <pod-name> -- /bin/bash  # Access pod shell
kubectl -n kubernauts cp <local-file> <pod>:/path      # Copy file to pod
kubectl -n kubernauts get pod -o wide                  # Get pod IPs
kubectl -n kubernauts expose deployment jenkins --type=LoadBalancer --name=jenkins
kubectl -n kubernauts rollout restart deploy           # Restart all pods
kubectl -n kubernauts apply -f jmeter_slaves_deploy.yaml

⚙️ Maven Project Configuration

We use the jmeter-maven-plugin to run our load tests. A new JMeter instance is created using:

mvn clean install

Plugin Configuration Highlights

<testFilesIncluded>       <!-- Path to .jmx file -->
<propertiesUser>          <!-- user.properties -->
<propertiesJMeter>        <!-- jmeter.properties -->
<propertiesGlobal>        <!-- global.properties -->
<jmeterExtensions>        <!-- external plugins -->
<propertiesSystem>        <!-- system properties -->
<remoteConfig>            <!-- slave IPs -->

Runtime Parameters (defined in <properties> tag)

  • users: Number of threads
  • rampUp: Time to ramp up users
  • loop: Loop count
  • duration: Test duration
  • path: JMX file name
  • csv: CSV filename
  • url: Application base URL
  • remoteIP: IP addresses of slave servers
  • folder: Folder path for test files

Sample Maven Command

mvn clean install -Dusers=120 -DrampUp=2 -Dloop=1 -Dduration=600 -Dcsv=Syllabus_Data \
-Dpath=Syllabus_Api_Suite.jmx -Durl=uat-qa.com \
-DremoteIP=192.168.29.51 -Dfolder=Student

Generated reports:

  • HTML: target/jmeter/reports
  • CSV: target/jmeter/results

🧪 Jenkins Configuration

Jenkins runs the Maven test job and generates HTML reports.

Important: Extract Jenkins pod IP from Kubernetes and set it to java.rmi.server.hostname in <propertiesSystem> within pom.xml.

During job configuration:

  • Set parameters corresponding to Maven runtime parameters.
  • Use Goals and options to trigger mvn clean install.

The Jenkins job pulls the latest code and triggers the test. On success, HTML reports are emailed to recipients.

📁 Check job: Teacher-Syllabus-Performance-Suite for reference.


📦 InfluxDB

InfluxDB stores test result metrics in real-time. These results are sent using JMeter's Backend Listener.

📁 Check: Backend Listener in Integrated_Syllabus_Suite.jmx


📊 Grafana

Grafana connects to InfluxDB and displays metrics such as:

  • Avg / Max / Min response times
  • Percentiles (90/95/99)
  • Success and failure counts

📁 Check dashboard: emk_test_load_latest


🌐 JMeter Server (Slaves)

JMeter slaves are used for distributed load testing. Jenkins acts as the master node.

IPs of JMeter slave pods are passed via remoteIP in the Maven command.

Copy Required CSVs to Slaves

  1. Connect via FTP (FileZilla) to EC2.
  2. Create a folder CSV on EC2 and upload all CSVs from:
    src/test/resources/ResourceData/
    
  3. SSH into EC2 and run:
    kubectl -n kubernauts cp CSV/ jmeter-slaves-<pod-id>:/jmeter/apache-jmeter-5.4.1/bin/

If the CSVs aren't available at runtime, tests will fail.


📎 Additional Resources


Happy Testing! 🚀

About

This repository provides an end-to-end performance testing framework that utilizes a Kubernetes-managed environment integrating JMeter, Maven, Jenkins, InfluxDB, and Grafana. It supports distributed load testing, real-time data visualization, and automated test execution pipelines.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors