This repository has been archived by the owner on Mar 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Luca Barzè
committed
Feb 15, 2017
1 parent
eea0617
commit 7a0a978
Showing
5 changed files
with
76 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
logLevel := Level.Warn | ||
logLevel := Level.Info | ||
|
||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.0") | ||
|
||
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") | ||
|
||
addSbtPlugin("io.gatling" % "gatling-sbt" % "2.2.0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/test/scala/com/github/mnogu/gatling/kafka/test/ThrottledSimulation.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.github.mnogu.gatling.kafka.test | ||
|
||
import io.gatling.core.Predef._ | ||
import org.apache.kafka.clients.producer.ProducerConfig | ||
import scala.concurrent.duration._ | ||
|
||
import com.github.mnogu.gatling.kafka.Predef._ | ||
|
||
class ThrottledSimulation extends Simulation { | ||
val kafkaConf = kafka | ||
// Kafka topic name | ||
.topic("test") | ||
// Kafka producer configs | ||
.properties( | ||
Map( | ||
ProducerConfig.ACKS_CONFIG -> "1", | ||
// list of Kafka broker hostname and port pairs | ||
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG -> "localhost:9092", | ||
|
||
// in most cases, StringSerializer or ByteArraySerializer | ||
ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG -> | ||
"org.apache.kafka.common.serialization.StringSerializer", | ||
ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG -> | ||
"org.apache.kafka.common.serialization.StringSerializer")) | ||
|
||
val scn = scenario("Kafka Test") | ||
.forever( | ||
exec( | ||
kafka("request") | ||
// message to send | ||
.send[String]("foo")) | ||
) | ||
|
||
setUp( | ||
scn.inject(atOnceUsers(10))) | ||
.throttle(jumpToRps(10), holdFor(30 seconds)) | ||
.protocols(kafkaConf) | ||
} |