Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.mnogu:gatling-kafka:0.3.1'
}
dependencies {
implementation("com.github.mnogu:gatling-kafka:0.3.1")
}
<dependency>
<groupId>com.github.mnogu</groupId>
<artifactId>gatling-kafka</artifactId>
<version>0.3.1</version>
</dependency>
libraryDependencies += "com.github.mnogu" % "gatling-kafka" % "0.3.1"
:dependencies [[com.github.mnogu/gatling-kafka "0.3.1"]]
An unofficial Gatling 3.3.1 stress test plugin for Apache Kafka 2.4.0 protocol.
This plugin supports the Kafka producer API only and doesn't support the Kafka consumer API.
$ git clone https://github.com/mnogu/gatling-kafka.git
$ cd gatling-kafka
Install sbt 0.13 if you don't have. And create a jar file:
$ sbt assembly
If you want to change the version of Gatling used to create a jar file,
change the following line in build.sbt
:
"io.gatling" % "gatling-core" % "3.3.1" % "provided",
and run sbt assembly
.
If you don't want to include kafka-clients library to the jar file,
change a line on kafka-clients in build.sbt
from
("org.apache.kafka" % "kafka-clients" % "2.4.0")
to
("org.apache.kafka" % "kafka-clients" % "2.4.0" % "provided")
and run sbt assembly
.
Put the jar file to lib
directory in Gatling:
$ cp target/scala-2.12/gatling-kafka-assembly-*.jar /path/to/gatling-charts-highcharts-bundle-3.3.1.*/lib
If you edited build.sbt
in order not to include kafka-clients library
to the jar file, you also need to copy kafka-clients library to lib
directory:
$ cp /path/to/kafka-clients-*.jar /path/to/gatling-charts-highcharts-bundle-3.3.1.*/lib
$ cd /path/to/gatling-charts-highcharts-bundle-3.3.1.*
$ vi user-files/simulations/KafkaSimulation.scala
You can find sample simulation files in the test directory.
Among these files, BasicSimulation.scala would be a good start point.
Make sure that you replace BasicSimulation
with KafkaSimulation
in BasicSimulation.scala
if your simulation filename is KafkaSimulation.scala
.
Note that gatling-kafka 0.1.x isn't compatible with 0.0.x. See the README.md in the 0.0.6 release if you are using 0.0.x.
After starting an Apache Kafka server, run a stress test:
$ bin/gatling.sh
Apache License, Version 2.0