Gatling Kafka extensions : Consumers

649 views
Skip to first unread message

Kevin Nash

unread,
Mar 14, 2018, 12:47:04 PM3/14/18
to Gatling User Group

Hi,

 


I am trying to extend the gatling kafka extension (by Muneyuki Noguchi) for consumers, using the gatling-jms module as a template. 

it works after a fashion. (But I’m coming to grips with the combination of Scala, Akka and Gatling so it could be definitely

improved.There are some TODO's ..)

 

In any case I have one particular issue I was wondering about. After a successful run my 

active users is -20 and percentage is 200%. Instead of 0 and 100% (see example put below)

 

https://github.com/caoimhindenais/gatling-kafka


I update the stats in this package (KafkaRequestTrackerActor.scala)

 

 statsEngine.logResponse(session, title, timings, status, None, message)
 next ! session.logGroupRequest(timings.responseTime, status).increaseDrift(nowMillis - received)


Is this something you’ve seen before or can shed some light on?

 

Thanks for any insights,

Kevin


 

Simulation util.BasicSimulation started...

 

================================================================================

2018-03-14 17:03:47                                           5s elapsed

---- Requests ------------------------------------------------------------------

> Global                                                   (OK=20     KO=0     )

> Send Kafka Message                                       (OK=20     KO=0     )

 

---- Kafka Test ----------------------------------------------------------------

[####################################################################################################################################################]200%

          waiting: 0      / active: -20    / done:40    

Kevin Nash

unread,
Mar 18, 2018, 4:31:38 PM3/18/18
to Gatling User Group
So there are twice as many end events sent as I would expect and this explains why the active count is negative.
But why are they too many events I'm not sure


ConsoleDataWriter onUserMessage

case End =>
 usersCounters
.get(session.scenario) match {
 
case Some(name) => name.userDone()
 
case _ => logger.error(s"Internal error, scenario '${session.scenario}' has not been correctly initialized")
 
}

Example of the end event message

Envelope(UserMessage(Session(Kafka Test,1,Map(),1521404578214,0,OK,List(),io.gatling.core.protocol.ProtocolComponentsRegistry$$Lambda$283/1641027464@4193d921),End,1521404578430),Actor[akka://GatlingSystem/deadLetters])



Kevin Nash

unread,
Mar 24, 2018, 6:22:36 AM3/24/18
to Gatling User Group
So for this scenario,  5 Users

scn
  .inject(constantUsersPerSec(1) during (5 seconds))).maxDuration(7 seconds)
.protocols(kafkaConf)

I get 5    :  "[DEBUG] i.g.c.c.i.Injector - Start user"
And 10  :  "[DEBUG] i.g.c.a.Exit - End user"

This explains why the ConsoleDataWriter displays incorrectly:

waiting: 0      / active: -5     / done:10  


Buts its not clear why each user "gets exited" twice
Message has been deleted

Kevin Nash

unread,
Mar 24, 2018, 11:41:39 AM3/24/18
to Gatling User Group
The producer was closing the session and then the consumer was.
The session should finish when the consumer has received and verified the Kafka message.
Anyway active users are looking better now :-)




================================================================================
2018-03-24 16:30:27                                          46s elapsed
---- Requests ------------------------------------------------------------------
> Global                                                   (OK=750000 KO=0     )
> Send Kafka Message                                       (OK=750000 KO=0     )

---- Kafka Test ----------------------------------------------------------------
 
[##########################################################################]100%
  waiting
: 0      / active: 0      / done:750000
================================================================================


Reply all
Reply to author
Forward
0 new messages