Skip to content

Instantly share code, notes, and snippets.

@roadsideseb
Last active April 1, 2023 14:33
Show Gist options
  • Save roadsideseb/7a9c8809a76b3b82712ca241285dca9d to your computer and use it in GitHub Desktop.
Save roadsideseb/7a9c8809a76b3b82712ca241285dca9d to your computer and use it in GitHub Desktop.
Load testing Python web apps with Gatling
class flaskGunicornConstantRamp extends Simulation {
val flaskGunicorn = http.baseURL("http://flask-gunicorn:8080")
val scn = scenario(
"flask - gunicorn " +
"(" + Constants.Workers + " workers ) - " +
Constants.ConcurrentUsers + " users")
.exec(http("Endpoint " + Constants.Endpoint).get(Constants.Endpoint))
val rampTime = 10 seconds
val runTime = 60 seconds
setUp(
scn.inject(
rampUsersPerSec(0) to(100) during(rampTime),
constantUsersPerSec(100) during(runTime),
rampUsersPerSec(100) to(200) during(rampTime),
constantUsersPerSec(200) during(runTime),
rampUsersPerSec(200) to(300) during(rampTime),
constantUsersPerSec(300) during(runTime),
rampUsersPerSec(300) to(400) during(rampTime),
constantUsersPerSec(400) during(runTime),
rampUsersPerSec(400) to(500) during(rampTime),
constantUsersPerSec(500) during(runTime),
rampUsersPerSec(500) to(600) during(rampTime),
constantUsersPerSec(600) during(runTime),
rampUsersPerSec(600) to(700) during(rampTime),
constantUsersPerSec(700) during(runTime),
rampUsersPerSec(700) to(800) during(rampTime),
constantUsersPerSec(800) during(runTime),
rampUsersPerSec(800) to(900) during(rampTime),
constantUsersPerSec(900) during(runTime),
rampUsersPerSec(900) to(1000) during(rampTime),
constantUsersPerSec(1000) during(runTime)
).protocols(flaskGunicorn)
)
}
{
"ConfigVersion": 3,
"Driver": {
"IPAddress": "⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆⋆",
"MachineName": "gatling-test-server",
"SSHUser": "root",
"SSHPort": 22,
"SSHKeyPath": "~/.docker/machine/machines/gatling-test-server/id_rsa",
"StorePath": "~/.docker/machine",
"SwarmMaster": false,
"SwarmHost": "tcp://0.0.0.0:3376",
"SwarmDiscovery": "",
"AccessToken": "⋆⋆⋆⋆⋆⋆⋆⋆",
"DropletID": "⋆⋆⋆⋆⋆⋆⋆⋆",
"DropletName": "",
"Image": "ubuntu-16-04-x64",
"Region": "tor1",
"SSHKeyID": "⋆⋆⋆⋆⋆⋆⋆⋆",
"SSHKeyFingerprint": "",
"SSHKey": "",
"Size": "2gb",
"IPv6": false,
"Backups": false,
"PrivateNetworking": false,
"UserDataFile": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment