Skip to main content

JMeter Load Testing using Kubernetes Auto scaling Cluster

JMeter Performance Test using Kubernetes Master Slave Autoscaling Cluster



In recent times I have been encountered with a situation where we have to test a application with Production capacity which is very high, the regular approach is calculate user load and provision VM's accordingly. 

Drawback was that the number of VM required for the testing are more with high hardware requirements to complete the testing and not used to full capacity at all time as we execute only 2-3 tests a week, we cannot destroy the VM's as well because we have redo whole setup.

So we have to go to make use of Cloud which has autoscaling feature, most of current cloud providers support autoscaling of VM on demand. We used Azure cloud to implement this framework\solution. But it can be implemented in other cloud providers like GCP, AWS etc.. which supports Kubernetes VM autoscaling.

Idea is to create JMerter master and slaves with Jenkins to Integrate into CI\CD pipeline to run test and publish results to all required stakeholder(testers, managers etc..) with every build commit using trigger.

Below are the components, management tools used:
  • Jenkins
  • Kubernetes
  • Docker
  • Shell script's
To get started on setup please follow the below
  1. Install Docker
  2. Create JMeter Docker Image
  3. Setup Kubernetes: Please refer to guide to setup Kubernetes (I used microk8s for Kubernetes in standalone node)
  4. Deploy InfluxDB and Grafana Kubernetes cluster for live monitoring of JMeter test 
  5. Create JMeter Kubernetes config setup
  6. Setup up Jenkins and Pipeline to deploy JMeter, run test, and publish results, logs
Once you are done with above setup you can go ahead with tests by running Build from Jenkins.

Note: If you want to run test in Cloud you need to additionally configure cloud provider specific instructions into Jenkins Pipeline to allow access to Kubernetes environment and make necessary changes in containers to access cloud storage. 

To get the JMeter with Kubernetes running you can use the git repository and get stated.

Prerequisites:

  • Linux OS\bash supporting linux commands
  • Kubernetes and docker installed

Steps

  • Clone repository
  • Start Jenkins from Repository and completes setup
  • Copy Pipeline script to Jenkins
  • Run Build
  • View Live test in Grafana
  • View Logs and HTLM report from Artifacts of the build

Jenkins: 


Results published in Jenkins:

Grafana JMeter Test view: