Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

using JMeter 5.4, Helm3, allowing additional volume, etc., #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Chart.yaml

This file was deleted.

15 changes: 5 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM openjdk:8-jre-slim
ARG JMETER_VERSION

ENV JMETER_VERSION ${JMETER_VERSION:-3.3}
ENV JMETER_VERSION ${JMETER_VERSION:-5.4}
ENV JMETER_HOME /jmeter/apache-jmeter-$JMETER_VERSION/
ENV PATH $JMETER_HOME/bin:$PATH

Expand All @@ -16,20 +16,15 @@ WORKDIR /jmeter

RUN 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 && \
mkdir /jmeter-plugins && \
cd /jmeter-plugins/ && \
wget https://jmeter-plugins.org/downloads/file/JMeterPlugins-ExtrasLibs-1.4.0.zip && \
unzip -o JMeterPlugins-ExtrasLibs-1.4.0.zip -d /jmeter/apache-jmeter-$JMETER_VERSION
rm apache-jmeter-$JMETER_VERSION.tgz

WORKDIR $JMETER_HOME

COPY config/user.properties bin/user.properties
COPY scripts/install_plugin-manager.sh .

COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh

RUN chmod +x install_plugin-manager.sh /docker-entrypoint.sh
RUN ./install_plugin-manager.sh
RUN chmod +x /docker-entrypoint.sh

EXPOSE 6000 1099 50000
ENTRYPOINT ["/docker-entrypoint.sh"]
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Distributed JMeter - Docker

Apache Jmeter™ is an open source tool that helps creating and running load test plans. And this Docker image was created to help you running different versions of JMeter in a Docker container, also helping you running in a distributed fashion (master -> server approach).
Apache Jmeter™ is an open source tool that helps creating and running load test plans. And this Docker image was created to help you running different versions of JMeter in a Docker container, also helping you running in a distributed fashion (master -> server approach).

## Supported tags

