Gatling script with 10 requests per hour (less than 1 pc)

I need to write a Gatling script that mimics the interaction of real users. It should periodically issue some requests, for example. 10 per hour per user (total 20 users).

From what I see in the documents, it constantUsersPerSectakes a double, but it is rounded, and reachRpsin throttle mode it only works with seconds. Thus, there is no way to have less than 1 t / s.

Can I write such a script using Gatling?

+4
source share
1 answer

So, your script seems like "within 2 hours, send a request every 6 minutes" or "at a constant speed of 10 users per hour for 2 hours ...".

Option 1

constantUsersPerSecinternally rounded to int after multiplying it by the number of seconds of duration. Thus, the duration should be chosen in relation to the speed, so that the result will be more than 1.

In your case

def perHour(rate : Double): Double = rate / 3600

constantUsersPerSec(perHour(10)) during(2 hours)

This will lead to

10/3600 users * (2 * 60 * 60) seconds = 20 users

Option 2

using injection steps

setUp(
  scn.inject(
    atOnceUsers(1),
    nothingFor(6 minutes),
    atOnceUsers(1),
    nothingFor(6 minutes),
    //... and so forth...
  )
)

or perform injection steps in the second method

def injections(): List[InjectionStep] = List(...)

setUp(scn.inject(injections : _*))
+1
source

Source: https://habr.com/ru/post/1659736/


All Articles