Send a request asynchronously per unit of time

Dear all,

I have been using Gatling the last months and becoming more and more enthusiastic about it!

There’s one problem that is buggering me today. The application I’m testing requires to send a keep-alive request every 10 minutes for the session to keep alive. These keep-alive requests are now send at the moment that the recorder recorded them. However the actions in between can take longer when you generate a large load on the application. The results in the session being timed out at a certain moment.

I want to solve this neatly by making Gatling send this type of request every 10 minutes in a session irrespective of what happens in the scenario.

Any ideas?

Cheers,
Roy

What’s you Scala level? Which version of Gatling do you use?

I’m not afraid of some advanced Scala. I’m not the greatest expert, but I got a lot of geniuses with several years of Scala experience around me who can help me on that part.

I’m using Gatling v1.5.1.

Scala 2.9, so no implicit value classes then, damn...

Here's what you can (no very simple, sorry):

   - store into the session the last ping time
   - define a method that would take a request and chain it with a doIf
   block that would test the ping time and if it's more that 10 minutes,
   update it and send the ping request
   - you can then either patch the API to add a new execAndPing method to
   existing DSL elements, or try to override exec method

Clear?

Sounds neat and do-able, thank you! I got another question along the same lines, will make another post.

I gave it another thought, but now I have to use some kind of threshold (say 1 minute before the session elapses, so at 9 minutes) when I will send a keep-alive. But what if there is an action that takes longer than the threshold?

Hypothetically this could go wrong? Do you think it is doable to have two Akka actors per session? One executing the normal script and the other responsible for the keep-alive?

I gave it another thought, but now I have to use some kind of threshold
(say 1 minute before the session elapses, so at 9 minutes) when I will send
a keep-alive. But what if there is an action that takes longer than the
threshold?

Cross your fingers it doesn't happen.

Hypothetically this could go wrong? Do you think it is doable to have two
Akka actors per session? One executing the normal script and the other
responsible for the keep-alive?

A user is not an Actor, it's a message.

Ideally, what you'd need is this:
https://github.com/excilys/gatling/issues/431

Haha yeah maybe crossing my fingers would be the easiest way out! :wink: Indeed that’s precisely what I need. I’m looking forward to the official 2.0 release!

Have a nice weekend twice!