The [Dockerfile](https://github.com/pedrocesar-ti/distributed-jmeter-docker/blob/master/Dockerfile) here is managed and built with arguments what helps building and pushing our JMeter images for all versions of JMeter available. If you want more information, have a look on the [Makefile](https://github.com/pedrocesar-ti/distributed-jmeter-docker/blob/master/Makefile).
The [Dockerfile](https://github.com/pedrocesar-ti/distributed-jmeter-docker/blob/master/Dockerfile) here is managed and built with arguments what helps building and pushing our JMeter images for all versions of JMeter available. If you want more information, have a look on the [Makefile](https://github.com/pedrocesar-ti/distributed-jmeter-docker/blob/master/Makefile).

- 3.3, latest
- 2.6
- 2.7
- 2.8
Expand All @@ -18,40 +17,53 @@ The [Dockerfile](https://github.com/pedrocesar-ti/distributed-jmeter-docker/blob
- 3.0
- 3.1
- 3.2
- 3.3
- 4.0
- 5.0
- 5.4, latest

## Running Master or Server

### Master

```sh
docker run -p 60000:60000 -v <TEST_PLAN_LOCAL>:<TEST_PLAN_CONTAINER> -d pedrocesarti/jmeter-docker:latest master
```

### Server

```sh
docker run -p 1099:1099 -p 50000:50000 -d pedrocesarti/jmeter-docker:latest server
docker run -p 1099:1099 -p 50000:50000 -v /Users/mookkiahm/git/github/distributed-jmeter-docker/rmi_keystore.jks:/jmeter/apache-jmeter-5.0/bin/rmi_keystore.jks -d pedrocesarti/jmeter-docker:latest server
```

Example to supply JMeter and JVM arguments

```sh
docker run -p 1099:1099 -p 50000:50000 -d -v /Users/mookkiahm/git/github/distributed-jmeter-docker/rmi_keystore.jks:/jmeter/apache-jmeter-5.4/rmi_keystore.jks pedrocesarti/jmeter-docker:5.4 server
docker run -p 1099:1099 -p 50000:50000 -d -e JMETER_SERVER_ADDITIONA_ARGS="-Jserver.rmi.ssl.disable=true" -e JVM_ARGS="-Xms300M" pedrocesarti/jmeter-docker:5.4 server
```

## Running Master and Server (Docker Compose)

You can also create a whole stack with master and servers to run a distributed JMeter tests locally or in a Docker Swarm Cluster. Check out this [docker-compose.yml](https://github.com/pedrocesar-ti/distributed-jmeter-docker/blob/master/local/docker-compose.yml) to see one example of this infra running locally.
This example is going to create a master and a server container running locally, and you can also scale up and down the number servers instancesrunning.

```sh
docker-compose up -d
docker-compose scale server=5
```

## Volumes

Another good point to mention here is that we suggest that you use volumes to share your test plans with the master container and once you have your test plans on your master container, you only going to need exec:

```sh
jmeter -n -t script.jmx -R server1,server2,…
```
```

You can also use this [docker-compose](https://github.com/pedrocesar-ti/distributed-jmeter-docker/blob/master/local/docker-compose.yml) to deploy in a Docker Swarm cluster defining better techniques to scale the number of replicas you want for each service and add all power of the internal discovery service.

## K8s
For the Kubernetes support, also have a look at the official helm/[chart](https://github.com/helm/charts/tree/master/stable/distributed-jmeter) repository.

For the Kubernetes support, also have a look at the official helm/[chart](https://github.com/helm/charts/tree/master/stable/distributed-jmeter) repository.

Enjoy! :)
8 changes: 5 additions & 3 deletions k8s/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
apiVersion: v1
appVersion: "1.0"
apiVersion: v2
appVersion: "5.4"
description: A Distributed JMeter Helm chart
name: distributed-jmeter
version: 0.1.0
version: 2.0.0
home: http://jmeter.apache.org/
icon: http://jmeter.apache.org/images/logo.svg
sources:
- https://github.com/pedrocesar-ti/distributed-jmeter-docker
maintainers:
- name: pedrocesar-ti
email: [email protected]
- name: mookkiah
email: [email protected]
7 changes: 6 additions & 1 deletion k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@ Based on the work done [here](https://github.com/pedrocesar-ti/distributed-jmete
Apache Jmeter™ is an open source tool that helps creating and running load test plans. This helm/chart was created to help you running different versions of JMeter in a distributed fashion (master -> server architecture), for more info.

## Chart Details:

This chart will do the following:

- Deploy a JMeter master (by default 1) that is responsible to store the test plans and test results after running on the servers.
- Deploy a JMeter server service (by default 3 replicas) that are responsible to run the actual test and send back the results to the master.


## Installing the Chart:

To install the chart with the release name jmeter:

```
$ helm install --name distributed-jmeter stable/distributed-jmeter
```

## Deploying different versions of JMeter

The default [image](https://hub.docker.com/r/pedrocesarti/jmeter-docker/) allows you to run JMeter in all versions available.

To change the version running on the helm you only need:

```
$ helm install --name distributed-jmeter --set master.image.tag=4.0 --set server.image.tag=4.0 stable/distributed-jmeter
```
Expand Down
4 changes: 2 additions & 2 deletions k8s/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ JMeter is now starting.

To get get a shell session on the master you only need to run:

$ export MASTER_NAME=$(kubectl get pods -l role=master -o jsonpath='{.items[*].metadata.name}')
$ export MASTER_NAME=$(kubectl get pods -l app.kubernetes.io/component=master -o jsonpath='{.items[*].metadata.name}')
$ kubectl exec -it $MASTER_NAME -- /bin/bash


Expand All @@ -12,5 +12,5 @@ $ kubectl cp sample.jmx $MASTER_NAME:/jmeter


To run your test in all servers you need first a list of all servers IPs (comma-separated) and then you can run your test:
$ export SERVER_IPS=$(kubectl get pods -lrole=server -o jsonpath='{.items[*].status.podIP}' | tr ' ' ',')
$ export SERVER_IPS=$(kubectl get pods -l app.kubernetes.io/component=server -o jsonpath='{.items[*].status.podIP}' | tr ' ' ',')
$ kubectl exec -it $MASTER_NAME -- jmeter -n -t /jmeter/sample.jmx -R $SERVER_IPS
24 changes: 17 additions & 7 deletions k8s/templates/jmeter-master-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-master
name: {{ template "distributed-jmeter.fullname" . }}-master
labels:
app.kubernetes.io/name: {{ include "distributed-jmeter.name" . }}
helm.sh/chart: {{ include "distributed-jmeter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
role: master
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: master
spec:
replicas: {{ .Values.master.replicaCount }}
strategy:
type: RollingUpdate
selector:
matchLabels:
app.kubernetes.io/name: {{ include "distributed-jmeter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}-master
role: master
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: master
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "distributed-jmeter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}-master
role: master
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: master
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: ["master"]
args:
- master
ports:
- containerPort: 60000
volumeMounts:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
17 changes: 13 additions & 4 deletions k8s/templates/jmeter-server-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-server
name: {{ template "distributed-jmeter.fullname" . }}-server
labels:
app.kubernetes.io/name: {{ include "distributed-jmeter.name" . }}
helm.sh/chart: {{ include "distributed-jmeter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
role: server
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: server
spec:
replicas: {{ .Values.server.replicaCount }}
strategy:
Expand All @@ -15,13 +16,13 @@ spec:
matchLabels:
app.kubernetes.io/name: {{ include "distributed-jmeter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
role: server
app.kubernetes.io/component: server
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "distributed-jmeter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
role: server
app.kubernetes.io/component: server
spec:
containers:
- name: {{ .Chart.Name }}
Expand All @@ -31,3 +32,11 @@ spec:
ports:
- containerPort: 50000
- containerPort: 1099
volumeMounts:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
5 changes: 3 additions & 2 deletions k8s/templates/jmeter-server-service.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-server
name: {{ template "distributed-jmeter.fullname" . }}-server
labels:
app.kubernetes.io/name: {{ include "distributed-jmeter.name" . }}
helm.sh/chart: {{ include "distributed-jmeter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/component: server
spec:
clusterIP: None
ports:
Expand All @@ -19,4 +20,4 @@ spec:
selector:
app.kubernetes.io/name: {{ include "distributed-jmeter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
role: server
app.kubernetes.io/component: server
4 changes: 4 additions & 0 deletions k8s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ image:
## The tag for the image
## ref: https://hub.docker.com/r/pedrocesarti/jmeter-docker/tags/
tag: 3.3

volumes: []

volumeMounts: []
2 changes: 1 addition & 1 deletion scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ case $1 in
server)
$JMETER_HOME/bin/jmeter-server \
-Dserver.rmi.localport=50000 \
-Dserver_port=1099
-Dserver_port=1099 $JMETER_SERVER_ADDITIONA_ARGS
;;
*)
echo "Sorry, this option doesn't exist!"
Expand Down
16 changes: 0 additions & 16 deletions templates/NOTES.txt

This file was deleted.

32 changes: 0 additions & 32 deletions templates/_helpers.tpl

This file was deleted.

Loading