About Configuring the Number of Gatling Users and the Interval Between Runs

Asked 1 years ago, Updated 1 years ago, 88 views

We are testing the load using Gatling.

Number of users: 1
Interval: 600 seconds

setUp(scn.inject(rampUsers(1)during(600 seconds))).protocols(httpProtocol)

We are conducting a load test under this condition, but if we do, the test will be completed faster than expected.
 (Example: The test you want to complete in 600 seconds is completed in about 80 seconds.)

Could you tell me how to handle the test in order to complete it at the expected intervals?
Thank you for your cooperation.

scala gatling

2022-09-30 14:18

1 Answers

As far as the official documentation is concerned, it seems that the test run time can be specified in scenario.during().

https://gatling.io/docs/current/general/scenario/ #during

Here are some simple sample codes:

importio.gatling.core.Predef._
importio.gatling.http.Predef._

import scala.concurrent.duration._
import scala.language.postfixOps

class Aaa extensions Simulation {

  val httpProtocol=http
    .baseUrl("http://localhost:9000")
    .inferHtmlResources()
    .contentTypeHeader("text/xml; charset=utf-8")
    .userAgentHeader("Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.42000)")

  valscn=
    scenario("aaa")
      .during (600 seconds) {
        exec(http("request").get(""))
      }

  setUp(scn.inject(rampUsers(1)during(600 seconds))).protocols(httpProtocol)
}

You can see from the results that it is running 600s.

================================================================================
2021-06-04 14:11:02 600s elapped
---- Requests ---------------------------------------------------------------------------------
>Global (OK=135864KO=0)
>request (OK=33966 KO=0)
>main.css (OK=33966 KO=0)
>favicon.png (OK=33966KO=0)
>hello.js (OK=33966KO=0)

---- aaa -------------------------------------------------------------------------------
[##########################################################################]100%
          waiting:0/active:0/done:1
================================================================================

As I mentioned in the comment, please adjust the settings in scn.inject() to see what access you would like to see in the last 600 seconds.

https://gatling.io/docs/current/general/simulation_setup/ #open-model


2022-09-30 14:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.