Detailed tutorial on distributed operation of jmeter in docker environment

Detailed tutorial on distributed operation of jmeter in docker environment

1. Build the basic image of jmeter

The Dockerfile is as follows:

# Use Java 8 slim JRE
FROM openjdk:8-jre-slim
MAINTAINER QJP

# JMeter version
ARG JMETER_VERSION=5.1.1

# Install few utilities
RUN apt-get clean && \
  apt-get update && \
  apt-get -qy install \
        wget \
        telnet \
        iputils-ping \
        unzip
# Install JMeter
RUN mkdir /jmeter \
   && cd /jmeter/ \
   && wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz \
   && tar -xzf apache-jmeter-$JMETER_VERSION.tgz \
   && rm apache-jmeter-$JMETER_VERSION.tgz
   
WORKDIR /jmeter/apache-jmeter-$JMETER_VERSION/bin
#Copy a jmeter.properties file from the current folder, and make sure to enable server.rmi.ssl.disable=true
COPY jmeter.properties .
# ADD all the plugins
ADD jmeter-plugins/lib /jmeter/apache-jmeter-$JMETER_VERSION/lib

# ADD the sample test
ADD sample-test sample-test

# Set JMeter Home
ENV JMETER_HOME /jmeter/apache-jmeter-$JMETER_VERSION/

# Add JMeter to the Path
ENV PATH $JMETER_HOME/bin:$PATH

Build the image

docker build -t jmbase .

Package upload

docker tag jmbase dockername/jmbase
docker push dockername/jmbase

2. Build the master machine image of jmeter

The dockerfile file is as follows

# Use the jmbase base image FROM qjpdsg/jmbase
MAINTAINER TestAutomationGuru

# Ports to be exposed from the container for JMeter Slaves/Server
# Ports to be exposed from the JMeter Slaves/Server container EXPOSE 1099 50000

# Application to run on starting the container
# Start the container to run the application ENTRYPOINT $JMETER_HOME/bin/jmeter-server \
            -Dserver.rmi.localport=50000 \
            -Dserver_port=1099

Build the image

docker build -t jmmaster .

Package upload

docker tag jmmaster dockername/jmmaster
docker push dockername/jmmaster

3. Build the jmeter client image

The dock and file files are as follows

# Use jmbase base image
FROM qjpdsg/jmbase

MAINTAINER QJP

# Ports to be exposed from the container for JMeter Master
EXPOSE 60000

Build the image

docker build -t jmslave .

Package upload

docker tag jmmaster dockername/jmslave
docker push dockername/jmslave

4. Run the jmeter client and get the IP address:

Start the client container:

docker run -dit --name slave01 jmserver /bin/bash
docker run -dit --name slave02 jmserver /bin/bash
docker run -dit --name slave03 jmserver /bin/bash

Get client ip

docker inspect --format '{{ .Name }} => {{ .NetworkSettings.IPAddress }}' $( docker ps -a -q )

Configure the IP address to the jmeter.properties of the jmeter master machine: Note that the client's server_port needs to be consistent with the master's server_port

like:

Set the address:

remote_hosts=172.17.0.2:1099,172.17.0.3:1099

Copy to the jmmaster container:

docker cp ./jmeter.properties jmmaster:/jmeter/apache-jmeter-5.1.1/bin/

5. Start distributed testing:

Enter the client container and run the jmeterserver service:

docker exec -it slave10 /bin/bash
jmeter-server

Enter the master container and perform distributed testing:

jmeter -n -t mywh.jmx -R172.17.0.2,172.17.0.3

This is the end of this article about distributed running of jmeter in docker environment. For more related content about distributed running of jmeter in docker, please search previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of using Elasticsearch visualization Kibana under Docker
  • Detailed explanation of the construction of Docker container visual monitoring center
  • Detailed tutorial on building a JMeter+Grafana+Influxdb monitoring platform with Docker
  • Use Grafana to display monitoring charts of Docker containers and set email alert rules (illustration)
  • How to monitor Docker using Grafana on Ubuntu
  • Detailed tutorial for installing influxdb in docker (performance test)
  • Common commands for deploying influxdb and mongo using docker
  • Tutorial on building a JMeter+Grafana+influxdb visual performance monitoring platform in docker environment

<<:  An article teaches you how to implement a recipe system with React

>>:  How to convert MySQL horizontally to vertically and vertically to horizontally

Recommend

Vue's detailed code for implementing the shuttle box function

Vue - implement the shuttle box function, the eff...

80 lines of code to write a Webpack plugin and publish it to npm

1. Introduction I have been studying the principl...

Detailed explanation of primary keys and transactions in MySQL

Table of contents 1. Comments on MySQL primary ke...

How to allow external network access to mysql and modify mysql account password

The root account of mysql, I usually use localhos...

Linux disk management LVM usage

1. Introduction to LVM When we manage Linux disks...

Parsing Apache Avro Data in One Article

Abstract: This article will demonstrate how to se...

JavaScript to show and hide the drop-down menu

This article shares the specific code for JavaScr...

Docker builds Redis5.0 and mounts data

Table of contents 1. Simple mounting of persisten...

Summary of 10 must-see JavaScript interview questions (recommended)

1.This points to 1. Who calls whom? example: func...

MySQL grouping queries and aggregate functions

Overview I believe we often encounter such scenar...