{{tag>Brouillon Perf Web Scala}} = Notes tests de charge HTTP avec Gatling Voir aussi : * [[Jmeter - notes|Apache JMeter]] * [[https://www.it-connect.fr/serveur-web-tests-de-charge-en-python-avec-locust/|Serveur Web : tests de charge en Python avec Locust ]] == Install IDE pour dev Voir : * https://gatling.io/open-source/gatling-demo/video-demo/?submissionGuid=efc5d076-c18a-46ae-b1ca-4669580bfd05 * https://www.youtube.com/watch?v=5MYuQBQZ8Ys * https://github.com/gatling/gatling-tutorial * [[http://www.jpsymfony.com/outils/utilisation-de-gatling|Introduction à Gatling et Scala (obsolète mais intéressant)]] * https://www.james-willett.com/gatling-load-testing-complete-guide/ Install IDE Scala et tous le reste (pas nécessaire) apt install python-pip python3-pip snapd apt-get install openjdk-11-jdk maven wget https://downloads.lightbend.com/scala/2.12.2/scala-2.12.2.deb dpkg -i scala-2.12.2.deb snap install intellij-idea-community --classic Lancement IDE /snap/bin/intellij-idea-community == getling recorder ./gatling-charts-highcharts-bundle-3.6.0/bin/recorder.sh == Lancement ''simulation/plop/test1.scala'' package plop.hpplop.simulation.mainProfile import scala.concurrent.duration._ import io.gatling.core.Predef._ import io.gatling.http.Predef._ import io.gatling.jdbc.Predef._ class ChargeHPO extends Simulation { val durationTime = scala.util.Properties.envOrElse("DURATION", "3" ) val minUsers = scala.util.Properties.envOrElse("MINUSER", "2") val maxUsers = scala.util.Properties.envOrElse("MAXUSER", "3") val baseUrl = scala.util.Properties.envOrElse("BASEURL", "") println(baseUrl.toString) val httpProtocol = http.baseUrl(baseUrl.toString) val headers_hpo = Map( "Host" -> "acme.fr", ) val scn = scenario("HP Plop") .exec(http("Root") .get("/") .disableFollowRedirect .check(status is (301)) .headers(headers_hpo) ) setUp( scn.inject( nothingFor(10 seconds), rampUsersPerSec(minUsers.toInt) to maxUsers.toInt during (durationTime.toInt minutes) ).protocols(httpProtocol) ) } env BASEURL=http://acme.fr ~/code/http/gatling-charts-highcharts-bundle-3.6.0/bin/gatling.sh -sf simulations/plop/ -rd "Test1 " == Pb Erreur avec l'IDE gatling-tutorial/src/test/scala/Engine.scala object gatling is not a member of package io import io.gatling.app.Gatling == Notes Scala Voir aussi : Kotlin