@reschrei Thanks, but we can’t run this and investigate as several pieces are missing:
- the ComputerDatabase class
- the feeder file
- the Gatling version
Would you be able to share these details privately?
@reschrei Thanks, but we can’t run this and investigate as several pieces are missing:
Would you be able to share these details privately?
import com.google.protobuf.CodedOutputStream
import com.tsystems.toil.device.toil.DeviceMessage
import io.circe.Json
import io.circe.optics.JsonPath.root
import io.circe.parser.parse
import scalapb.json4s.JsonFormat
import java.io.FileNotFoundException
import scala.io.Source
import scala.util.Random
package object ComputerDatabase {
def deviceMessageToByteArray(deviceMessage: DeviceMessage): Array[Byte] = {
val byteArray = new Array[Byte](deviceMessage.serializedSize)
val stream = CodedOutputStream.newInstance(byteArray)
deviceMessage.writeTo(stream)
stream.flush()
byteArray
}
def ByteArrayToDeviceMessage(deviceMessage: Array[Byte]): DeviceMessage = {
DeviceMessage.parseFrom(deviceMessage)
}
def fromFile(fName: String): String = {
getClass.getResourceAsStream(fName) match {
case null => throw new FileNotFoundException(fName)
case stream => Source.fromInputStream(stream).getLines().mkString
}
}
def getMessageSet(file: String): String = file match {
case "levelmeter" => "CONCURRENT_USER"
case "dpdhl" => "CONCURRENT_USER"
case "sb" => "CONCURRENT_USER"
case "tracker" => "CONCURRENT_USER"
case _ => ""
}
def manualVerification(): Unit = {
val body = fromFile(s"/messages/tracker/sendTrackerEventTemp5Degree.json")
val json: Json = parse(body).getOrElse(Json.Null)
val randomVersion: Json => Json = System.getenv("PRODUCT") match {
case "levelmeter" => root.levelMeterEvent.version.int.modify(_ + Random.nextInt(1000))
case "dpdhl" | "lct" => root.trackerEvent.version.int.modify(_ + Random.nextInt(1000))
case "sb" => root.buttonPressedEvent.version.int.modify(_ + Random.nextInt(1000))
}
val modifiedJson = randomVersion(json)
deviceMessageToByteArray(JsonFormat.fromJsonString[DeviceMessage](modifiedJson.toString()))
}
}
val gatlingVersion = “3.8.4”
user;password;topic;deviceId;fName;version
887723031700005;*4$TRuM#;tracker;887723031700005;bootstrapTracker.json;1
887723031700006;n.bKv|3N;tracker;887723031700006;bootstrapTracker.json;1
887723031700007;Ksp_n3nv;tracker;887723031700007;bootstrapTracker.json;1
887723031700005;*4$TRuM#;tracker;887723031700005;defaultTracker.json;1
887723031700006;n.bKv|3N;tracker;887723031700006;defaultTracker.json;1
887723031700007;Ksp_n3nv;tracker;887723031700007;defaultTracker.json;1
887723031700005;*4$TRuM#;tracker;887723031700005;defaultTrackerDPDHL.json;1
887723031700006;n.bKv|3N;tracker;887723031700006;defaultTrackerDPDHL.json;1
887723031700007;Ksp_n3nv;tracker;887723031700007;defaultTrackerDPDHL.json;1
887723031700005;*4$TRuM#;tracker;887723031700005;dpdhlTrackerMessageWithoutPositionAndOperationalData.json;1
887723031700006;n.bKv|3N;tracker;887723031700006;dpdhlTrackerMessageWithoutPositionAndOperationalData.json;1
887723031700007;Ksp_n3nv;tracker;887723031700007;dpdhlTrackerMessageWithoutPositionAndOperationalData.json;1
Because of our internal dependencies (protobuf device message format) I would recommend to simulate that behavior by using your own synthetic data structures / files.
Recommendation:
Our mqtt broker backend should be also replaced by an own mock or real mqtt server like emqx.
I mean you could in general replace/simulate our protobuf format by any custom json format.
I’m personally suppose that the following setup description:
setUp(
scn_test_ram.inject(constantConcurrentUsers(System.getenv("CONCURRENT_USER").toInt)
.during(FiniteDuration(System.getenv("INTERVAL").toLong, SECONDS))).noShard
// .throttle(
// reachRps(10).in(120),
// holdFor(5.minute),
// jumpToRps(20),
// holdFor(6.hours)
// ).noShard
.protocols(mqttProtocol_test_ram))
.assertions(forAll.failedRequests.percent.lte(5))
}
is causing the issues, because by uncommenting the section:
// .throttle(
// reachRps(10).in(120),
// holdFor(5.minute),
// jumpToRps(20),
// holdFor(6.hours)
// ).noShard
it’s working again!