Load testing with Taurus/jmeter and logging the results to ElasticSearch

Purpose:

To provide an easy mechanism for running Jmeter tests using Taurus from a docker container against a particular endpoint and logging the results

Required to be installed:

Docker

Git

The setup:


Pull the repo:
git clone https://gitlab.com/sgriffiths/jmeter-taurus-docker.git && cd jmeter-taurus-docker

To Run:
docker-compose run dev

This will run the simple load test against 'blazemeterdemo.com/reserve.php' endpoint:


Running from the terminal should look like this:



Logging - ES and Kibana:

For the purposes of the run-through we will use the ELK stack running locally in a docker container

From your terminal/cmd:


  • docker pull sebp/elk
  • git clone https://github.com/spujadas/elk-docker.git && cd elk-docker
  • docker build -t sebp/elk .
  • docker network create --subnet=172.18.0.0/16 elastic-esrally-network
  • docker run --rm --net elastic-esrally-network --ip 172.18.0.5 -p 5601:5601 -p 9200:9200 -p 5044:5044 -it --name elk sebp/elk

Local Kibana
Local ElasticSearch (Chrome plugin is recommended for viewing ES info)


View the docs in ES:


Add the index pattern in Kibana:










View the results:


Build some visualisations/dashboards:


    


The Breakdown



Env folder structure and config:

  • datafiles contain the the csv data files, while not used in the demo they can be called from here
  • scripts contain the Jmeter jmx files to be executed
  • workingdirectory was created to house the test artifacts after each run 






config.yaml:

  • The defaults for steps, rampup, hold time and the concurrency for the run. These can be overridden by the command line switches
  • Can also set the script and datafile directory from the config.yaml

.env settings and test configuration:


  • UAT, PT and DEV set the working directory where the test artifacts are created
  • The Threads, Steps, Rampup and Hold can be set here by replacing these in your build pipeline




entrypoint.sh:

The entrypoint to the execution. It changes the directory to whichever environment is called (pt, uat, dev) and sets the variables located in the .env file.


Docker-compose:

  • Sets the network IP address to be on the same network as the ELK stack
  • Sets the variables called from the .env file
  • Maps the working directory to save the test artifacts to the host









Dockerfile:

  • Sets the base image and uses jdk 10
  • Sets the Jmeter path
  • Copies the file structure from the test directories (dev, uat, pt)
  • Copies across Jmeter 4.0.2
  • Sets the entrypoint to launch BZT










Additional

Switches: 

eg. bzt config.yaml -o execution.0.concurrency=5 -o execution.0.hold-for=5m


Set the number of threads (users):

-o execution.0.concurrency=5

Duration to ramp up over:
-o execution.0.ramp-up=60

How long to hold at the max threads:
-o execution.0.hold-for=5m

Steps that will increase during the ramp-up period:
-o execution.0.step-count=1



Comments

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. Hi Team, Where shall I find the "NDJSON report template" for performance testing using Jmeter- Elastic Search and Kibana?

    ReplyDelete
  5. I read all the information you have mentioned in your blog that is really commendable find a Hire Software Developer in Noida Uttar Pradesh . I really like your post, please share more information with us.

    ReplyDelete

Post a Comment

Popular posts from this blog

Running Postman tests on Jenkins using Newman and AWS (Ubuntu 14.04)

Installing Testlink (Test Management Tool) on Ubuntu 12.04 (AWS EC2) with URL Rewrite

Installing ReadyAPI on a Jenkins EC2 instance using X11