Skip to content

Instantly share code, notes, and snippets.

@alexcpn
Created April 14, 2021 12:49
Show Gist options
  • Save alexcpn/b171a97a7717e2a1f391e8cb5df73ef4 to your computer and use it in GitHub Desktop.
Save alexcpn/b171a97a7717e2a1f391e8cb5df73ef4 to your computer and use it in GitHub Desktop.
package computerdatabase
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class BasicSimulation extends Simulation {
val httpProtocol = http.enableHttp2
// Here is the root for all relative URLs
.baseUrl("https://nginxhttp2.10.xx.xx.xx.nip.io/")
// Here are the common headers
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.doNotTrackHeader("1")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
// A scenario is a chain of requests and pauses
val scn = scenario("HTTP 2 Sessions")
.exec(
http("request_1")
.get("/")
)
/* Open model https://gatling.io/docs/3.1/general/simulation_setup/
setUp(
scn.inject(
//nothingFor(4.seconds), // 1
//atOnceUsers(100), // 2
rampUsers(5000).during(2.minutes), // 3
//constantUsersPerSec(83).during(60.seconds), // 4
//constantUsersPerSec(20).during(15.seconds).randomized, // 5
//rampUsersPerSec(1).to(5000).during(60.seconds), // 6
//rampUsersPerSec(10).to(20).during(10.minutes).randomized, // 7
//heavisideUsers(1000).during(20.seconds) // 8
).protocols(httpProtocol)
)
*/
//lets use closed model
setUp(
scn.inject(
//constantConcurrentUsers(5000) during (60 seconds), // 1
rampConcurrentUsers(1) to (5000) during (60 seconds) // 2
)
).protocols(httpProtocol)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment