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

Website front-end performance optimization: JavaScript and CSS

I have read an article written by the Yahoo team ...

Summary of methods to prevent users from submitting forms repeatedly

Duplicate form submission is the most common and ...

How to insert batch data into MySQL database under Node.js

In the project (nodejs), multiple data need to be...

Html Select uses the selected attribute to set the default selection

Adding the attribute selected = "selected&quo...

CSS sample code with search navigation bar

This article shows you how to use CSS to create a...

Solve the problem of Docker starting Elasticsearch7.x and reporting an error

Using the Docker run command docker run -d -p 920...

Implementing WeChat tap animation effect based on CSS3 animation attribute

Seeing the recent popular WeChat tap function, I ...

Implementation of MySQL joint index (composite index)

Joint Index The definition of the joint index in ...

Analyzing the four transaction isolation levels in MySQL through examples

Preface In database operations, in order to effec...

The top fixed div can be set to a semi-transparent effect

Copy code The code is as follows: <!DOCTYPE ht...

Detailed explanation of data types and schema optimization in MySQL

I'm currently learning about MySQL optimizati...